SIM_VectorField Class Reference

This class holds a three dimensional vector field. More...

#include <SIM_VectorField.h>

Inheritance diagram for SIM_VectorField:

SIM_Data SIM_OptionsUser SIM_SopVectorField

List of all members.

Public Member Functions

 GETSET_DATA_FUNCS_I (SIM_NAME_UNIFORMVOXELS, UniformVoxels)
 Control the number of divisions.
 GETSET_DATA_FUNCS_B (SIM_NAME_TWOD, TwoDField)
 GETSET_DATA_FUNCS_I (SIM_NAME_VOXELPLANE, VoxelPlane)
 GETSET_DATA_FUNCS_V3 (SIM_NAME_DIV, RawDivisions)
 GETSET_DATA_FUNCS_I ("uniformdiv", RawUniformDivisions)
 GETSET_DATA_FUNCS_V3 (SIM_NAME_CENTER, RawCenter)
 GETSET_DATA_FUNCS_V3 (SIM_NAME_SIZE, RawSize)
 GETSET_DATA_FUNCS_V3 ("slicediv", SliceDivisions)
 GETSET_DATA_FUNCS_V3 ("sliceoverlapneg", SliceOverlapNeg)
 GETSET_DATA_FUNCS_V3 ("sliceoverlappos", SliceOverlapPos)
 GETSET_DATA_FUNCS_I (SIM_NAME_VOXELSAMPLE, VoxelSampleRaw)
 GETSET_DATA_FUNCS_B ("closedends", ClosedEnds)
 GETSET_DATA_FUNCS_B ("closexneg", CloseXNeg)
 GETSET_DATA_FUNCS_B ("closeyneg", CloseYNeg)
 GETSET_DATA_FUNCS_B ("closezneg", CloseZNeg)
 GETSET_DATA_FUNCS_B ("closexpos", CloseXPos)
 GETSET_DATA_FUNCS_B ("closeypos", CloseYPos)
 GETSET_DATA_FUNCS_B ("closezpos", CloseZPos)
 GETSET_DATA_FUNCS_V3 (SIM_NAME_DIRECTION, ExternalDirection)
 GETSET_DATA_FUNCS_F (SIM_NAME_TOLERANCE, Tolerance)
 GETSET_DATA_FUNCS_I ("border", RawBorder)
UT_VoxelBorderType getBorder () const
void getBBox (UT_BoundingBox &bbox) const
UT_Vector3 getOrig () const
UT_Vector3 getDivisions () const
UT_Vector3 getSize () const
UT_Vector3 getCenter () const
void setDivisions (const UT_Vector3 &div)
void setSize (const UT_Vector3 &div)
void setCenter (const UT_Vector3 &div)
void resizeKeepData (const UT_Vector3 &size, const UT_Vector3 &center)
void matchField (const SIM_ScalarField *field)
void matchField (const SIM_VectorField *field, bool matchsample=false)
void matchField (const SIM_MatrixField *field)
void matchField (const SIM_IndexField *field)
bool isAligned (const SIM_ScalarField *field) const
bool isAligned (const SIM_MatrixField *field) const
bool isAligned (const SIM_VectorField *field) const
bool isAligned (const SIM_RawField *field) const
bool isMatching (const SIM_VectorField *field) const
bool isFaceSampled () const
bool isCenterSampled () const
bool isSelfAligned () const
 True if our internal fields are aligned.
SIM_FieldSample getVoxelSample (int axis) const
const UT_Vector3getVoxelSize (int axis) const
fpreal getVoxelDiameter (int axis) const
UT_Vector3 getValue (const UT_Vector3 &pos) const
UT_DMatrix3 getGradient (const UT_Vector3 &pos) const
 Computes the gradient of the vector field in world space..
UT_Vector3 getCurl (const UT_Vector3 &pos) const
 Computes the curl at a given worldspace.
UT_Vector3 getCellValue (int x, int y, int z) const
void addToCell (int x, int y, int z, const UT_Vector3 &dv)
void advect (UT_Vector3 &pos, fpreal time) const
void advectMidpoint (UT_Vector3 &pos, fpreal time) const
 Uses second order explicity runge-kutta integration.
void advect (const SIM_VectorField *vel, fpreal timestep, const SIM_RawField *collision=0, SIM_FieldAdvection advectmethod=SIM_ADVECT_TRACE)
void advect (sim_PointVelocity getVelocity, fpreal timestep, fpreal voxelsize, const SIM_RawField *collision=0)
void projectToNonDivergent (const SIM_RawField *pressureboundary=0, const SIM_RawField *collision=0, SIM_RawField *pressureout=0, bool preservebubble=true, const SIM_RawField *goaldiv=0, SIM_RawIndexField *compout=0, bool ghostfluid=true, bool variational=true, SIM_RawField::PCG_METHOD pcgmethod=SIM_RawField::PCG_MIC, int numiterforcenter=20)
void projectToNonDivergentCenter (const SIM_RawField *pressureboundary, const SIM_RawField *goaldiv, int numiter)
void projectToNonDivergentFace (const SIM_RawField *pressureboundary, const SIM_RawField *collision, SIM_RawField *pressureout=0, bool preservebubble=true, const SIM_RawField *goaldiv=0, SIM_RawIndexField *compout=0, bool ghostfluid=true, bool variational=true, SIM_RawField::PCG_METHOD pcgmethod=SIM_RawField::PCG_MIC)
 THREADED_METHOD1_CONST (SIM_VectorField, getField(0)->shouldMultiThread(), buildDivergenceCenter, SIM_RawField &, div) void buildDivergenceCenterPartial(SIM_RawField &div
 Evaluates the divergence field for this velocity field.
 THREADED_METHOD4 (SIM_VectorField, getField(axis)->shouldMultiThread(), applyPressureGradientFace, int, axis, const SIM_RawField *, pressure, const SIM_RawField *, surface, const SIM_RawIndexField *, comp) void applyPressureGradientFacePartial(int axis
 THREADED_METHOD1 (SIM_VectorField, getField(0)->shouldMultiThread(), applyPressureGradientCenter, const SIM_RawField *, pressure) void applyPressureGradientCenterPartial(const SIM_RawField *pressure
void distributeBoundaryDivergenceToVolumeFace (SIM_RawField &div, const SIM_RawField *pressureboundary=0, int compnum=-1, const SIM_RawIndexField *comp=0)
bool hasSurfaceCell (SIM_RawField &div, const SIM_RawField *pressureboundary, const SIM_RawField *collision, int compnum, const SIM_RawIndexField &comp) const
 Determines if the given component has any surface cells.
void distributeBoundaryDivergenceToSurfaceFace (SIM_RawField &div, const SIM_RawField *pressureboundary, const SIM_RawField *collision, int compnum, const UT_VoxelArray< int64 > &comp)
void enforceBoundary (const SIM_ScalarField *collision=0, const SIM_VectorField *cvel=0)
 Enforces boundary conditions on the array.
void enforceVelBoundary (const SIM_ScalarField *collision, UT_Vector3 calcVelocity(const UT_Vector3 &pos, void *vp), void *vvp, void calcPhysParms(const UT_Vector3 &pos, void *vp, fpreal &bounce, fpreal &friction, fpreal &dynfriction), void *vpp, bool forbidinterference)
bool indexToPos (int axis, int x, int y, int z, UT_Vector3 &pos) const
 Converts an integer index into a worldspace position.
bool posToIndex (int axis, const UT_Vector3 &pos, int &x, int &y, int &z) const
 Converts a worldspace position into an integer index.
SIM_RawFieldgetField (int axis) const
 Retrieve raw field.
SIM_RawFieldgetXField () const
SIM_RawFieldgetYField () const
SIM_RawFieldgetZField () const
void setField (int axis, SIM_RawField *field)
SIM_RawFieldstealField (int axis)
void pubHandleModification ()
GU_ConstDetailHandle createSmokeRepresentation (const SIM_RootData &root) const
 Creates a GDP with us as a Volume Primitive inside it.
void addSmokeRepresentation (const SIM_RootData &root, GU_Detail *gdp) const

Public Attributes

const UT_JobInfo &info const
const SIM_RawFieldpressure
const SIM_RawField const
SIM_RawField
surface
const SIM_RawField const
SIM_RawField const
SIM_RawIndexField
comp
const SIM_RawField const
SIM_RawField const
SIM_RawIndexField const
UT_JobInfo
info
const UT_JobInfoinfo

Protected Member Functions

 SIM_VectorField (const SIM_DataFactory *factory)
virtual ~SIM_VectorField ()
virtual void initializeSubclass ()
 Overrides to properly implement this class as a SIM_Data.
virtual void makeEqualSubclass (const SIM_Data *source)
 myField aware copy constructor.
virtual void saveSubclass (ostream &os) const
 Saves our attributes, and our internal data if it has been set.
virtual bool loadSubclass (UT_IStream &is)
 Loads our attributes and internal data if it was set when we saved.
virtual int64 getMemorySizeSubclass () const
virtual void optionChangedSubclass (const char *name)
 Override the setDivisions to rebuild our voxel array on demand.


Detailed Description

This class holds a three dimensional vector field.
Examples:

SIM/SIM_GasAdd.C.

Definition at line 41 of file SIM_VectorField.h.


Constructor & Destructor Documentation

SIM_VectorField::SIM_VectorField ( const SIM_DataFactory factory  )  [explicit, protected]

virtual SIM_VectorField::~SIM_VectorField (  )  [protected, virtual]


Member Function Documentation

void SIM_VectorField::addSmokeRepresentation ( const SIM_RootData root,
GU_Detail gdp 
) const

Adds a volume primitive version of our field to the given gdp.

void SIM_VectorField::addToCell ( int  x,
int  y,
int  z,
const UT_Vector3 dv 
)

Adds a velocity to the given *voxel*. If this is face, it is divided in two and spread on each of 6 faces. If it is corner, it is divided by 8 and spread along each of 8 corners.

void SIM_VectorField::advect ( sim_PointVelocity  getVelocity,
fpreal  timestep,
fpreal  voxelsize,
const SIM_RawField collision = 0 
)

void SIM_VectorField::advect ( const SIM_VectorField vel,
fpreal  timestep,
const SIM_RawField collision = 0,
SIM_FieldAdvection  advectmethod = SIM_ADVECT_TRACE 
)

Advects this field by the other given field. Handles the possibility that the other field is this field.

void SIM_VectorField::advect ( UT_Vector3 pos,
fpreal  time 
) const

Treats this field as a velocity field and advects the given position for the given length of time. Uses first order explicit euler integration

void SIM_VectorField::advectMidpoint ( UT_Vector3 pos,
fpreal  time 
) const

Uses second order explicity runge-kutta integration.

GU_ConstDetailHandle SIM_VectorField::createSmokeRepresentation ( const SIM_RootData root  )  const

Creates a GDP with us as a Volume Primitive inside it.

void SIM_VectorField::distributeBoundaryDivergenceToSurfaceFace ( SIM_RawField div,
const SIM_RawField pressureboundary,
const SIM_RawField collision,
int  compnum,
const UT_VoxelArray< int64 > &  comp 
)

Distributes any divergence in the boundary condition among all voxels that are on the boundary of the pressureboundary but not on the collision boundary.

void SIM_VectorField::distributeBoundaryDivergenceToVolumeFace ( SIM_RawField div,
const SIM_RawField pressureboundary = 0,
int  compnum = -1,
const SIM_RawIndexField comp = 0 
)

Distributes any divergence in the boundary condition among all voxels equally.

void SIM_VectorField::enforceBoundary ( const SIM_ScalarField collision = 0,
const SIM_VectorField cvel = 0 
)

Enforces boundary conditions on the array.

void SIM_VectorField::enforceVelBoundary ( const SIM_ScalarField collision,
UT_Vector3   calcVelocityconst UT_Vector3 &pos, void *vp,
void *  vvp,
void   calcPhysParmsconst UT_Vector3 &pos, void *vp, fpreal &bounce, fpreal &friction, fpreal &dynfriction,
void *  vpp,
bool  forbidinterference 
)

Enforces boundary conditions on a velocity field by making sure we are lifting from the surface, allowing tangential motion. forbidinterference keeps the normal enforcement behaviour of explicitly setting all side boundaries that have a inward pointing velocity to zero relative motion.

void SIM_VectorField::getBBox ( UT_BoundingBox bbox  )  const

Controls the dimensions of where the field is properly defined in the field space.

UT_VoxelBorderType SIM_VectorField::getBorder (  )  const [inline]

Definition at line 71 of file SIM_VectorField.h.

UT_Vector3 SIM_VectorField::getCellValue ( int  x,
int  y,
int  z 
) const

Gets the velocity at the given *voxel* location, interpolating if we have corner or face velocities.

UT_Vector3 SIM_VectorField::getCenter (  )  const

UT_Vector3 SIM_VectorField::getCurl ( const UT_Vector3 pos  )  const

Computes the curl at a given worldspace.

UT_Vector3 SIM_VectorField::getDivisions (  )  const

Calculate the size and divisions according to options such as 2d or equal sized voxels.

SIM_RawField* SIM_VectorField::getField ( int  axis  )  const [inline]

Retrieve raw field.

Examples:
SIM/SIM_GasAdd.C.

Definition at line 255 of file SIM_VectorField.h.

UT_DMatrix3 SIM_VectorField::getGradient ( const UT_Vector3 pos  )  const

Computes the gradient of the vector field in world space..

virtual int64 SIM_VectorField::getMemorySizeSubclass (  )  const [protected, virtual]

Override this function to return an accurate representation of the amount of memory used by this piece of data. The size of subdata should not be included in this calculation.

Reimplemented from SIM_Data.

UT_Vector3 SIM_VectorField::getOrig (  )  const [inline]

Definition at line 77 of file SIM_VectorField.h.

SIM_VectorField::GETSET_DATA_FUNCS_B ( "closezpos"  ,
CloseZPos   
)

SIM_VectorField::GETSET_DATA_FUNCS_B ( "closeypos"  ,
CloseYPos   
)

SIM_VectorField::GETSET_DATA_FUNCS_B ( "closexpos"  ,
CloseXPos   
)

SIM_VectorField::GETSET_DATA_FUNCS_B ( "closezneg"  ,
CloseZNeg   
)

SIM_VectorField::GETSET_DATA_FUNCS_B ( "closeyneg"  ,
CloseYNeg   
)

SIM_VectorField::GETSET_DATA_FUNCS_B ( "closexneg"  ,
CloseXNeg   
)

SIM_VectorField::GETSET_DATA_FUNCS_B ( "closedends"  ,
ClosedEnds   
)

SIM_VectorField::GETSET_DATA_FUNCS_B ( SIM_NAME_TWOD  ,
TwoDField   
)

SIM_VectorField::GETSET_DATA_FUNCS_F ( SIM_NAME_TOLERANCE  ,
Tolerance   
)

SIM_VectorField::GETSET_DATA_FUNCS_I ( "border"  ,
RawBorder   
)

SIM_VectorField::GETSET_DATA_FUNCS_I ( SIM_NAME_VOXELSAMPLE  ,
VoxelSampleRaw   
)

SIM_VectorField::GETSET_DATA_FUNCS_I ( "uniformdiv"  ,
RawUniformDivisions   
)

SIM_VectorField::GETSET_DATA_FUNCS_I ( SIM_NAME_VOXELPLANE  ,
VoxelPlane   
)

SIM_VectorField::GETSET_DATA_FUNCS_I ( SIM_NAME_UNIFORMVOXELS  ,
UniformVoxels   
)

Control the number of divisions.

SIM_VectorField::GETSET_DATA_FUNCS_V3 ( SIM_NAME_DIRECTION  ,
ExternalDirection   
)

SIM_VectorField::GETSET_DATA_FUNCS_V3 ( "sliceoverlappos"  ,
SliceOverlapPos   
)

SIM_VectorField::GETSET_DATA_FUNCS_V3 ( "sliceoverlapneg"  ,
SliceOverlapNeg   
)

SIM_VectorField::GETSET_DATA_FUNCS_V3 ( "slicediv"  ,
SliceDivisions   
)

SIM_VectorField::GETSET_DATA_FUNCS_V3 ( SIM_NAME_SIZE  ,
RawSize   
)

SIM_VectorField::GETSET_DATA_FUNCS_V3 ( SIM_NAME_CENTER  ,
RawCenter   
)

SIM_VectorField::GETSET_DATA_FUNCS_V3 ( SIM_NAME_DIV  ,
RawDivisions   
)

UT_Vector3 SIM_VectorField::getSize (  )  const

UT_Vector3 SIM_VectorField::getValue ( const UT_Vector3 pos  )  const

Access the field value given a world space location. This does trilinear interpolation.

fpreal SIM_VectorField::getVoxelDiameter ( int  axis  )  const

SIM_FieldSample SIM_VectorField::getVoxelSample ( int  axis  )  const

const UT_Vector3& SIM_VectorField::getVoxelSize ( int  axis  )  const

SIM_RawField* SIM_VectorField::getXField (  )  const [inline]

Definition at line 256 of file SIM_VectorField.h.

SIM_RawField* SIM_VectorField::getYField (  )  const [inline]

Definition at line 257 of file SIM_VectorField.h.

SIM_RawField* SIM_VectorField::getZField (  )  const [inline]

Definition at line 258 of file SIM_VectorField.h.

bool SIM_VectorField::hasSurfaceCell ( SIM_RawField div,
const SIM_RawField pressureboundary,
const SIM_RawField collision,
int  compnum,
const SIM_RawIndexField comp 
) const

Determines if the given component has any surface cells.

bool SIM_VectorField::indexToPos ( int  axis,
int  x,
int  y,
int  z,
UT_Vector3 pos 
) const

Converts an integer index into a worldspace position.

virtual void SIM_VectorField::initializeSubclass (  )  [protected, virtual]

Overrides to properly implement this class as a SIM_Data.

Reimplemented from SIM_Data.

bool SIM_VectorField::isAligned ( const SIM_RawField field  )  const

bool SIM_VectorField::isAligned ( const SIM_VectorField field  )  const

True if we are component-wise aligned, our x/y/z fields may still be unaligned with respect to each other.

bool SIM_VectorField::isAligned ( const SIM_MatrixField field  )  const

bool SIM_VectorField::isAligned ( const SIM_ScalarField field  )  const

bool SIM_VectorField::isCenterSampled (  )  const [inline]

Definition at line 129 of file SIM_VectorField.h.

bool SIM_VectorField::isFaceSampled (  )  const [inline]

Definition at line 124 of file SIM_VectorField.h.

bool SIM_VectorField::isMatching ( const SIM_VectorField field  )  const [inline]

Determines if we match in terms of voxel cells - same bounding box and number of cells. Due to sampling, this does not mean the sample points will match Because our internal fields are always matching by definition, we can just test the first field.

Definition at line 121 of file SIM_VectorField.h.

bool SIM_VectorField::isSelfAligned (  )  const [inline]

True if our internal fields are aligned.

Definition at line 135 of file SIM_VectorField.h.

virtual bool SIM_VectorField::loadSubclass ( UT_IStream is  )  [protected, virtual]

Loads our attributes and internal data if it was set when we saved.

Reimplemented from SIM_Data.

virtual void SIM_VectorField::makeEqualSubclass ( const SIM_Data source  )  [protected, virtual]

myField aware copy constructor.

Reimplemented from SIM_Data.

void SIM_VectorField::matchField ( const SIM_IndexField field  ) 

void SIM_VectorField::matchField ( const SIM_MatrixField field  ) 

void SIM_VectorField::matchField ( const SIM_VectorField field,
bool  matchsample = false 
)

void SIM_VectorField::matchField ( const SIM_ScalarField field  ) 

Match this field to the given reference field. We will end up with the same size/divisions/twod/uniform, but not the same sampling pattern

virtual void SIM_VectorField::optionChangedSubclass ( const char *  name  )  [protected, virtual]

Override the setDivisions to rebuild our voxel array on demand.

Reimplemented from SIM_OptionsUser.

bool SIM_VectorField::posToIndex ( int  axis,
const UT_Vector3 pos,
int &  x,
int &  y,
int &  z 
) const

Converts a worldspace position into an integer index.

void SIM_VectorField::projectToNonDivergent ( const SIM_RawField pressureboundary = 0,
const SIM_RawField collision = 0,
SIM_RawField pressureout = 0,
bool  preservebubble = true,
const SIM_RawField goaldiv = 0,
SIM_RawIndexField compout = 0,
bool  ghostfluid = true,
bool  variational = true,
SIM_RawField::PCG_METHOD  pcgmethod = SIM_RawField::PCG_MIC,
int  numiterforcenter = 20 
)

Projects the field into the space of non-divergent fields. All divergent components of this field are removed.

void SIM_VectorField::projectToNonDivergentCenter ( const SIM_RawField pressureboundary,
const SIM_RawField goaldiv,
int  numiter 
)

void SIM_VectorField::projectToNonDivergentFace ( const SIM_RawField pressureboundary,
const SIM_RawField collision,
SIM_RawField pressureout = 0,
bool  preservebubble = true,
const SIM_RawField goaldiv = 0,
SIM_RawIndexField compout = 0,
bool  ghostfluid = true,
bool  variational = true,
SIM_RawField::PCG_METHOD  pcgmethod = SIM_RawField::PCG_MIC 
)

void SIM_VectorField::pubHandleModification (  )  [inline]

Examples:
SIM/SIM_GasAdd.C.

Definition at line 268 of file SIM_VectorField.h.

void SIM_VectorField::resizeKeepData ( const UT_Vector3 size,
const UT_Vector3 center 
)

Resizes our field keeping our field data. The final size will be an integer number of voxels matching our current voxel size. The final center will be an integer number of voxel offset from our current center. This allows us to do a perfect copy of the data.

virtual void SIM_VectorField::saveSubclass ( ostream &  os  )  const [protected, virtual]

Saves our attributes, and our internal data if it has been set.

Reimplemented from SIM_Data.

void SIM_VectorField::setCenter ( const UT_Vector3 div  ) 

void SIM_VectorField::setDivisions ( const UT_Vector3 div  ) 

Adjusts the size/divisions of this field, overriding and twod or uniform voxel settings.

void SIM_VectorField::setField ( int  axis,
SIM_RawField field 
)

Sets the field to the given field, gaining ownership of it. The new field must already match the field it will replace.

void SIM_VectorField::setSize ( const UT_Vector3 div  ) 

SIM_RawField* SIM_VectorField::stealField ( int  axis  ) 

Steals the field, replacing this copy with an empty field and returning the old version.

SIM_VectorField::THREADED_METHOD1 ( SIM_VectorField  ,
getField(0)->shouldMultiThread()  ,
applyPressureGradientCenter  ,
const SIM_RawField ,
pressure   
) const

SIM_VectorField::THREADED_METHOD1_CONST ( SIM_VectorField  ,
getField(0)->shouldMultiThread()  ,
buildDivergenceCenter  ,
SIM_RawField ,
div   
)

Evaluates the divergence field for this velocity field.

SIM_VectorField::THREADED_METHOD4 ( SIM_VectorField  ,
getField(axis)->shouldMultiThread()  ,
applyPressureGradientFace  ,
int  ,
axis  ,
const SIM_RawField ,
pressure  ,
const SIM_RawField ,
surface  ,
const SIM_RawIndexField ,
comp   
)

Applies a pressure differential to the given component of our velocity field


Member Data Documentation

Definition at line 202 of file SIM_VectorField.h.

Definition at line 191 of file SIM_VectorField.h.

Definition at line 213 of file SIM_VectorField.h.

Definition at line 202 of file SIM_VectorField.h.

Definition at line 202 of file SIM_VectorField.h.

Definition at line 202 of file SIM_VectorField.h.


The documentation for this class was generated from the following file:

Generated on Fri May 25 00:10:41 2012 for HDK by  doxygen 1.5.9