00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __GAS_Diffuse__
00020 #define __GAS_Diffuse__
00021
00022 #include "GAS_API.h"
00023
00024 #include <UT/UT_ThreadedAlgorithm.h>
00025 #include <GU/GU_Detail.h>
00026
00027 #include "GAS_SubSolver.h"
00028 #include "GAS_Utils.h"
00029
00030 class GU_Detail;
00031 class SIM_RawField;
00032 class UT_Vector4Array;
00033
00034 class GAS_API GAS_Diffuse : public GAS_SubSolver
00035 {
00036 public:
00037 GET_DATA_FUNC_S(GAS_NAME_FIELD, FieldName);
00038 GETSET_DATA_FUNCS_F("diffuse", DiffuseRate);
00039 GET_DATA_FUNC_F("cflcond", CFLCond);
00040 GET_DATA_FUNC_I("maxiter", MaxIter);
00041 GET_DATA_FUNC_I("miniter", MinIter);
00042 GET_DATA_FUNC_B("relax", DoRelax);
00043 GET_DATA_FUNC_S(GAS_NAME_GEOMETRY, Geometry);
00044 GET_DATA_FUNC_S("attribute", Attribute);
00045 GET_DATA_FUNC_I("attribtype", AttribType);
00046
00047 GET_DATA_FUNC_B(GAS_NAME_USETIMESTEP, UseTimeStep);
00048 GET_DATA_FUNC_F(GAS_NAME_TIMESCALE, TimeScale);
00049
00050 bool shouldMultiThread() { return true; }
00051
00052 protected:
00053
00054 enum gas_AttribType {
00055 FLOAT1,
00056 FLOAT2,
00057 FLOAT3,
00058 FLOAT4,
00059 VECTOR
00060 };
00061
00062 explicit GAS_Diffuse(const SIM_DataFactory *factory);
00063 virtual ~GAS_Diffuse();
00064
00065
00066
00067 virtual bool solveGasSubclass(SIM_Engine &engine,
00068 SIM_Object *obj,
00069 SIM_Time time,
00070 SIM_Time timestep);
00071
00072
00073 void doDiffuse(SIM_RawField *field,
00074 SIM_Time timestep);
00075
00076
00077 void doDiffuse(GU_Detail *gdp,
00078 SIM_Time timestep,
00079 const UT_String &attribname,
00080 gas_AttribType type);
00081
00082
00083
00084 fpreal calculateTimestep(const GU_Detail *gdp,
00085 const gas_AttribType type,
00086 const int attribSize,
00087 const UT_Vector4Array &deltas,
00088 fpreal cflCond,
00089 fpreal mindivstep,
00090 fpreal maxdivstep,
00091 fpreal timeleft);
00092
00093
00094
00095 THREADED_METHOD6(GAS_Diffuse, shouldMultiThread(), computeDeltas,
00096 const GU_Detail *, gdp,
00097 UT_Vector4Array &, deltas,
00098 const fpreal, diffuseRate,
00099 const gas_AttribType, type,
00100 const int, attribSize,
00101 const UT_String &, attribName)
00102 void computeDeltasPartial(const GU_Detail *gdp,
00103 UT_Vector4Array &deltas,
00104 const fpreal diffuseRate,
00105 const gas_AttribType type,
00106 const int attribSize,
00107 const UT_String &attribName,
00108 const UT_JobInfo &info);
00109
00110
00111
00112 THREADED_METHOD6(GAS_Diffuse, shouldMultiThread(), applyDeltas,
00113 GU_Detail *, gdp,
00114 const UT_Vector4Array &, deltas,
00115 const gas_AttribType, type,
00116 const int, attribSize,
00117 const UT_String &, attribName,
00118 SIM_Time, timestep)
00119 void applyDeltasPartial(GU_Detail *gdp,
00120 const UT_Vector4Array &deltas,
00121 const gas_AttribType type,
00122 const int attribSize,
00123 const UT_String &attribName,
00124 SIM_Time timestep,
00125 const UT_JobInfo &info);
00126
00127 private:
00128 static const SIM_DopDescription *getDopDescription();
00129
00130 DECLARE_STANDARD_GETCASTTOTYPE();
00131 DECLARE_DATAFACTORY(GAS_Diffuse,
00132 GAS_SubSolver,
00133 "Gas Diffuse",
00134 getDopDescription());
00135 };
00136
00137 #endif