HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SIM_RawIndexField Class Reference

#include <SIM_RawIndexField.h>

Classes

struct  sim_buildActiveParms
 
struct  sim_extrapActiveParms
 

Public Types

typedef UT_Array< int64Indices
 
typedef SIM_VoxelBox Box
 
typedef UT_Array< BoxBoxes
 

Public Member Functions

 SIM_RawIndexField ()
 
virtual ~SIM_RawIndexField ()
 
 SIM_RawIndexField (const SIM_RawIndexField &src)
 Copy constructor: More...
 
const SIM_RawIndexFieldoperator= (const SIM_RawIndexField &src)
 Assigment operator: More...
 
void init (SIM_FieldSample sample, const UT_Vector3 &orig, const UT_Vector3 &size, int xres, int yres, int zres)
 
void init (SIM_FieldSample sample, const UT_Vector3 &orig, const UT_Vector3 &size, int xres, int yres, int zres, const UT_Vector3 &voxelsize)
 
void match (const SIM_RawField &src)
 
void match (const SIM_RawIndexField &src)
 
void makeConstant (exint cval)
 Sets this field to a constant value. More...
 
bool indexToPos (int x, int y, int z, UT_Vector3 &pos) const
 
bool indexToPos (exint x, exint y, exint z, UT_Vector3D &pos) const
 
bool posToIndex (UT_Vector3 pos, int &x, int &y, int &z) const
 Converts a worldspace position into an integer index. More...
 
bool isMatching (const SIM_RawIndexField *field) const
 
bool isAligned (const SIM_RawIndexField *field) const
 
bool isAligned (const SIM_RawField *field) const
 
exint getMemoryUsage () const
 
void getVoxelRes (int &xres, int &yres, int &zres) const
 
int getXRes () const
 
int getYRes () const
 
int getZRes () const
 
void getWorldOrigin (int &origx, int &origy, int &origz) const
 
const UT_Vector3getVoxelSize () const
 
void setVoxelSize (const UT_Vector3 &voxelsize)
 
fpreal getVoxelDiameter () const
 
UT_VoxelBorderType getBorder () const
 
exint getBorderValue () const
 
void setBorder (UT_VoxelBorderType border, exint bval)
 
bool isValidIndex (int x, int y, int z) const
 Returns true if the given x, y, z values lie inside the valid index. More...
 
void getSamplePattern (SIM_FieldSample sample, int x, int y, int z, int &numsample, int *ix, int *iy, int *iz, bool clamp) const
 
exint buildIndex (const SIM_RawField *surface, const SIM_RawField *collision)
 
exint buildPartitionedIndex (const SIM_RawField *surface, const SIM_RawField *collision)
 
 THREADED_METHOD1 (SIM_RawIndexField, shouldMultiThread(), buildCollisionLookup, const SIM_RawField *, collision) void buildCollisionLookupPartial(const SIM_RawField *collision
 
exint computeConnectedComponents (const SIM_RawField &surface)
 
exint computeConnectedComponents (const SIM_RawIndexField &idx)
 
exint computeConnectedComponentsWeighted (const SIM_RawIndexField &idx, const SIM_RawField *weights[3], const SIM_RawIndexField *sliceindex=0, int thisslice=-1)
 
void computeMetaConnected (UT_IntArray &metagroups, const SIM_RawIndexField &idx) const
 Computes connectivity of the -2 and >= 0 material types. More...
 
bool shouldMultiThread () const
 Returns true if this should be multithreaded. More...
 
exint operator() (int x, int y, int z) const
 
exint getIndex (const UT_VoxelArrayIteratorF &vit) const
 
exint getValue (const UT_Vector3 &pos) const
 
const UT_VoxelArrayIfield () const
 
UT_VoxelArrayIfieldNC () const
 
exint maxIndex () const
 
const UT_Vector3getOrig () const
 
const UT_Vector3getSize () const
 
const UT_Vector3getBBoxOrig () const
 
const UT_Vector3getBBoxSize () const
 
SIM_FieldSample getSample () const
 
void extrapolateClosestPoints (const SIM_RawIndexField *altclosept, const GU_Detail *gdp, const openvdb::tools::PointIndexGrid *ptgridvdb, fpreal uniformradius, fpreal bandwidth, bool rebuildsdf, SIM_RawField *dest=NULL, const SIM_RawField::sim_particleToFieldParms *parms=NULL)
 

Public Attributes

const UT_JobInfoinfo
 

Protected Types

typedef exint sim_extrapelem
 

Protected Member Functions

exint collapseClassIndices ()
 
bool shouldConnectIndices (exint idx1, exint idx2) const
 
 THREADED_METHOD3 (SIM_RawIndexField, shouldMultiThread(), initConnectedComponents, const SIM_RawIndexField &, idx, const SIM_RawIndexField *, sliceindex, int, thisslice)
 
void initConnectedComponentsPartial (const SIM_RawIndexField &idx, const SIM_RawIndexField *sliceindex, int thisslice, const UT_JobInfo &info)
 
 THREADED_METHOD1 (SIM_RawIndexField, shouldMultiThread(), applyLookup, const UT_VoxelArrayI &, lut)
 
void applyLookupPartial (const UT_VoxelArrayI &lut, const UT_JobInfo &info)
 
void findRange (const SIM_RawField *surface, const SIM_RawField *collision, int begin[3], int end[3]) const
 
exint countVoxelsInBox (const SIM_RawField *surface, const SIM_RawField *collision, const Box &box) const
 
void computeQueryOffsets (const SIM_RawIndexField *nindex, int nsamples, const int *dx, const int *dy, const int *dz, UT_Vector3Array &queryoffsets, UT_ValArray< fpreal > &radii) const
 
 THREADED_METHOD1 (SIM_RawIndexField, shouldMultiThread(), buildActiveLists, const sim_buildActiveParms &, parms)
 
void buildActiveListsPartial (const sim_buildActiveParms &parms, const UT_JobInfo &info)
 
 THREADED_METHOD4 (SIM_RawIndexField, tileoccupied.entries() > 10, uncompressActiveTiles, UT_VoxelArrayI &, closept, UT_VoxelArrayI &, newclosept, UT_VoxelArrayF *, dest, const UT_ValArray< bool > &, tileoccupied)
 
void uncompressActiveTilesPartial (UT_VoxelArrayI &closept, UT_VoxelArrayI &newclosept, UT_VoxelArrayF *dest, const UT_ValArray< bool > &tileoccupied, const UT_JobInfo &info)
 
 THREADED_METHOD1 (SIM_RawIndexField, parms.elements->entries() > 50, extrapolateActiveElements, const sim_extrapActiveParms &, parms)
 
void extrapolateActiveElementsPartial (const sim_extrapActiveParms &parms, const UT_JobInfo &info)
 
 THREADED_METHOD4 (SIM_RawIndexField, elements.entries() > 100, applyExtrapolatedParticleToField, const UT_ValArray< sim_extrapelem > &, elements, const GU_Detail *, gdp, SIM_RawField *, dest, const SIM_RawField::sim_particleToFieldParms &, ptfparms)
 
void applyExtrapolatedParticleToFieldPartial (const UT_ValArray< sim_extrapelem > &e, const GU_Detail *gdp, SIM_RawField *dest, const SIM_RawField::sim_particleToFieldParms &ptfparms, const UT_JobInfo &info)
 

Static Protected Member Functions

static sim_extrapelem indexToElement (const UT_VoxelArrayI &U, int x, int y, int z)
 
static void elementToIndex (const UT_VoxelArrayI &U, sim_extrapelem idx, int &x, int &y, int &z)
 

Protected Attributes

UT_VoxelArrayImyField
 
SIM_FieldSample mySample
 
exint myMaxIndex
 
UT_Vector3 myOrig
 
UT_Vector3 mySize
 
UT_Vector3 myBBoxOrig
 
UT_Vector3 myBBoxSize
 
UT_Vector3 myVoxelSize
 
fpreal myVoxelDiameter
 

Detailed Description

Definition at line 41 of file SIM_RawIndexField.h.

Member Typedef Documentation

Definition at line 45 of file SIM_RawIndexField.h.

Definition at line 46 of file SIM_RawIndexField.h.

Definition at line 44 of file SIM_RawIndexField.h.

Definition at line 288 of file SIM_RawIndexField.h.

Constructor & Destructor Documentation

SIM_RawIndexField::SIM_RawIndexField ( )
virtual SIM_RawIndexField::~SIM_RawIndexField ( )
virtual
SIM_RawIndexField::SIM_RawIndexField ( const SIM_RawIndexField src)

Copy constructor:

Member Function Documentation

void SIM_RawIndexField::applyExtrapolatedParticleToFieldPartial ( const UT_ValArray< sim_extrapelem > &  e,
const GU_Detail gdp,
SIM_RawField dest,
const SIM_RawField::sim_particleToFieldParms ptfparms,
const UT_JobInfo info 
)
protected
void SIM_RawIndexField::applyLookupPartial ( const UT_VoxelArrayI lut,
const UT_JobInfo info 
)
protected
void SIM_RawIndexField::buildActiveListsPartial ( const sim_buildActiveParms parms,
const UT_JobInfo info 
)
protected
exint SIM_RawIndexField::buildIndex ( const SIM_RawField surface,
const SIM_RawField collision 
)

Builds from a surface & collision field. -1 if inside collision, -2 if not in collision and not in surface, otherwise a unique number. Returns maximum index (which you can also get from getMaxIndex)

exint SIM_RawIndexField::buildPartitionedIndex ( const SIM_RawField surface,
const SIM_RawField collision 
)
exint SIM_RawIndexField::collapseClassIndices ( )
protected

Given a set of connectivity classes, collapse into the minimal set and renumber from 0. myMaxIndex will be updated with the resulting maximum & the number of components returned.

exint SIM_RawIndexField::computeConnectedComponents ( const SIM_RawField surface)

Computes the connected components of the given field. Anything with a value < 0 will be considered "inside" and connected to each other. Voxels with a value >= 0 will be flagged as being in component -1. The maxIndex will store the number of connected components.

exint SIM_RawIndexField::computeConnectedComponents ( const SIM_RawIndexField idx)

Computes the connected components according to the given index values. Areas of -1, -2, and >=0 will be consdiered three different material types and connectivity computed respectively.

exint SIM_RawIndexField::computeConnectedComponentsWeighted ( const SIM_RawIndexField idx,
const SIM_RawField weights[3],
const SIM_RawIndexField sliceindex = 0,
int  thisslice = -1 
)
void SIM_RawIndexField::computeMetaConnected ( UT_IntArray metagroups,
const SIM_RawIndexField idx 
) const

Computes connectivity of the -2 and >= 0 material types.

void SIM_RawIndexField::computeQueryOffsets ( const SIM_RawIndexField nindex,
int  nsamples,
const int dx,
const int dy,
const int dz,
UT_Vector3Array queryoffsets,
UT_ValArray< fpreal > &  radii 
) const
protected
exint SIM_RawIndexField::countVoxelsInBox ( const SIM_RawField surface,
const SIM_RawField collision,
const Box box 
) const
protected
static void SIM_RawIndexField::elementToIndex ( const UT_VoxelArrayI U,
sim_extrapelem  idx,
int x,
int y,
int z 
)
staticprotected
void SIM_RawIndexField::extrapolateActiveElementsPartial ( const sim_extrapActiveParms parms,
const UT_JobInfo info 
)
protected
void SIM_RawIndexField::extrapolateClosestPoints ( const SIM_RawIndexField altclosept,
const GU_Detail gdp,
const openvdb::tools::PointIndexGrid *  ptgridvdb,
fpreal  uniformradius,
fpreal  bandwidth,
bool  rebuildsdf,
SIM_RawField dest = NULL,
const SIM_RawField::sim_particleToFieldParms parms = NULL 
)
const UT_VoxelArrayI* SIM_RawIndexField::field ( ) const
inline

Definition at line 206 of file SIM_RawIndexField.h.

UT_VoxelArrayI* SIM_RawIndexField::fieldNC ( ) const
inline

Definition at line 207 of file SIM_RawIndexField.h.

void SIM_RawIndexField::findRange ( const SIM_RawField surface,
const SIM_RawField collision,
int  begin[3],
int  end[3] 
) const
protected
const UT_Vector3& SIM_RawIndexField::getBBoxOrig ( ) const
inline

Definition at line 213 of file SIM_RawIndexField.h.

const UT_Vector3& SIM_RawIndexField::getBBoxSize ( ) const
inline

Definition at line 214 of file SIM_RawIndexField.h.

UT_VoxelBorderType SIM_RawIndexField::getBorder ( ) const
inline

Definition at line 123 of file SIM_RawIndexField.h.

exint SIM_RawIndexField::getBorderValue ( ) const
inline

Definition at line 124 of file SIM_RawIndexField.h.

exint SIM_RawIndexField::getIndex ( const UT_VoxelArrayIteratorF vit) const
inline

Definition at line 199 of file SIM_RawIndexField.h.

exint SIM_RawIndexField::getMemoryUsage ( ) const
const UT_Vector3& SIM_RawIndexField::getOrig ( ) const
inline

Definition at line 211 of file SIM_RawIndexField.h.

SIM_FieldSample SIM_RawIndexField::getSample ( ) const
inline

Definition at line 216 of file SIM_RawIndexField.h.

void SIM_RawIndexField::getSamplePattern ( SIM_FieldSample  sample,
int  x,
int  y,
int  z,
int numsample,
int ix,
int iy,
int iz,
bool  clamp 
) const

Returns the set of samples in this field which correspond to the given location & sampling pattern. ix, iy, and iz should be size 8. If you want the deltas for the sampling pattern, call with x, y, z zero and clamp to false.

const UT_Vector3& SIM_RawIndexField::getSize ( ) const
inline

Definition at line 212 of file SIM_RawIndexField.h.

exint SIM_RawIndexField::getValue ( const UT_Vector3 pos) const
fpreal SIM_RawIndexField::getVoxelDiameter ( ) const
inline

Definition at line 121 of file SIM_RawIndexField.h.

void SIM_RawIndexField::getVoxelRes ( int xres,
int yres,
int zres 
) const

Returns the resolution of the voxel grid that we are sampling. This is a count of voxels, so may differ for our different sampling methods.

const UT_Vector3& SIM_RawIndexField::getVoxelSize ( ) const
inline

Definition at line 117 of file SIM_RawIndexField.h.

void SIM_RawIndexField::getWorldOrigin ( int origx,
int origy,
int origz 
) const

Consistently compute a world origin for what world space 0,0,0 would map to. A bit tricky as we want to avoid round off if we line up to 0.5... This is not necessarily 0,0,0.

int SIM_RawIndexField::getXRes ( ) const
inline

Returns the actual number of samples in each resolution. Preferred over field()->getXRes() as it doesn't require a copy of the CE fields.

Definition at line 107 of file SIM_RawIndexField.h.

int SIM_RawIndexField::getYRes ( ) const
inline

Definition at line 108 of file SIM_RawIndexField.h.

int SIM_RawIndexField::getZRes ( ) const
inline

Definition at line 109 of file SIM_RawIndexField.h.

static sim_extrapelem SIM_RawIndexField::indexToElement ( const UT_VoxelArrayI U,
int  x,
int  y,
int  z 
)
staticprotected
bool SIM_RawIndexField::indexToPos ( int  x,
int  y,
int  z,
UT_Vector3 pos 
) const

Convert indices to world coordinates and vice-versa. Note this uses this field's indices which change depending on sampling.

bool SIM_RawIndexField::indexToPos ( exint  x,
exint  y,
exint  z,
UT_Vector3D pos 
) const
void SIM_RawIndexField::init ( SIM_FieldSample  sample,
const UT_Vector3 orig,
const UT_Vector3 size,
int  xres,
int  yres,
int  zres 
)

Initializes the field. The resolution given is in terms of voxels, the actual dimensions of this field may be slightly different due to the sampling choice.

void SIM_RawIndexField::init ( SIM_FieldSample  sample,
const UT_Vector3 orig,
const UT_Vector3 size,
int  xres,
int  yres,
int  zres,
const UT_Vector3 voxelsize 
)
void SIM_RawIndexField::initConnectedComponentsPartial ( const SIM_RawIndexField idx,
const SIM_RawIndexField sliceindex,
int  thisslice,
const UT_JobInfo info 
)
protected
bool SIM_RawIndexField::isAligned ( const SIM_RawIndexField field) const

Returns true if the two fields are precisely aligned. This means that samples are matched so a given integer index into either field would give the same result.

bool SIM_RawIndexField::isAligned ( const SIM_RawField field) const
bool SIM_RawIndexField::isMatching ( const SIM_RawIndexField field) const

Returns true if the given field and this one match in terms of number of voxels and bounding box size. This means the voxel cells match - not necessarily the sample points!

bool SIM_RawIndexField::isValidIndex ( int  x,
int  y,
int  z 
) const
inline

Returns true if the given x, y, z values lie inside the valid index.

Definition at line 129 of file SIM_RawIndexField.h.

void SIM_RawIndexField::makeConstant ( exint  cval)

Sets this field to a constant value.

void SIM_RawIndexField::match ( const SIM_RawField src)

Initialize this to be the same dimension and sampling patern as the given field.

void SIM_RawIndexField::match ( const SIM_RawIndexField src)
exint SIM_RawIndexField::maxIndex ( ) const
inline

Definition at line 209 of file SIM_RawIndexField.h.

exint SIM_RawIndexField::operator() ( int  x,
int  y,
int  z 
) const
inline

Definition at line 195 of file SIM_RawIndexField.h.

const SIM_RawIndexField& SIM_RawIndexField::operator= ( const SIM_RawIndexField src)

Assigment operator:

bool SIM_RawIndexField::posToIndex ( UT_Vector3  pos,
int x,
int y,
int z 
) const

Converts a worldspace position into an integer index.

void SIM_RawIndexField::setBorder ( UT_VoxelBorderType  border,
exint  bval 
)
inline

Definition at line 125 of file SIM_RawIndexField.h.

void SIM_RawIndexField::setVoxelSize ( const UT_Vector3 voxelsize)
inline

Definition at line 118 of file SIM_RawIndexField.h.

bool SIM_RawIndexField::shouldConnectIndices ( exint  idx1,
exint  idx2 
) const
protected

Determines if two indices should be connected using our empty cell merge rule.

bool SIM_RawIndexField::shouldMultiThread ( ) const
inline

Returns true if this should be multithreaded.

Definition at line 190 of file SIM_RawIndexField.h.

SIM_RawIndexField::THREADED_METHOD1 ( SIM_RawIndexField  ,
shouldMultiThread()  ,
buildCollisionLookup  ,
const SIM_RawField ,
collision   
) const
SIM_RawIndexField::THREADED_METHOD1 ( SIM_RawIndexField  ,
shouldMultiThread()  ,
applyLookup  ,
const UT_VoxelArrayI ,
lut   
)
protected
SIM_RawIndexField::THREADED_METHOD1 ( SIM_RawIndexField  ,
shouldMultiThread()  ,
buildActiveLists  ,
const sim_buildActiveParms ,
parms   
)
protected
SIM_RawIndexField::THREADED_METHOD1 ( SIM_RawIndexField  ,
parms.elements->  entries(),
50  ,
extrapolateActiveElements  ,
const sim_extrapActiveParms ,
parms   
)
protected
SIM_RawIndexField::THREADED_METHOD3 ( SIM_RawIndexField  ,
shouldMultiThread()  ,
initConnectedComponents  ,
const SIM_RawIndexField ,
idx  ,
const SIM_RawIndexField ,
sliceindex  ,
int  ,
thisslice   
)
protected
SIM_RawIndexField::THREADED_METHOD4 ( SIM_RawIndexField  ,
tileoccupied.  entries(),
10  ,
uncompressActiveTiles  ,
UT_VoxelArrayI ,
closept  ,
UT_VoxelArrayI ,
newclosept  ,
UT_VoxelArrayF ,
dest  ,
const UT_ValArray< bool > &  ,
tileoccupied   
)
protected
SIM_RawIndexField::THREADED_METHOD4 ( SIM_RawIndexField  ,
elements.  entries(),
100  ,
applyExtrapolatedParticleToField  ,
const UT_ValArray< sim_extrapelem > &  ,
elements  ,
const GU_Detail ,
gdp  ,
SIM_RawField ,
dest  ,
const SIM_RawField::sim_particleToFieldParms ,
ptfparms   
)
protected
void SIM_RawIndexField::uncompressActiveTilesPartial ( UT_VoxelArrayI closept,
UT_VoxelArrayI newclosept,
UT_VoxelArrayF dest,
const UT_ValArray< bool > &  tileoccupied,
const UT_JobInfo info 
)
protected

Member Data Documentation

const UT_JobInfo& SIM_RawIndexField::info

Definition at line 166 of file SIM_RawIndexField.h.

UT_Vector3 SIM_RawIndexField::myBBoxOrig
protected

Definition at line 263 of file SIM_RawIndexField.h.

UT_Vector3 SIM_RawIndexField::myBBoxSize
protected

Definition at line 263 of file SIM_RawIndexField.h.

UT_VoxelArrayI* SIM_RawIndexField::myField
protected

Definition at line 254 of file SIM_RawIndexField.h.

exint SIM_RawIndexField::myMaxIndex
protected

Definition at line 256 of file SIM_RawIndexField.h.

UT_Vector3 SIM_RawIndexField::myOrig
protected

Definition at line 260 of file SIM_RawIndexField.h.

SIM_FieldSample SIM_RawIndexField::mySample
protected

Definition at line 255 of file SIM_RawIndexField.h.

UT_Vector3 SIM_RawIndexField::mySize
protected

Definition at line 260 of file SIM_RawIndexField.h.

fpreal SIM_RawIndexField::myVoxelDiameter
protected

Definition at line 267 of file SIM_RawIndexField.h.

UT_Vector3 SIM_RawIndexField::myVoxelSize
protected

Definition at line 266 of file SIM_RawIndexField.h.


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