00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __GAS_ParticleToField__
00020 #define __GAS_ParticleToField__
00021
00022 #include "GAS_API.h"
00023
00024 #include "GAS_SubSolver.h"
00025 #include "GAS_Utils.h"
00026
00027 #include <SIM/SIM_RawField.h>
00028
00029 #include <UT/UT_ThreadedAlgorithm.h>
00030
00031 class GEO_PointTree;
00032
00033 class GAS_API GAS_ParticleToField : public GAS_SubSolver
00034 {
00035 public:
00036 GET_DATA_FUNC_S(GAS_NAME_FIELD, FieldName);
00037 GET_DATA_FUNC_S(GAS_NAME_GEOMETRY, GeometryName);
00038
00039 GET_DATA_FUNC_S("attrib", Attribute);
00040 GET_DATA_FUNC_F("threshold", Threshold);
00041 GET_DATA_FUNC_B("accumulate", Accumulate);
00042 GET_DATA_FUNC_B("scalebyvolume", ScaleByVoxelVolume);
00043 GET_DATA_FUNC_B("extrapolate", Extrapolate);
00044 GET_DATA_FUNC_B("usemaxextrapolate", UseMaxExtrapolate);
00045 GET_DATA_FUNC_F("maxextrapolate", MaxExtrapolate);
00046 GET_DATA_FUNC_B("usemaxextrapolatedist", UseMaxExtrapolateDist);
00047 GET_DATA_FUNC_F("maxextrapolatedist", MaxExtrapolateDist);
00048 GET_DATA_FUNC_F("bandwidth", Bandwidth);
00049
00050 GET_DATA_FUNC_I("calculationtype", CalculationType);
00051 GET_DATA_FUNC_F("dstpreadd", DstPreAdd);
00052 GET_DATA_FUNC_F("dstpremul", DstPreMul);
00053 GET_DATA_FUNC_F("srcpreadd", SrcPreAdd);
00054 GET_DATA_FUNC_F("srcpremul", SrcPreMul);
00055 GET_DATA_FUNC_F("postadd", PostAdd);
00056 GET_DATA_FUNC_F("postmul", PostMul);
00057
00058 GET_DATA_FUNC_I("srctimescale", SrcTimeScale);
00059 GET_DATA_FUNC_I("dsttimescale", DstTimeScale);
00060 GET_DATA_FUNC_I("posttimescale", PostTimeScale);
00061
00062 protected:
00063 explicit GAS_ParticleToField(const SIM_DataFactory *factory);
00064 virtual ~GAS_ParticleToField();
00065
00066
00067
00068 virtual bool solveGasSubclass(SIM_Engine &engine,
00069 SIM_Object *obj,
00070 SIM_Time time,
00071 SIM_Time timestep);
00072
00073 void particleToField(SIM_Object *obj,
00074 SIM_RawField *destfield,
00075 const GU_Detail *particles,
00076 fpreal timestep,
00077 const char *attributename,
00078 int offset,
00079 const UT_DMatrix4 &xform);
00080
00081 struct gas_particleToFieldParms
00082 {
00083 fpreal threshold, bandwidth;
00084 bool extrapolate, usemaxextrapolate;
00085 fpreal maxextrapolatedist;
00086 fpreal d_preadd, d_premul;
00087 fpreal s_preadd, s_premul;
00088 fpreal postadd, postmul;
00089 MIX_NAMES calctype;
00090
00091 const char *attribname;
00092 int offset;
00093 UT_DMatrix4 xform;
00094 };
00095
00096 THREADED_METHOD4(GAS_ParticleToField, destfield->shouldMultiThread(),
00097 applyParticleToField,
00098 SIM_RawField *, destfield,
00099 const GU_Detail *, particles,
00100 GEO_PointTree *, pttree,
00101 gas_particleToFieldParms &, parms)
00102 void applyParticleToFieldPartial(
00103 SIM_RawField *destfield,
00104 const GU_Detail *particles,
00105 GEO_PointTree *pttree,
00106 gas_particleToFieldParms &parms,
00107 const UT_JobInfo &info);
00108
00109
00110
00111 private:
00112 static const SIM_DopDescription *getDopDescription();
00113
00114 DECLARE_STANDARD_GETCASTTOTYPE();
00115 DECLARE_DATAFACTORY(GAS_ParticleToField,
00116 GAS_SubSolver,
00117 "Gas Particle To Field",
00118 getDopDescription());
00119 };
00120
00121 #endif
00122