00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __GAS_Calculate__
00020 #define __GAS_Calculate__
00021
00022 #include "GAS_API.h"
00023
00024 #include <UT/UT_ThreadedAlgorithm.h>
00025 #include <GU/GU_Detail.h>
00026
00027 #include <SIM/SIM_RawField.h>
00028 #include <SIM/SIM_PhysicalParms.h>
00029
00030 #include "GAS_SubSolver.h"
00031 #include "GAS_Utils.h"
00032
00033 class GAS_API GAS_Calculate : public GAS_SubSolver
00034 {
00035 public:
00036 GET_DATA_FUNC_S(GAS_NAME_FIELDDEST, FieldDstName);
00037 GET_DATA_FUNC_S(GAS_NAME_FIELDSOURCE, FieldSrcName);
00038 GET_DATA_FUNC_S("dstblend", DstBlend);
00039 GET_DATA_FUNC_S("srcblend", SrcBlend);
00040
00041 GET_DATA_FUNC_S("srcindex", SrcIndexName);
00042 GET_DATA_FUNC_I("property", Property);
00043
00044 GET_DATA_FUNC_I("srctimescale", SrcTimeScale);
00045 GET_DATA_FUNC_I("dsttimescale", DstTimeScale);
00046 GET_DATA_FUNC_I("posttimescale", PostTimeScale);
00047
00048 GET_DATA_FUNC_I("calculationtype", CalculationType);
00049 GET_DATA_FUNC_I("blendmethod", BlendMethod);
00050 GET_DATA_FUNC_F("dstpreadd", DstPreAdd);
00051 GET_DATA_FUNC_F("dstpremul", DstPreMul);
00052 GET_DATA_FUNC_I("dstconvert", DstConvert);
00053 GET_DATA_FUNC_I("dstscale", DstScale);
00054 GET_DATA_FUNC_F("srcpreadd", SrcPreAdd);
00055 GET_DATA_FUNC_F("srcpremul", SrcPreMul);
00056 GET_DATA_FUNC_I("srcconvert", SrcConvert);
00057 GET_DATA_FUNC_I("srcscale", SrcScale);
00058 GET_DATA_FUNC_F("postadd", PostAdd);
00059 GET_DATA_FUNC_F("postmul", PostMul);
00060 GET_DATA_FUNC_I("postconvert", PostConvert);
00061 GET_DATA_FUNC_I("postscale", PostScale);
00062
00063 GET_DATA_FUNC_F("dstblendpreadd", DstBlendPreAdd);
00064 GET_DATA_FUNC_F("dstblendpremul", DstBlendPreMul);
00065 GET_DATA_FUNC_I("dstblendconvert", DstBlendConvert);
00066 GET_DATA_FUNC_I("dstblendscale", DstBlendScale);
00067 GET_DATA_FUNC_F("srcblendpreadd", SrcBlendPreAdd);
00068 GET_DATA_FUNC_F("srcblendpremul", SrcBlendPreMul);
00069 GET_DATA_FUNC_I("srcblendconvert", SrcBlendConvert);
00070 GET_DATA_FUNC_I("srcblendscale", SrcBlendScale);
00071
00072
00073 enum BLEND_NAMES
00074 {
00075 BLEND_NONE,
00076 BLEND_WEIGHTEDAVERAGE,
00077 BLEND_WEIGHTEDSUM,
00078 BLEND_NETNEWAVERAGE,
00079 BLEND_NETNEWSDF,
00080 NUM_BLEND
00081 };
00082
00083
00084 enum CONVERT_NAMES {
00085 CONVERT_NONE,
00086 CONVERT_SDFTOFOG,
00087 CONVERT_SDFTOSURFACE,
00088 CONVERT_ABS,
00089 NUM_CONVERT
00090 };
00091
00092
00093 static fpreal convertValues(CONVERT_NAMES type, LENGTHSCALE_NAMES lengthscale, fpreal premul, fpreal preadd, fpreal value, fpreal width);
00094 static bool blendValues(BLEND_NAMES blendmethod, fpreal &d, fpreal dblend, fpreal &sfactor, fpreal sblend);
00095
00096 protected:
00097 explicit GAS_Calculate(const SIM_DataFactory *factory);
00098 virtual ~GAS_Calculate();
00099
00100
00101
00102 virtual bool solveGasSubclass(SIM_Engine &engine,
00103 SIM_Object *obj,
00104 SIM_Time time,
00105 SIM_Time timestep);
00106
00107 THREADED_METHOD2(GAS_Calculate, dst->shouldMultiThread(),
00108 mixEachVoxel,
00109 SIM_RawField *, dst,
00110 const SIM_RawField *, src)
00111 void mixEachVoxelPartial(SIM_RawField *dst,
00112 const SIM_RawField *src,
00113 const UT_JobInfo &info);
00114
00115 THREADED_METHOD4(GAS_Calculate, dst->shouldMultiThread(),
00116 mixEachVoxelIndex,
00117 SIM_Engine &, engine,
00118 SIM_RawField *, dst,
00119 const SIM_IndexField *, src,
00120 int, srcaxis)
00121 void mixEachVoxelIndexPartial(SIM_Engine &engine,
00122 SIM_RawField *dst,
00123 const SIM_IndexField *src,
00124 int srcaxis,
00125 const UT_JobInfo &info);
00126
00127
00128 THREADED_METHOD4(GAS_Calculate, dst->shouldMultiThread(),
00129 blendEachVoxel,
00130 SIM_RawField *, dst,
00131 const SIM_RawField *, src,
00132 const SIM_RawField *, dstblend,
00133 const SIM_RawField *, srcblend)
00134 void blendEachVoxelPartial(SIM_RawField *dst,
00135 const SIM_RawField *src,
00136 const SIM_RawField *dstblend,
00137 const SIM_RawField *srcblend,
00138 const UT_JobInfo &info);
00139
00140 THREADED_METHOD6(GAS_Calculate, dst->shouldMultiThread(),
00141 blendEachVoxelIndex,
00142 SIM_Engine &, engine,
00143 SIM_RawField *, dst,
00144 const SIM_IndexField *, src,
00145 int, srcaxis,
00146 const SIM_RawField *, dstblend,
00147 const SIM_RawField *, srcblend)
00148 void blendEachVoxelIndexPartial(SIM_Engine &engine,
00149 SIM_RawField *dst,
00150 const SIM_IndexField *src,
00151 int srcaxis,
00152 const SIM_RawField *dstblend,
00153 const SIM_RawField *srcblend,
00154 const UT_JobInfo &info);
00155
00156
00157
00158
00159
00160
00161 bool isPropertyThreadsafe() const;
00162
00163 private:
00164 static const SIM_DopDescription *getDopDescription();
00165
00166 DECLARE_STANDARD_GETCASTTOTYPE();
00167 DECLARE_DATAFACTORY(GAS_Calculate,
00168 GAS_SubSolver,
00169 "Gas Calculate",
00170 getDopDescription());
00171
00172
00173
00174 float myTimeStep;
00175 };
00176
00177 #endif