00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __GAS_ExternalForces__
00020 #define __GAS_ExternalForces__
00021
00022 #include "GAS_API.h"
00023
00024 #include <SIM/SIM_VectorField.h>
00025 #include "GAS_SubSolver.h"
00026 #include "GAS_Utils.h"
00027
00028 class SIM_ForceResolver;
00029
00030 class GAS_API GAS_ExternalForces : public GAS_SubSolver
00031 {
00032 public:
00033 GET_DATA_FUNC_S(GAS_NAME_SURFACE, SurfaceName);
00034 GET_DATA_FUNC_S(GAS_NAME_DENSITY, DensityName);
00035 GET_DATA_FUNC_S(GAS_NAME_VELOCITY, VelocityName);
00036 GET_DATA_FUNC_S(GAS_NAME_GEOMETRY, GeometryName);
00037 GET_DATA_FUNC_S("forcenames", ForceNames);
00038 GET_DATA_FUNC_B("scalebysurface", ScaleBySurface);
00039 GET_DATA_FUNC_B("scalebydensity", ScaleByDensity);
00040 GET_DATA_FUNC_I("scaletype", ScaleType);
00041 GET_DATA_FUNC_B("computev", ComputeVelocity);
00042 GET_DATA_FUNC_B("stabledrag", StableDrag);
00043
00044 GET_DATA_FUNC_B(GAS_NAME_USETIMESTEP, UseTimeStep);
00045 GET_DATA_FUNC_F(GAS_NAME_TIMESCALE, TimeScale);
00046
00047
00048
00049 enum ScaleMethod {
00050 MASS,
00051 DENSITY
00052 };
00053
00054 protected:
00055 explicit GAS_ExternalForces(const SIM_DataFactory *factory);
00056 virtual ~GAS_ExternalForces();
00057
00058
00059
00060
00061
00062 virtual bool solveGasSubclass(SIM_Engine &engine,
00063 SIM_Object *obj,
00064 SIM_Time time,
00065 SIM_Time timestep);
00066
00067 protected:
00068 void applyForcesToField(SIM_Object *obj,
00069 SIM_VectorField *velocity,
00070 SIM_ScalarField *surface,
00071 SIM_ScalarField *density,
00072 SIM_Time timestep);
00073
00074 THREADED_METHOD6(GAS_ExternalForces, velocity->getXField()->shouldMultiThread(),
00075 applyForceResolversToField,
00076 SIM_Object *, obj,
00077 SIM_VectorField *, velocity,
00078 SIM_RawField *, surface,
00079 SIM_RawField *, density,
00080 SIM_Time, timestep,
00081 const UT_PtrArray<SIM_ForceResolver *> &, forceresolvers)
00082 void applyForceResolversToFieldPartial(SIM_Object *obj,
00083 SIM_VectorField *velocity,
00084 SIM_RawField *surface,
00085 SIM_RawField *density,
00086 SIM_Time timestep,
00087 const UT_PtrArray<SIM_ForceResolver *> &forceresolvers,
00088 const UT_JobInfo &info);
00089
00090
00091 void applyForcesToGeo(SIM_Object *obj,
00092 GU_Detail *gdp,
00093 SIM_Time timestep);
00094
00095 private:
00096 static const SIM_DopDescription *getDopDescription();
00097
00098 DECLARE_STANDARD_GETCASTTOTYPE();
00099 DECLARE_DATAFACTORY(GAS_ExternalForces,
00100 GAS_SubSolver,
00101 "Gas External Forces",
00102 getDopDescription());
00103 };
00104
00105 #endif
00106