11 #ifndef __SIM_VectorField__
12 #define __SIM_VectorField__
85 return getCenter() - getSize()/2;
111 void matchField(
const SIM_VectorField *field,
bool matchsample =
false);
131 {
return getField(0)->isMatching(field->
getField(0)); }
150 {
return getVoxelSample(0) == getVoxelSample(1) &&
151 getVoxelSample(1) == getVoxelSample(2); }
160 { myFields[0]->setVoxelSize(voxelsize);
161 myFields[1]->setVoxelSize(voxelsize);
162 myFields[2]->setVoxelSize(voxelsize);
244 bool toCorner =
false)
const
247 buildDivergenceCornerInternal(div,
stencil,
true);
249 buildDivergenceCenterInternal(div,
stencil);
258 buildDivergenceCornerInternal(div,
stencil,
false);
267 applyPressureGradientFace,
273 bool, pressureBoundaryAtFace)
274 void applyPressureGradientFacePartial(
int axis,
279 bool pressureBoundaryAtFace,
291 bool fromCorner = false)
294 applyPressureGradientCornerInternal(pressure, stencil,
false);
296 applyPressureGradientCenterInternal(pressure, stencil);
305 applyPressureGradientCornerInternal(pressure,
stencil,
true);
354 ut_velocityCalc calcVelocity,
356 ut_physParmCalc calcPhysParms,
358 bool forbidinterference,
369 ut_velocityCalc calcVelocity,
371 ut_physParmCalc calcPhysParms,
392 enforceVelBoundaryVariationalAxis,
396 void enforceVelBoundaryVariationalAxisPartial(
401 bool indexToPos(
int axis,
int x,
int y,
int z,
UT_Vector3 &pos)
const;
404 bool posToIndex(
int axis,
const UT_Vector3 &pos,
int &
x,
int &
y,
int &
z)
const;
423 {
return getField(0)->hasNan() || getField(1)->hasNan() || getField(2)->hasNan(); }
430 for (
int i = 0; i < 3; i++)
431 if (!getField(i)->field()->isConstant(0))
return false;
439 void testForNan()
const;
448 {
for (
int i = 0; i < 3; i++) getField(i)->markGridAsChanged(); }
452 void updateTotalVoxels();
483 buildDivergenceCenterInternal,
486 void buildDivergenceCenterInternalPartial(
SIM_RawField& div,
494 buildDivergenceCornerInternal,
499 bool backCorner,
const UT_JobInfo& info)
const;
504 applyPressureGradientCenterInternal,
507 void applyPressureGradientCenterInternalPartial(
const SIM_RawField* pressure,
516 applyPressureGradientCornerInternal,
520 void applyPressureGradientCornerInternalPartial(
const SIM_RawField* pressure,
528 void setSkipFieldRebuildOnOptionChanged(
bool skip)
530 mySkipFieldRebuild =
skip;
534 bool getSkipFieldRebuildOnOptionChanged()
const
536 return mySkipFieldRebuild;
540 bool mySkipFieldRebuild;
555 myStashedValue = myField->getSkipFieldRebuildOnOptionChanged();
556 myField->setSkipFieldRebuildOnOptionChanged(
true);
561 myField->setSkipFieldRebuildOnOptionChanged(myStashedValue);
565 myField->rebuildFields();
578 void rebuildFields();
585 getVectorFieldDopDescription());
#define SIM_NAME_VOXELPLANE
#define SIM_NAME_POSITIONPATH
virtual void makeEqualSubclass(const SIM_Data *source)
bool appearsToBeUnused() const
#define SIM_NAME_VOXELSAMPLE
#define DECLARE_STANDARD_GETCASTTOTYPE()
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
GA_API const UT_StringHolder div
virtual bool loadSubclass(UT_IStream &is)
#define SIM_NAME_TOLERANCE
#define THREADED_METHOD6_CONST(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2, PARMTYPE3, PARMNAME3, PARMTYPE4, PARMNAME4, PARMTYPE5, PARMNAME5, PARMTYPE6, PARMNAME6)
virtual void optionChangedSubclass(const char *name)
static void advectRK3(UT_Vector3 &pos, const SIM_RawField *velx, const SIM_RawField *vely, const SIM_RawField *velz, float time, const SIM_RawField *collision=0, float cfl=1.0F)
Advect a point with TVD-RK3 method.
const UT_Vector3 & getVoxelSize(int axis) const
#define GETSET_DATA_FUNCS_B(DataName, FuncName)
#define SIM_NAME_DIRECTION
GT_API const UT_StringHolder time
void buildDivergenceCorner(SIM_RawField &div, const SIM_RawField *stencil=NULL) const
#define THREADED_METHOD1(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1)
#define GETSET_DATA_FUNCS_S(DataName, FuncName)
UT_Vector3T< float > UT_Vector3
bool isSelfAligned() const
True if our internal fields are aligned.
GLdouble GLdouble GLdouble z
const SIM_ScalarField * collision
virtual int64 getMemorySizeSubclass() const
static void advectRK4(UT_Vector3 &pos, const SIM_RawField *velx, const SIM_RawField *vely, const SIM_RawField *velz, float time, const SIM_RawField *collision=0, float cfl=1.0F)
Advect a point with TVD-RK4 method.
constexpr SYS_FORCE_INLINE T & z() noexcept
const SIM_RawField * getField(int axis) const
Retrieve raw field.
const SIM_RawField * getYField() const
SIM_RawField * getXField()
static void advectMidpoint(UT_Vector3 &pos, const SIM_RawField *velx, const SIM_RawField *vely, const SIM_RawField *velz, float time, const SIM_RawField *collision=0, float cfl=1.0F)
Advect a point with the midpoint method.
This class holds a three dimensional scalar field.
**But if you need a result
SIM_RawField rawfield_type
#define GETSET_DATA_FUNCS_F(DataName, FuncName)
void setBorder(UT_VoxelBorderType border)
#define GETSET_DATA_FUNCS_V3(DataName, FuncName)
#define THREADED_METHOD3(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2, PARMTYPE3, PARMNAME3)
__hostdev__ float getValue(uint32_t i) const
#define DECLARE_DATAFACTORY(DataClass, SuperClass, Description, DopParms)
void pubHandleModification()
UT_Vector3 getVoxelSize() const
SIM_RawField * getField(int axis)
#define THREADED_METHOD2(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2)
GLsizei GLsizei GLchar * source
virtual void saveSubclass(std::ostream &os) const
SkipFieldRebuildScope(SIM_VectorField *field)
const SIM_RawField * getZField() const
bool isCornerSampled() const
#define SIM_NAME_UNIFORMVOXELS
#define GETSET_DATA_FUNCS_I(DataName, FuncName)
GLuint const GLchar * name
bool isMatching(const SIM_VectorField *field) const
UT_VoxelBorderType getBorder() const
ut_velocityCalc calcVelocity
UT_Vector3 getOrig() const
This class holds a three dimensional tensor field.
bool isFaceSampled() const
#define THREADED_METHOD2_CONST(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2)
bool hasNan() const
True if we contain any NANs.
static void advect(UT_Vector3 &pos, const SIM_RawField *velx, const SIM_RawField *vely, const SIM_RawField *velz, float time, const SIM_RawField *collision=0, float cfl=1.0F)
Verbs that can be performed on these fields.
GLint GLint GLsizei GLint border
ut_physParmCalc calcPhysParms
void setVoxelSize(const UT_Vector3 &voxelsize)
void handleModification(int code=-1)
bool isCenterSampled() const
#define THREADED_METHOD6(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2, PARMTYPE3, PARMNAME3, PARMTYPE4, PARMNAME4, PARMTYPE5, PARMNAME5, PARMTYPE6, PARMNAME6)
This class holds a three dimensional scalar field.
void advectRK3(UT_Vector3 &pos, float time, float cfl=1.0f) const
Uses third order explicit runge-kutta integration.
SIM_RawField * getYField()
void applyPressureGradientCorner(const SIM_RawField *pressure, const SIM_RawField *stencil=NULL)
void advect(UT_Vector3 &pos, float time, float cfl=1.0f) const
GLint GLfloat GLint stencil
constexpr SYS_FORCE_INLINE T & y() noexcept
#define THREADED_METHOD3_CONST(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2, PARMTYPE3, PARMNAME3)
const SIM_VectorField * velocity
fpreal getVoxelDiameter(int axis) const
This class holds a three dimensional vector field.
const SIM_RawField * weights
const SIM_RawField * getXField() const
void buildDivergenceCenter(SIM_RawField &div, const SIM_RawField *stencil=NULL, bool toCorner=false) const
SIM_RawField * getZField()
constexpr SYS_FORCE_INLINE T & x() noexcept
void advectRK4(UT_Vector3 &pos, float time, float cfl=1.0f) const
Uses fourth order explicit runge-kutta integration.
virtual void initializeSubclass()
void advectMidpoint(UT_Vector3 &pos, float time, float cfl=1.0f) const
Uses second order explicit runge-kutta integration.