00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __GAS_Elasticity__
00025 #define __GAS_Elasticity__
00026
00027 #include "GAS_API.h"
00028
00029 #include "GAS_SubSolver.h"
00030 #include "GAS_Utils.h"
00031
00032 #include <UT/UT_PtrArray.h>
00033
00034 #include <UT/UT_ThreadedAlgorithm.h>
00035
00036 class GEO_AttributeHandle;
00037 class GU_Point;
00038 class GU_Detail;
00039 class GAS_SPH;
00040 class UT_IntArray;
00041 class UT_FloatArray;
00042 class UT_String;
00043 class UT_HashTable;
00044
00045 class GAS_API GAS_Elasticity : public GAS_SubSolver
00046 {
00047 public:
00048 GET_DATA_FUNC_S(GAS_NAME_GEOMETRY, GeometryName);
00049 GET_DATA_FUNC_F("elasticityconst", ElasticityConstant);
00050 GET_DATA_FUNC_B("doelasticity", DoElasticity);
00051 GET_DATA_FUNC_B("computev", ComputeVelocity);
00052 GET_DATA_FUNC_B("useid", UseID);
00053
00054 bool shouldMultiThread() { return true; }
00055
00056 protected:
00057 explicit GAS_Elasticity(const SIM_DataFactory *factory);
00058 virtual ~GAS_Elasticity();
00059
00060
00061
00062
00063 virtual bool solveGasSubclass(SIM_Engine &engine,
00064 SIM_Object *obj,
00065 SIM_Time time,
00066 SIM_Time timestep);
00067
00068 THREADED_METHOD3(GAS_Elasticity, shouldMultiThread(), applySprings,
00069 GU_Detail *, gdp, fpreal, elasticityconst,
00070 SIM_Time, timestep)
00071 void applySpringsPartial(GU_Detail *gdp,
00072 fpreal elasticityconst, SIM_Time timestep,
00073 const UT_JobInfo &info);
00074
00075 THREADED_METHOD2(GAS_Elasticity, shouldMultiThread(), applyForces,
00076 GU_Detail *, gdp, SIM_Time, timestep)
00077 void applyForcesPartial(GU_Detail *gdp, SIM_Time timestep,
00078 const UT_JobInfo &info);
00079
00080 THREADED_METHOD1(GAS_Elasticity, shouldMultiThread(), clearForces,
00081 GU_Detail *, gdp)
00082 void clearForcesPartial(GU_Detail *gdp,
00083 const UT_JobInfo &info);
00084
00085 private:
00086 bool myUseID;
00087
00088
00089
00090 void getSprings(GEO_AttributeHandle &lengthgah,
00091 GEO_AttributeHandle &indexgah,
00092 UT_FloatArray &weightmap,
00093 UT_IntArray &indices,
00094 const UT_HashTable &weighthash);
00095
00096
00097
00098 void createLengthAttrib(GU_Detail *gdp, int size);
00099
00100
00101
00102 void createIndexAttrib(GU_Detail *gdp, int size);
00103
00104
00105 void growLengthAttrib(GU_Detail *gdp,
00106 int initialsize, int finalsize);
00107 void growIndexAttrib(GU_Detail *gdp,
00108 int initialsize, int finalsize);
00109
00110 static const SIM_DopDescription *getDopDescription();
00111
00112 DECLARE_STANDARD_GETCASTTOTYPE();
00113 DECLARE_DATAFACTORY(GAS_Elasticity,
00114 GAS_SubSolver,
00115 "Gas Elasticity",
00116 getDopDescription());
00117
00118 };
00119
00120 #endif