00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __GAS_FieldVex__
00020 #define __GAS_FieldVex__
00021
00022 #include "GAS_API.h"
00023
00024 #include <GU/GU_Detail.h>
00025
00026 #include <SIM/SIM_RawField.h>
00027 #include <SIM/SIM_RawIndexField.h>
00028 #include <SIM/SIM_PhysicalParms.h>
00029
00030 #include <CVEX/CVEX_Context.h>
00031 #include <CVEX/CVEX_Value.h>
00032
00033 #include "GAS_SubSolver.h"
00034 #include "GAS_Utils.h"
00035
00036 class SIM_ScalarField;
00037 class SIM_VectorField;
00038 class SIM_MatrixField;
00039 class SIM_IndexField;
00040
00041 class GAS_API gas_volumeMap
00042 {
00043 public:
00044 UT_String name;
00045 const SIM_RawField *vlist[3][3];
00046 SIM_RawField *outlist[3][3];
00047
00048
00049 const SIM_RawIndexField *idxvlist;
00050 SIM_RawIndexField *idxoutlist;
00051
00052 UT_String dataname[3][3];
00053 int dataidx_x[3][3];
00054 int dataidx_y[3][3];
00055 CVEX_Type type;
00056 bool processed[3][3];
00057 };
00058
00059 struct GAS_API gas_volumeOutput
00060 {
00061 const SIM_RawField *srcvol;
00062 const SIM_RawIndexField *srcidxvol;
00063 SIM_RawField **outfield;
00064 SIM_RawIndexField **idxoutfield;
00065 int map;
00066 int i, j;
00067 };
00068
00069 struct GAS_API gas_volumeParms
00070 {
00071 const SIM_RawField *vol;
00072 const SIM_RawIndexField *idxvol;
00073 int argc;
00074 char **argv;
00075 UT_RefArray<gas_volumeMap> *volmap;
00076 UT_RefArray<gas_volumeOutput> outputs;
00077 };
00078
00079
00080 class GAS_API GAS_FieldVex : public GAS_SubSolver
00081 {
00082 public:
00083 GETSET_DATA_FUNCS_S("vexscript", VexScript);
00084 GETSET_DATA_FUNCS_S("bindings", Bindings);
00085 GETSET_DATA_FUNCS_B("autobind", Autobind);
00086
00087 protected:
00088 explicit GAS_FieldVex(const SIM_DataFactory *factory);
00089 virtual ~GAS_FieldVex();
00090
00091 bool shouldMultiThread(SIM_RawField *field) const
00092 { return field->field()->numTiles() > 1; }
00093
00094 virtual bool solveGasSubclass(SIM_Engine &engine,
00095 SIM_Object *obj,
00096 SIM_Time time,
00097 SIM_Time timestep);
00098
00099 void processVexScript(SIM_Object *obj,
00100 UT_String script,
00101 UT_RefArray<gas_volumeMap> &volmap) const;
00102 void executeVex(SIM_Object *obj, int argc, char **argv,
00103 UT_RefArray<gas_volumeMap> &volmap) const;
00104
00105 THREADED_METHOD1_CONST(GAS_FieldVex, true, processVexVolume,
00106 gas_volumeParms &, parms)
00107 void processVexVolumePartial(gas_volumeParms &parms,
00108 const UT_JobInfo &info) const;
00109
00110 bool processVexBlock(CVEX_Context &context,
00111 int argc, char **argv,
00112 const UT_RefArray<gas_volumeOutput> &outlist,
00113 const SIM_RawField *vol,
00114 const SIM_RawIndexField *idxvol,
00115 const UT_RefArray<gas_volumeMap> &volmap,
00116 int num, int *ix, int *iy, int *iz,
00117 const UT_JobInfo &info) const;
00118 private:
00119 static const SIM_DopDescription *getDopDescription();
00120
00121 fpreal myTime, myTimeInc, myFrame;
00122
00123 DECLARE_STANDARD_GETCASTTOTYPE();
00124 DECLARE_DATAFACTORY(GAS_FieldVex,
00125 GAS_SubSolver,
00126 "Gas Field Vex",
00127 getDopDescription());
00128 };
00129
00130 #endif