00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __GAS_Advect__
00020 #define __GAS_Advect__
00021
00022 #include "GAS_API.h"
00023
00024 #include <UT/UT_PtrArray.h>
00025 #include <UT/UT_ThreadedAlgorithm.h>
00026
00027 #include <GU/GU_Detail.h>
00028
00029 #include "GAS_SubSolver.h"
00030 #include "GAS_Utils.h"
00031
00032 class GAS_SPH;
00033 class GU_Detail;
00034 class SIM_VectorField;
00035 class UT_Lock;
00036
00037 class GAS_API GAS_Advect : public GAS_SubSolver
00038 {
00039 public:
00040 GET_DATA_FUNC_S(GAS_NAME_FIELD, FieldName);
00041 GET_DATA_FUNC_S(GAS_NAME_GEOMETRY, GeometryName);
00042 GET_DATA_FUNC_S(GAS_NAME_COLLISION, CollisionName);
00043 GET_DATA_FUNC_S(GAS_NAME_VELOCITY, VelocityName);
00044 GET_DATA_FUNC_B("usegeometryvelocity", UseGeometryVelocity);
00045 GET_DATA_FUNC_B("useneighbour", UseNeighbour);
00046
00047 GET_DATA_FUNC_I("advectmethod", AdvectMethod);
00048
00049 GET_DATA_FUNC_B(GAS_NAME_USETIMESTEP, UseTimeStep);
00050 GET_DATA_FUNC_F(GAS_NAME_TIMESCALE, TimeScale);
00051
00052
00053 static UT_Vector3 getVelocity(const UT_Vector3 &p, int jobnum = 0);
00054
00055 protected:
00056 explicit GAS_Advect(const SIM_DataFactory *factory);
00057 virtual ~GAS_Advect();
00058
00059
00060
00061 virtual bool solveGasSubclass(SIM_Engine &engine,
00062 SIM_Object *obj,
00063 SIM_Time time,
00064 SIM_Time timestep);
00065
00066
00067 THREADED_METHOD5(GAS_Advect, gdp->points().entries() > 100, advectPoints,
00068 GU_Detail *, gdp,
00069 const UT_DMatrix4 &, xform_togeo,
00070 const UT_DMatrix4 &, xform_toworld,
00071 const SIM_VectorField *, velocity,
00072 fpreal, timestep)
00073 void advectPointsPartial(GU_Detail *gdp,
00074 const UT_DMatrix4 &xform_togeo,
00075 const UT_DMatrix4 &xform_toworld,
00076 const SIM_VectorField *velocity,
00077 fpreal timestep,
00078 const UT_JobInfo &info);
00079
00080 THREADED_METHOD5(GAS_Advect, gdp->points().entries() > 100, advectPointsGeo,
00081 GU_Detail *, gdp,
00082 const UT_DMatrix4 &, xform_togeo,
00083 const UT_DMatrix4 &, xform_toworld,
00084 fpreal, timestep,
00085 fpreal, voxelsize)
00086 void advectPointsGeoPartial(GU_Detail *gdp,
00087 const UT_DMatrix4 &xform_togeo,
00088 const UT_DMatrix4 &xform_toworld,
00089 fpreal timestep,
00090 fpreal voxelsize,
00091 const UT_JobInfo &info);
00092
00093
00094 void advectPointsVel(SIM_Object *obj, GU_Detail *gdp, fpreal timestep);
00095
00096 private:
00097 static const SIM_DopDescription *getDopDescription();
00098
00099
00100
00101
00102 static UT_PtrArray<GAS_SPH *> ourSPHlist;
00103
00104
00105
00106 static GU_Detail *ourVelocityGdp;
00107
00108
00109
00110
00111 static bool ourDoNearestNeighbour;
00112
00113
00114
00115 static UT_Lock ourSPHlock;
00116
00117 static GAS_SPH *ourSPH;
00118
00119 DECLARE_STANDARD_GETCASTTOTYPE();
00120 DECLARE_DATAFACTORY(GAS_Advect,
00121 GAS_SubSolver,
00122 "Gas Advect",
00123 getDopDescription());
00124 };
00125
00126 #endif