00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef __GAS_AdjustElasticity__
00027 #define __GAS_AdjustElasticity__
00028
00029 #include "GAS_API.h"
00030
00031 #include "GAS_SubSolver.h"
00032 #include "GAS_Utils.h"
00033
00034 class GEO_AttributeHandle;
00035 class GU_Detail;
00036 class GAS_SPH;
00037 class UT_IntArray;
00038 class UT_FloatArray;
00039 class UT_HashTable;
00040
00041 #include <UT/UT_ThreadedAlgorithm.h>
00042
00043 class GAS_API GAS_AdjustElasticity : public GAS_SubSolver
00044 {
00045 public:
00046 GET_DATA_FUNC_S(GAS_NAME_GEOMETRY, GeometryName);
00047 GET_DATA_FUNC_B("doelasticity", DoElasticity);
00048 GET_DATA_FUNC_F("plasticityconst", PlasticityConstant);
00049 GET_DATA_FUNC_F("yieldratio", YieldRatio);
00050 GET_DATA_FUNC_B("clampsprings", ClampNumSprings);
00051 GET_DATA_FUNC_I("maxsprings", MaxSprings);
00052 GET_DATA_FUNC_B("useid", UseID);
00053
00054 bool shouldMultiThread() { return true; }
00055
00056 protected:
00057 explicit GAS_AdjustElasticity(const SIM_DataFactory *factory);
00058 virtual ~GAS_AdjustElasticity();
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_METHOD5(GAS_AdjustElasticity, shouldMultiThread(),
00069 adjustSprings, GU_Detail *, gdp,
00070 GAS_SPH &, sph,
00071 fpreal, yieldratio,
00072 fpreal, plasticityconstant,
00073 SIM_Time, timestep)
00074 void adjustSpringsPartial(GU_Detail *gdp,
00075 GAS_SPH &sph,
00076 fpreal yieldratio,
00077 fpreal plasticity,
00078 SIM_Time timestep,
00079 const UT_JobInfo &info);
00080
00081 private:
00082 bool myUseID;
00083
00084
00085
00086 void setSprings(GEO_AttributeHandle &lengthgah,
00087 GEO_AttributeHandle &indexgah,
00088 const UT_FloatArray &lengthlist,
00089 const UT_IntArray &idxlist,
00090 fpreal h, int initiallength);
00091
00092
00093
00094
00095
00096 void getSprings(GEO_AttributeHandle &lengthgah,
00097 GEO_AttributeHandle &indexgah,
00098 UT_FloatArray &weightmap,
00099 UT_IntArray &indices,
00100 const UT_HashTable &weighthash);
00101
00102
00103 void resizeSpringAttributes(GU_Detail *gdp, GAS_SPH &sph);
00104
00105
00106
00107 int getAttribSize(GU_Detail *gdp, GAS_SPH &sph);
00108
00109
00110
00111 void createLengthAttrib(GU_Detail *gdp, int size);
00112
00113
00114
00115 void createIndexAttrib(GU_Detail *gdp, int size);
00116
00117
00118 void growLengthAttrib(GU_Detail *gdp,
00119 int initialsize, int finalsize);
00120 void growIndexAttrib(GU_Detail *gdp,
00121 int initialsize, int finalsize);
00122
00123
00124
00125 void sortAndCullPoints(GEO_Point *pt,
00126 UT_PtrArray<GEO_Point *> &ptlist,
00127 int newmax) const;
00128
00129 static const SIM_DopDescription *getDopDescription();
00130
00131 DECLARE_STANDARD_GETCASTTOTYPE();
00132 DECLARE_DATAFACTORY(GAS_AdjustElasticity,
00133 GAS_SubSolver,
00134 "Gas Adjust Elasticity",
00135 getDopDescription());
00136 };
00137
00138 #endif