Blender V2.61 - r43446
|
00001 00004 /****************************************************************************** 00005 * 00006 * El'Beem - Free Surface Fluid Simulation with the Lattice Boltzmann Method 00007 * Copyright 2003-2006 Nils Thuerey 00008 * 00009 * Basic interface for all simulation modules 00010 * 00011 *****************************************************************************/ 00012 00013 #ifndef SIMULATION_OBJECT_H 00014 #define SIMULATION_OBJECT_H 00015 00016 00017 #define USE_GLUTILITIES 00018 #include "ntl_geometryshader.h" 00019 #include "parametrizer.h" 00020 00021 class LbmSolverInterface; 00022 class CellIdentifierInterface; 00023 class ntlTree; 00024 class ntlRenderGlobals; 00025 class ntlRenderGlobals; 00026 class ParticleTracer; 00027 struct elbeemSimulationSettings; 00028 00029 00031 // warning : should match typeslbm.h values! 00032 const int cFgiFlagstart = 16; 00033 typedef enum { 00034 fgiFluid = (1<<(cFgiFlagstart+0)), 00035 fgiNoFluid = (1<<(cFgiFlagstart+1)), 00036 fgiSlipNo = (1<<(cFgiFlagstart+2)), 00037 fgiSlipFree = (1<<(cFgiFlagstart+3)), 00038 fgiNoBnd = (1<<(cFgiFlagstart+4)), 00039 fgiAcc = (1<<(cFgiFlagstart+5)), 00040 fgiNoAcc = (1<<(cFgiFlagstart+6)), 00041 00042 fgiBndAll = (fgiSlipNo | fgiSlipFree) 00043 } FgiFlagType; 00044 00045 00047 class SimulationObject : 00048 public ntlGeometryShader { 00049 00050 public: 00051 00053 SimulationObject(); 00055 virtual ~SimulationObject(); 00057 void copyElbeemSettings(elbeemSimulationSettings *settings); 00058 00059 00061 void initGeoTree(); 00063 void freeGeoTree(); 00065 int geoInitGetPointType(ntlVec3Gfx org, int &OId); 00067 bool geoInitCheckPointInside(ntlVec3Gfx org, int flags, int &OId); 00068 00069 // access functions 00070 00072 double getCurrentTime( void ) { return mTime; } 00074 virtual void setGeoStart(ntlVec3Gfx set) { mGeoStart = set; } 00076 virtual void setGeoEnd(ntlVec3Gfx set) { mGeoEnd = set; } 00077 00079 void setPanic(bool set) { mPanic = set; } 00081 bool getPanic( void ) { return mPanic; } 00082 00084 int initializeLbmSimulation(ntlRenderGlobals *glob); 00085 00087 void setFrameNum(int num); 00088 00090 virtual int postGeoConstrInit(ntlRenderGlobals *glob) { return initializeLbmSimulation(glob); }; 00091 virtual int initializeShader() { /* ... */ return true; }; 00093 virtual void notifyShaderOfDump(int dumptype, int frameNr,char *frameNrStr,string outfilename); 00095 virtual void draw( void ) {}; 00096 virtual vector<ntlGeometryObject *>::iterator getObjectsBegin(); 00097 virtual vector<ntlGeometryObject *>::iterator getObjectsEnd(); 00098 00099 00101 virtual void step( void ); 00103 virtual void prepareVisualization( void ); 00104 00106 virtual void drawDebugDisplay(); 00108 virtual void drawInteractiveDisplay(); 00110 virtual void setMousePos(int x,int y, ntlVec3Gfx org, ntlVec3Gfx dir); 00111 virtual void setMouseClick(); 00112 00114 double getStartTime( void ); 00116 double getFrameTime( int frame ); 00118 double getTimestep( void ); 00119 00121 LbmSolverInterface *getSolver(){ return mpLbm; } 00122 00123 protected: 00124 00126 double mTime; 00127 00129 ntlVec3Gfx mGeoStart, mGeoEnd; 00130 00132 //? int mGeoInitId; 00134 ntlTree *mpGiTree; 00136 vector<ntlGeometryObject*> *mpGiObjects; 00138 ntlRenderGlobals *mpGlob; 00139 00141 bool mPanic; 00142 00144 int mDebugType; 00145 00147 LbmSolverInterface *mpLbm; 00148 00150 Parametrizer *mpParam; 00151 00153 ParticleTracer *mpParts; 00154 00156 bool mShowSurface; 00157 bool mShowParticles; 00158 00160 int mDebDispSetting; 00161 00163 CellIdentifierInterface *mSelectedCid; 00164 00166 elbeemSimulationSettings *mpElbeemSettings; 00167 00168 public: 00169 00170 // debug display setting funtions 00171 00173 inline void setDebugDisplay(int disp) { mDebugType = disp; } 00174 inline int getDebugDisplay() { return mDebugType; } 00175 00176 /* miscelleanous access functions */ 00177 00179 void initParametrizer(Parametrizer *set) { mpParam = set; } 00181 Parametrizer *getParametrizer() { return mpParam; } 00182 00184 // parameters same as elbeem runsimCallback 00185 int checkCallerStatus(int status, int frame); 00186 00188 virtual inline ntlVec3Gfx *getBBStart() { return &mGeoStart; } 00189 virtual inline ntlVec3Gfx *getBBEnd() { return &mGeoEnd; } 00190 00191 }; 00192 00193 00194 #endif 00195 00196 00197