00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __GAS_SPHForces__
00020 #define __GAS_SPHForces__
00021
00022 #include "GAS_API.h"
00023
00024 #include <GU/GU_Detail.h>
00025
00026 #include <UT/UT_ThreadedAlgorithm.h>
00027
00028 #include "GAS_SubSolver.h"
00029 #include "GAS_Utils.h"
00030
00031 class GU_Detail;
00032 class GAS_SPH;
00033
00034 class GAS_API GAS_SPHForces : public GAS_SubSolver
00035 {
00036 public:
00037 GET_DATA_FUNC_S(GAS_NAME_GEOMETRY, GeometryName);
00038 GET_DATA_FUNC_F("gasconstant", GasConstant);
00039 GET_DATA_FUNC_B("dopressure", DoPressure);
00040 GET_DATA_FUNC_B("doviscosity", DoViscosity);
00041 GET_DATA_FUNC_B("dotension", DoTension);
00042 GET_DATA_FUNC_B("computev", ComputeVelocity);
00043
00044 protected:
00045 explicit GAS_SPHForces(const SIM_DataFactory *factory);
00046 virtual ~GAS_SPHForces();
00047
00048
00049
00050 virtual bool solveGasSubclass(SIM_Engine &engine,
00051 SIM_Object *obj,
00052 SIM_Time time,
00053 SIM_Time timestep);
00054
00055 bool shouldMultiThread() { return true; }
00056
00057 protected:
00058 void calculatePressure(GU_Detail *gdp, fpreal gasconstant,
00059 int i = 0, int n = -1);
00060 void accumulatePressureForce(GU_Detail *gdp, GAS_SPH *sph,
00061 int i = 0, int n = -1);
00062 void accumulateViscousForce(GU_Detail *gdp, GAS_SPH *sph,
00063 int i = 0, int n = -1);
00064 void accumulateSurfaceForce(GU_Detail *gdp, GAS_SPH *sph,
00065 int i = 0, int n = -1);
00066
00067 THREADED_METHOD2(GAS_SPHForces, shouldMultiThread(), calcPressure,
00068 GU_Detail *, gdp, fpreal, gasconstant)
00069 void calcPressurePartial(GU_Detail *gdp, fpreal gasconstant,
00070 const UT_JobInfo &info);
00071
00072 THREADED_METHOD4(GAS_SPHForces, shouldMultiThread(), calcForces,
00073 GU_Detail *, gdp, bool, dopressure,
00074 bool, doviscosity, bool, dotension)
00075 void calcForcesPartial(GU_Detail *gdp,
00076 bool dopressure, bool diviscosity,
00077 bool dotension, const UT_JobInfo &info);
00078
00079 THREADED_METHOD2(GAS_SPHForces, shouldMultiThread(), applyForces,
00080 GU_Detail *, gdp, SIM_Time, timestep)
00081 void applyForcesPartial(GU_Detail *gdp, SIM_Time timestep,
00082 const UT_JobInfo &info);
00083
00084 THREADED_METHOD1(GAS_SPHForces, shouldMultiThread(), clearForces,
00085 GU_Detail *, gdp)
00086 void clearForcesPartial(GU_Detail *gdp,
00087 const UT_JobInfo &info);
00088
00089 private:
00090 static const SIM_DopDescription *getDopDescription();
00091
00092 DECLARE_STANDARD_GETCASTTOTYPE();
00093 DECLARE_DATAFACTORY(GAS_SPHForces,
00094 GAS_SubSolver,
00095 "Gas SPH Forces",
00096 getDopDescription());
00097 };
00098
00099 #endif