GEO_PrimParticle Class Reference

#include <GEO_PrimPart.h>

Inheritance diagram for GEO_PrimParticle:

GEO_Primitive GA_Primitive GU_PrimParticle

List of all members.

Public Member Functions

 GEO_PrimParticle (GEO_Detail *d, GA_Offset offset=GA_INVALID_OFFSET)
 ~GEO_PrimParticle ()
virtual int64 getMemoryUsage () const
 Report approximate memory usage.
virtual bool saveH9 (ostream &os, bool binary, const UT_RefArray< GA_AttribSaveDataH9 > &prim_attribs, const UT_RefArray< GA_AttribSaveDataH9 > &vtx_attribs) const
virtual bool loadH9 (UT_IStream &is, const UT_RefArray< GA_AttribLoadDataH9 > &prim_attribs, const UT_RefArray< GA_AttribLoadDataH9 > &vtx_attribs)
virtual int getBBox (UT_BoundingBox *bbox) const
virtual void addToBSphere (UT_BoundingSphere *bsphere) const
virtual bool enlargeBoundingSphere (UT_BoundingSphere &b, const GA_Attribute *P) const
virtual UT_Vector3 computeNormal () const
 Return a normal vector for the primitive.
virtual UT_Vector3 baryCenter () const
virtual void reverse ()
 Reverse the order of vertices.
virtual void copyPrimitive (const GEO_Primitive *src, GEO_Point **ptredirect)
virtual GEO_Primitivecopy (int preserve_shared_pts=0) const
virtual void copyUnwiredForMerge (const GA_Primitive *src, const GA_MergeMap &map)
virtual bool isDegenerate () const
 Is the primitive degenerate.
virtual void addPointRefToGroup (GA_PointGroup &grp) const
virtual int detachPoints (GA_PointGroup &grp)
virtual GA_DereferenceStatus dereferencePoint (GA_Offset point, bool dry_run=false)
virtual GA_DereferenceStatus dereferencePoints (const GA_RangeMemberQuery &pt_q, bool dry_run=false)
int getPointBBox (UT_BoundingBox &bbox) const
GA_Offset appendParticle (GEO_Point *pt)
 Append a new particle.
GA_Offset appendParticle (GA_Offset pt)
void deleteParticle (const GEO_Point *pt)
void deleteParticle (GA_Offset vtxoff)
GA_Offset giveBirth ()
 Resurrect a particle or give birth to a new one.
void deadParticle (GEO_ParticleVertexIndex vtxindex)
void deleteDead ()
 Delete all dead particles.
int getNumParticles () const
 Returns the number of live particles.
virtual int vertexApply (int(*apply)(GEO_Vertex vtx, void *), void *data=0)
virtual int vertexApply (int(*apply)(const GEO_Vertex &vtx, void *), void *data=0) const
virtual GA_Size getVertexCount () const
virtual GA_Offset getVertexOffset (GA_Size index) const
void setVertexPoint (unsigned int i, GA_Offset pt)
virtual void beginVertex (const_iterator &i) const
virtual void nextVertex (const_iterator &i) const
void clearAndDestroy ()
virtual void stashed (int onoff, GA_Offset offset=GA_INVALID_OFFSET)
virtual const GA_PrimitiveJSONgetJSON () const
GA_Offset vertexPoint (GA_Size i) const
const GA_OffsetListgetVertexList () const
bool saveVertexArray (UT_JSONWriter &w, const GA_SaveMap &map) const
bool loadVertexArray (UT_JSONParser &p, const GA_LoadMap &map)
bool saveRenderProperties (UT_JSONWriter &w, const GA_SaveMap &map) const
bool saveRenderProperties (UT_JSONValue &v, const GA_SaveMap &map) const
bool loadRenderProperties (UT_JSONParser &p, const GA_LoadMap &map)
bool loadRenderProperties (UT_JSONParser &p, const UT_JSONValue &v, const GA_LoadMap &map)
bool areRenderPropertiesEqual (const GEO_PrimParticle &src) const
virtual bool enlargeBoundingBox (UT_BoundingRect &b, const GA_Attribute *P) const
virtual bool enlargeBoundingBox (UT_BoundingBox &b, const GA_Attribute *P) const
GEO_PartRendergetRenderAttribs ()
const GEO_PartRendergetRenderAttribs () const

Protected Member Functions

virtual void clearForDeletion ()
virtual void copyOffsetPrimitive (const GEO_Primitive *src, int basept)
virtual int isPointUsed (GA_GBPoint *pt) const
virtual void swapVertexOffsets (const GA_Defragment &defrag)
 Defragmentation.
void setSize (GA_Size sz)
 Resize our vertex array.
virtual bool evaluatePointRefMap (GA_Offset result_vtx, GA_AttributeRefMap &hlist, fpreal u, fpreal v, unsigned du, unsigned dv) const
virtual int evaluatePointV4 (UT_Vector4 &pos, float u_unit, float=0, unsigned du=0, unsigned=0) const
virtual bool evaluateBaryCenterRefMap (GA_Offset result_vertex, GA_AttributeRefMap &hlist) const
virtual int localIntrinsicTupleSize (const GA_IntrinsicEval &eval) const
virtual int localGetIntrinsicS (const GA_IntrinsicEval &eval, UT_String &value) const
virtual int localGetIntrinsicSA (const GA_IntrinsicEval &eval, UT_StringArray &value) const
virtual int localGetIntrinsicI (const GA_IntrinsicEval &eval, int64 *value, GA_Size size) const
virtual int localGetIntrinsicF (const GA_IntrinsicEval &eval, fpreal *value, GA_Size size) const
virtual int localSetIntrinsicSA (const GA_IntrinsicEval &eval, const UT_StringArray &value)
virtual int localSetIntrinsicSS (const GA_IntrinsicEval &eval, const char **value, GA_Size size)
virtual int localSetIntrinsicI (const GA_IntrinsicEval &eval, const int64 *value, GA_Size size)
virtual int localSetIntrinsicF (const GA_IntrinsicEval &eval, const fpreal *value, GA_Size size)

Static Protected Member Functions

static GA_PrimitiveFamilyMask buildFamilyMask ()
static
GA_IntrinsicManager::Registrar 
registerIntrinsics (GA_PrimitiveDefinition &defn)

Friends

ostream & operator<< (ostream &os, const GEO_PrimParticle &d)


Detailed Description

A GEO_PrimParticle represents a particle system, though a simulation may consist of more than a single primitive. Each particle in the system is a vertex in the primitive.
Examples:

POP/POP_CircleForce.C, POP/POP_LocalForce.C, POP/POP_RadialBirth.C, POP/POP_SpotLight.C, SOP/SOP_SParticle.C, and SOP/SOP_SParticle.h.

Definition at line 64 of file GEO_PrimPart.h.


Constructor & Destructor Documentation

GEO_PrimParticle::GEO_PrimParticle ( GEO_Detail d,
GA_Offset  offset = GA_INVALID_OFFSET 
)

GEO_PrimParticle::~GEO_PrimParticle (  ) 


Member Function Documentation

virtual void GEO_PrimParticle::addPointRefToGroup ( GA_PointGroup grp  )  const [virtual]

Add all points referenced by the primitive to the given group. This defaults to iterating over the vertices and adding their referenced points.

Reimplemented from GEO_Primitive.

virtual void GEO_PrimParticle::addToBSphere ( UT_BoundingSphere bsphere  )  const [virtual]

Enlarge the bounding sphere with the primitive's bounds. By default, this will enlarge the bounding sphere by the primitive's bounding box (i.e. getBBox()). It may be possible to have a tighter bound (i.e. the vertex hull for many primitives is a much better metric).

Reimplemented from GEO_Primitive.

GA_Offset GEO_PrimParticle::appendParticle ( GA_Offset  pt  ) 

GA_Offset GEO_PrimParticle::appendParticle ( GEO_Point pt  ) 

Append a new particle.

See also:
giveBirth()
Examples:
SIM/SNOW_Solver.C.

bool GEO_PrimParticle::areRenderPropertiesEqual ( const GEO_PrimParticle src  )  const

Save/load render properties to a JSON stream

virtual UT_Vector3 GEO_PrimParticle::baryCenter (  )  const [virtual]

Return the center of the primitive. This defaults to the center of the bounding box. A better approximation might be the average value of the vertex positions (which could be different).

Reimplemented from GEO_Primitive.

virtual void GEO_PrimParticle::beginVertex ( const_iterator i  )  const [virtual]

Virtual methods for implementing const_iterator traversal. A default implementation using getVertexCount()/getVertexOffset() is provided. Override both beginVertex() and nextVertex() when customizing, though the default copyIterator() implementation will probably suffice when the iterator implementation does not set a pointer release function.

Reimplemented from GA_Primitive.

static GA_PrimitiveFamilyMask GEO_PrimParticle::buildFamilyMask (  )  [inline, static, protected]

Definition at line 229 of file GEO_PrimPart.h.

void GEO_PrimParticle::clearAndDestroy ( void   )  [inline]

Examples:
SOP/SOP_SParticle.C.

Definition at line 210 of file GEO_PrimPart.h.

virtual void GEO_PrimParticle::clearForDeletion (  )  [protected, virtual]

Reimplemented from GA_Primitive.

virtual UT_Vector3 GEO_PrimParticle::computeNormal (  )  const [virtual]

Return a normal vector for the primitive.

Implements GEO_Primitive.

virtual GEO_Primitive* GEO_PrimParticle::copy ( int  preserve_shared_pts = 0  )  const [virtual]

Reimplemented from GEO_Primitive.

virtual void GEO_PrimParticle::copyOffsetPrimitive ( const GEO_Primitive src,
int  basept 
) [protected, virtual]

Implements GEO_Primitive.

virtual void GEO_PrimParticle::copyPrimitive ( const GEO_Primitive src,
GEO_Point **  ptredirect 
) [virtual]

Implements GEO_Primitive.

virtual void GEO_PrimParticle::copyUnwiredForMerge ( const GA_Primitive src,
const GA_MergeMap map 
) [virtual]

Copy the specified primitive as part of the merge. The source primitive will be of the same type.

Since the vertex offsets will change for the merged geometry, the map should be used to lookup the new vertex offsets. For example

    map.mapDestFromSource( GA_ATTRIB_VERTEX, source_vertex );

See also:
GA_MergeMap

Implements GA_Primitive.

void GEO_PrimParticle::deadParticle ( GEO_ParticleVertexIndex  vtxindex  ) 

Move the specified particle to the dead list.

Precondition:
vtx belongs to this particle primitive Does not actually remove from our vertex list! This builds a list of all vertices that should be deleted so deleteDead() can do a single pass over them. vtxindex is the index into our vertex list, not a vertex offset.
Examples:
SOP/SOP_SParticle.C.

void GEO_PrimParticle::deleteDead (  ) 

Delete all dead particles.

Examples:
SOP/SOP_SParticle.C.

void GEO_PrimParticle::deleteParticle ( GA_Offset  vtxoff  ) 

Delete the specified particle.

Precondition:
vtx belongs to this particle primitive and is not currently on the dead list.
See also:
deadParticle()

void GEO_PrimParticle::deleteParticle ( const GEO_Point pt  ) 

Delete all particles not on the dead list that reference the supplied point.

virtual GA_DereferenceStatus GEO_PrimParticle::dereferencePoint ( GA_Offset  point,
bool  dry_run = false 
) [virtual]

Before a point is deleted, all primitives using the point will be notified. The method should return "false" if it's impossible to delete the point. Otherwise, the vertices should be removed.

Implements GA_Primitive.

virtual GA_DereferenceStatus GEO_PrimParticle::dereferencePoints ( const GA_RangeMemberQuery pt_q,
bool  dry_run = false 
) [virtual]

Implements GA_Primitive.

virtual int GEO_PrimParticle::detachPoints ( GA_PointGroup grp  )  [virtual]

Implements GEO_Primitive.

virtual bool GEO_PrimParticle::enlargeBoundingBox ( UT_BoundingBox b,
const GA_Attribute P 
) const [virtual]

Enlarge a bounding box by the bounding box of the primitive. A return value of false indicates an error in the operation, most likely an invalid P. Unlike getBBox(), velocity is ignored.

Reimplemented from GEO_Primitive.

virtual bool GEO_PrimParticle::enlargeBoundingBox ( UT_BoundingRect b,
const GA_Attribute P 
) const [virtual]

Enlarge a bounding box by the bounding box of the primitive. A return value of false indicates an error in the operation, most likely an invalid P. Unlike getBBox(), velocity is ignored.

Reimplemented from GEO_Primitive.

virtual bool GEO_PrimParticle::enlargeBoundingSphere ( UT_BoundingSphere b,
const GA_Attribute P 
) const [virtual]

Enlarge a bounding sphere to encompass the primitive. A return value of false indicates an error in the operation, most likely an invalid P. Unlike getBBox(), velocity is ignored.

Reimplemented from GA_Primitive.

virtual bool GEO_PrimParticle::evaluateBaryCenterRefMap ( GA_Offset  result,
GA_AttributeRefMap map 
) const [protected, virtual]

By default, this will call evaluateInteriorPointRefMap with u=.5 and v=.5. This is likely not the perfect solution. At the current time, this is only used in POPs to birth points at primitive centers.

Reimplemented from GEO_Primitive.

virtual bool GEO_PrimParticle::evaluatePointRefMap ( GA_Offset  result_vtx,
GA_AttributeRefMap hlist,
fpreal  u,
fpreal  v,
unsigned  du,
unsigned  dv 
) const [protected, virtual]

virtual int GEO_PrimParticle::evaluatePointV4 ( UT_Vector4 pos,
float  u,
float  v = 0,
unsigned  du = 0,
unsigned  dv = 0 
) const [protected, virtual]

Evaluate the position for the given parametric coordinates (with the given derivatives). Return 0 if successful, or -1 if failure. The default implementation returns {0,0,0,0};

Reimplemented from GEO_Primitive.

virtual int GEO_PrimParticle::getBBox ( UT_BoundingBox bbox  )  const [virtual]

Compute the bounding box of the primitive. Return 0 if unable to compute bounds (1 on successful computation)

Implements GEO_Primitive.

virtual const GA_PrimitiveJSON* GEO_PrimParticle::getJSON (  )  const [virtual]

This method returns the JSON interface for saving/loading the primitive If the method returns a NULL pointer, then the primitive will not be saved to geometry files (and thus cannot be loaded).

Implements GA_Primitive.

virtual int64 GEO_PrimParticle::getMemoryUsage (  )  const [virtual]

Report approximate memory usage.

Implements GA_Primitive.

int GEO_PrimParticle::getNumParticles (  )  const [inline]

Returns the number of live particles.

Examples:
SOP/SOP_SParticle.C.

Definition at line 185 of file GEO_PrimPart.h.

int GEO_PrimParticle::getPointBBox ( UT_BoundingBox bbox  )  const

const GEO_PartRender& GEO_PrimParticle::getRenderAttribs (  )  const [inline]

Retrieve the object specifying how this particle system should be rendered.

Definition at line 154 of file GEO_PrimPart.h.

GEO_PartRender& GEO_PrimParticle::getRenderAttribs (  )  [inline]

Retrieve the object specifying how this particle system should be rendered.

Definition at line 153 of file GEO_PrimPart.h.

virtual GA_Size GEO_PrimParticle::getVertexCount (  )  const [virtual]

Note:
getVertexCount() includes dead particles.

Implements GA_Primitive.

const GA_OffsetList& GEO_PrimParticle::getVertexList (  )  const [inline]

Definition at line 223 of file GEO_PrimPart.h.

virtual GA_Offset GEO_PrimParticle::getVertexOffset ( GA_Size  index  )  const [virtual]

Warning:
Traverses the linked list of vertices.

Implements GA_Primitive.

GA_Offset GEO_PrimParticle::giveBirth (  ) 

Resurrect a particle or give birth to a new one.

Examples:
SOP/SOP_SParticle.C.

virtual bool GEO_PrimParticle::isDegenerate (  )  const [virtual]

Is the primitive degenerate.

Implements GA_Primitive.

virtual int GEO_PrimParticle::isPointUsed ( GA_GBPoint *  pt  )  const [protected, virtual]

virtual bool GEO_PrimParticle::loadH9 ( UT_IStream is,
const UT_RefArray< GA_AttribLoadDataH9 > &  prim_attribs,
const UT_RefArray< GA_AttribLoadDataH9 > &  vtx_attribs 
) [virtual]

Reimplemented from GA_Primitive.

bool GEO_PrimParticle::loadRenderProperties ( UT_JSONParser p,
const UT_JSONValue v,
const GA_LoadMap map 
)

Save/load render properties to a JSON stream

bool GEO_PrimParticle::loadRenderProperties ( UT_JSONParser p,
const GA_LoadMap map 
)

Save/load render properties to a JSON stream

bool GEO_PrimParticle::loadVertexArray ( UT_JSONParser p,
const GA_LoadMap map 
)

Save/Load vertex list to a JSON stream

virtual int GEO_PrimParticle::localGetIntrinsicF ( const GA_IntrinsicEval eval,
fpreal value,
GA_Size  size 
) const [protected, virtual]

Virtual implementation of intrinsic attributes. See GA_IntrinsicEval for further details.

Reimplemented from GA_Primitive.

virtual int GEO_PrimParticle::localGetIntrinsicI ( const GA_IntrinsicEval eval,
int64 value,
GA_Size  size 
) const [protected, virtual]

Virtual implementation of intrinsic attributes. See GA_IntrinsicEval for further details.

Reimplemented from GA_Primitive.

virtual int GEO_PrimParticle::localGetIntrinsicS ( const GA_IntrinsicEval eval,
UT_String value 
) const [protected, virtual]

Virtual implementation of intrinsic attributes. See GA_IntrinsicEval for further details.

Reimplemented from GA_Primitive.

virtual int GEO_PrimParticle::localGetIntrinsicSA ( const GA_IntrinsicEval eval,
UT_StringArray value 
) const [protected, virtual]

Virtual implementation of intrinsic attributes. See GA_IntrinsicEval for further details.

Reimplemented from GA_Primitive.

virtual int GEO_PrimParticle::localIntrinsicTupleSize ( const GA_IntrinsicEval eval  )  const [protected, virtual]

Virtual implementation of intrinsic attributes. See GA_IntrinsicEval for further details.

Reimplemented from GA_Primitive.

virtual int GEO_PrimParticle::localSetIntrinsicF ( const GA_IntrinsicEval eval,
const fpreal value,
GA_Size  size 
) [protected, virtual]

Virtual implementation of intrinsic attributes. See GA_IntrinsicEval for further details.

Reimplemented from GA_Primitive.

virtual int GEO_PrimParticle::localSetIntrinsicI ( const GA_IntrinsicEval eval,
const int64 value,
GA_Size  size 
) [protected, virtual]

Virtual implementation of intrinsic attributes. See GA_IntrinsicEval for further details.

Reimplemented from GA_Primitive.

virtual int GEO_PrimParticle::localSetIntrinsicSA ( const GA_IntrinsicEval eval,
const UT_StringArray value 
) [protected, virtual]

Virtual implementation of intrinsic attributes. See GA_IntrinsicEval for further details.

Reimplemented from GA_Primitive.

virtual int GEO_PrimParticle::localSetIntrinsicSS ( const GA_IntrinsicEval eval,
const char **  value,
GA_Size  size 
) [protected, virtual]

Virtual implementation of intrinsic attributes. See GA_IntrinsicEval for further details.

Reimplemented from GA_Primitive.

virtual void GEO_PrimParticle::nextVertex ( const_iterator i  )  const [virtual]

Virtual methods for implementing const_iterator traversal. A default implementation using getVertexCount()/getVertexOffset() is provided. Override both beginVertex() and nextVertex() when customizing, though the default copyIterator() implementation will probably suffice when the iterator implementation does not set a pointer release function.

Reimplemented from GA_Primitive.

static GA_IntrinsicManager::Registrar GEO_PrimParticle::registerIntrinsics ( GA_PrimitiveDefinition defn  )  [static, protected]

All subclasses should call this method to register the curve intrinsics.

See also:
GA_IntrinsicManager

Reimplemented from GEO_Primitive.

virtual void GEO_PrimParticle::reverse (  )  [virtual]

Reverse the order of vertices.

Implements GEO_Primitive.

virtual bool GEO_PrimParticle::saveH9 ( ostream &  os,
bool  binary,
const UT_RefArray< GA_AttribSaveDataH9 > &  prim_attribs,
const UT_RefArray< GA_AttribSaveDataH9 > &  vtx_attribs 
) const [virtual]

Reimplemented from GA_Primitive.

bool GEO_PrimParticle::saveRenderProperties ( UT_JSONValue v,
const GA_SaveMap map 
) const

Save/load render properties to a JSON stream

bool GEO_PrimParticle::saveRenderProperties ( UT_JSONWriter w,
const GA_SaveMap map 
) const

Save/load render properties to a JSON stream

bool GEO_PrimParticle::saveVertexArray ( UT_JSONWriter w,
const GA_SaveMap map 
) const

Save/Load vertex list to a JSON stream

void GEO_PrimParticle::setSize ( GA_Size  sz  )  [protected]

Resize our vertex array.

void GEO_PrimParticle::setVertexPoint ( unsigned int  i,
GA_Offset  pt 
) [inline]

Definition at line 201 of file GEO_PrimPart.h.

virtual void GEO_PrimParticle::stashed ( int  onoff,
GA_Offset  offset = GA_INVALID_OFFSET 
) [virtual]

Stash (deactivate) or unstash (reactivate) the primitive.

Stashing a primitive will set its offset to that specified, typically GA_INVALID_OFFSET. Primitives are only stashed as part of clearing a detail, so there is no need to explicitly deallocate vertices. It is safe to delete a stashed primitive.

Unstashing a primitive will re-register that primitive with its parent detail at the specified offset (or a new offset if GA_INVALID_OFFSET).

Reimplemented from GEO_Primitive.

virtual void GEO_PrimParticle::swapVertexOffsets ( const GA_Defragment defrag  )  [protected, virtual]

Defragmentation.

Implements GA_Primitive.

virtual int GEO_PrimParticle::vertexApply ( int(*)(const GEO_Vertex &vtx, void *)  apply,
void *  data = 0 
) const [virtual]

Reimplemented from GEO_Primitive.

virtual int GEO_PrimParticle::vertexApply ( int(*)(GEO_Vertex vtx, void *)  apply,
void *  data = 0 
) [virtual]

Reimplemented from GEO_Primitive.

GA_Offset GEO_PrimParticle::vertexPoint ( GA_Size  i  )  const [inline]

Warning:
vertexPoint() doesn't check the bounds. Use with caution.
Examples:
SOP/SOP_SParticle.C.

Definition at line 220 of file GEO_PrimPart.h.


Friends And Related Function Documentation

ostream& operator<< ( ostream &  os,
const GEO_PrimParticle d 
) [friend]

Definition at line 296 of file GEO_PrimPart.h.


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

Generated on Thu Jan 31 00:31:11 2013 for HDK by  doxygen 1.5.9