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

A list of primitives. More...

#include <GA_PrimitiveList.h>

Public Member Functions

 GA_PrimitiveList (GA_Detail &detail)
 
SYS_FORCE_INLINE ~GA_PrimitiveList ()
 
SYS_FORCE_INLINE const
GA_Primitive
get (GA_Offset off) const
 
SYS_FORCE_INLINE GA_Primitiveget (GA_Offset off)
 
SYS_FORCE_INLINE GA_OffsetListRef getVertexList (GA_Offset primoff) const
 
SYS_FORCE_INLINE GA_Size getVertexCount (GA_Offset primoff) const
 
SYS_FORCE_INLINE GA_Offset getVertexOffset (GA_Offset primoff, GA_Size i) const
 
SYS_FORCE_INLINE int getTypeId (GA_Offset primoff) const
 
SYS_FORCE_INLINE bool getClosedFlag (GA_Offset primoff) const
 
SYS_FORCE_INLINE void setClosedFlag (GA_Offset primoff, bool closed)
 
int64 getMemoryUsage (bool inclusive) const
 Report on memory usage. More...
 
void countMemory (UT_MemoryCounter &counter, bool inclusive) const
 
GA_Offset offsetSize () const
 Offset size of the list. More...
 
void adjustArraySize (GA_Offset size)
 Set capacity of primitive offsets in the list. More...
 
void clear (bool for_deletion)
 
void stashAll ()
 
void destroyStashed ()
 
bool isFullRepresentation () const
 
SYS_FORCE_INLINE bool isVertexListPageConstant (GA_PageNum pagenum) const
 Returns true iff the specified vertex list page is constant. More...
 
SYS_FORCE_INLINE GA_OffsetListRef getConstantVertexListPage (GA_PageNum pagenum) const
 
void hardenVertexListPageTable ()
 NOTE: This is not threadsafe. Also, this just hardens the table, not any pages. More...
 
void hardenAllVertexListPages ()
 NOTE: This is not threadsafe. It hardens all vertex list pages, if applicable. More...
 
GA_OffsetListhardenVertexListPage (GA_PageNum pagenum)
 
void merge (GA_Detail &dgeo, const GA_MergeMap &map)
 
void replace (GA_Detail &dstgeo, const GA_Detail &srcgeo)
 
void defragment (const GA_Defragment &defrag)
 
void defragmentVertices (const GA_Defragment &defrag)
 
void flushCEWriteCaches (const GA_PrimitiveFactory &f)
 Copy any modified caches from the GPU back to CPU cache. More...
 
void flushCECaches (const GA_PrimitiveFactory &f)
 
bool jsonSave (UT_JSONWriter &w, const GA_SaveMap &save) const
 
bool jsonLoad (UT_JSONParser &p, GA_LoadMap &load, GA_Offset &load_end)
 
bool containsType (const GA_PrimitiveTypeId &type) const
 
bool containsOnlyTypes (const UT_Array< GA_PrimitiveTypeId > &types) const
 
GA_Size countType (const GA_PrimitiveTypeId &type) const
 Return the number of primitives of the given type. More...
 
bool hasLocalTransform (const GA_PrimitiveFactory &factory) const
 
bool getPrimitivesOfType (const GA_PrimitiveTypeId &type, UT_Array< const GA_Primitive * > &prims) const
 
void bumpDataId ()
 Use this to mark primitives or their intrinsic data as dirty. More...
 
GA_DataId getDataId () const
 
const GA_PrimitiveTrackergetTracker () const
 
bool validate (const GA_Detail &detail) const
 
void getPrimitiveTypeCounts (UT_Array< std::pair< int, exint >> &type_count_pairs, const GA_Range *range=nullptr) const
 
void initVertexLists (GA_Offset prim_block_start, GA_Offset vertex_block_start, GA_Size nprimitives, GA_Size nvertices_each, bool closed=false)
 
void initVertexLists (GA_Offset prim_block_start, GA_Offset vertex_block_start, const GA_PolyCounts &vertex_counts, bool closed=false)
 
void initVertexLists (GA_Offset prim_block_start, GA_Offset vertex_block_start, const GA_PolyCounts &vertex_counts, const exint *closed_span_lengths=nullptr, const exint ncopies=1)
 
SYS_FORCE_INLINE void setVertexList (GA_Offset primoff, const GA_OffsetListRef &vertices)
 
SYS_FORCE_INLINE void setVertexList (GA_Offset primoff, const GA_OffsetList &vertices)
 
SYS_FORCE_INLINE void setVertexList (GA_Offset primoff, GA_OffsetList &&vertices)
 

Friends

class GA_Detail
 

Detailed Description

A list of primitives.

Primitives for a detail are stored in a primitive list. The list stores pointers to primitive objects. The list is ordered in the same order as the primitive attribute lists.

Examples:
tetprim/GEO_PrimTetra.h.

Definition at line 52 of file GA_PrimitiveList.h.

Constructor & Destructor Documentation

GA_PrimitiveList::GA_PrimitiveList ( GA_Detail detail)
SYS_FORCE_INLINE GA_PrimitiveList::~GA_PrimitiveList ( )
inline

Definition at line 58 of file GA_PrimitiveList.h.

Member Function Documentation

void GA_PrimitiveList::adjustArraySize ( GA_Offset  size)

Set capacity of primitive offsets in the list.

void GA_PrimitiveList::bumpDataId ( )

Use this to mark primitives or their intrinsic data as dirty.

Examples:
SOP/SOP_BouncyAgent.C, SOP/SOP_BrushHairLen.C, and SOP/SOP_NURBS.C.
void GA_PrimitiveList::clear ( bool  for_deletion)
bool GA_PrimitiveList::containsOnlyTypes ( const UT_Array< GA_PrimitiveTypeId > &  types) const
inline

Check to see whether the primitive list only contains primitives of a given type

Definition at line 260 of file GA_PrimitiveList.h.

bool GA_PrimitiveList::containsType ( const GA_PrimitiveTypeId type) const
inline

Check to see whether the primitive list contains primitives of a given type

Definition at line 256 of file GA_PrimitiveList.h.

void GA_PrimitiveList::countMemory ( UT_MemoryCounter counter,
bool  inclusive 
) const

Count memory usage using a UT_MemoryCounter in order to count shared memory correctly. If inclusive is true, the size of this object is counted, else only memory owned by this object is counted. If this is pointed to by the calling object, inclusive should be true. If this is contained in the calling object, inclusive should be false. (Its memory was already counted in the size of the calling object.)

GA_Size GA_PrimitiveList::countType ( const GA_PrimitiveTypeId type) const
inline

Return the number of primitives of the given type.

Definition at line 263 of file GA_PrimitiveList.h.

void GA_PrimitiveList::defragment ( const GA_Defragment defrag)

Called by GA_Detail::defragment when defragmenting the primitive index map. NOTE: This bumps the primitive list data ID.

void GA_PrimitiveList::defragmentVertices ( const GA_Defragment defrag)

Called by GA_Detail::defragment when defragmenting the vertex index map. NOTE: This bumps the primitive list data ID.

void GA_PrimitiveList::destroyStashed ( )
void GA_PrimitiveList::flushCECaches ( const GA_PrimitiveFactory f)

Copy any modified caches from the GPU to CPU. Then delete the GPU cache.

void GA_PrimitiveList::flushCEWriteCaches ( const GA_PrimitiveFactory f)

Copy any modified caches from the GPU back to CPU cache.

SYS_FORCE_INLINE const GA_Primitive* GA_PrimitiveList::get ( GA_Offset  off) const
inline
SYS_FORCE_INLINE GA_Primitive* GA_PrimitiveList::get ( GA_Offset  off)
inline

Definition at line 75 of file GA_PrimitiveList.h.

SYS_FORCE_INLINE bool GA_PrimitiveList::getClosedFlag ( GA_Offset  primoff) const

Returns the "closed" flag for polygon, NURBS curve, or Bezier curve primitives, or false for other primitive types. You must include GA_Primitive.h to use this.

Definition at line 1064 of file GA_Primitive.h.

SYS_FORCE_INLINE GA_OffsetListRef GA_PrimitiveList::getConstantVertexListPage ( GA_PageNum  pagenum) const
inline

Returns the representative (first) vertex list for a "constant" page. The page must be constant-compressed, i.e. isVertexListPageConstant must return true. NOTE: "constant" in this context really means that the vertex lists all have the same vertex count, and represent contiguous vertices.

Definition at line 176 of file GA_PrimitiveList.h.

GA_DataId GA_PrimitiveList::getDataId ( ) const
inline

Definition at line 277 of file GA_PrimitiveList.h.

int64 GA_PrimitiveList::getMemoryUsage ( bool  inclusive) const

Report on memory usage.

bool GA_PrimitiveList::getPrimitivesOfType ( const GA_PrimitiveTypeId type,
UT_Array< const GA_Primitive * > &  prims 
) const

Return the primitives of the given type. Unlike the functions above which use myTracker, this function requires iterating through all primitives.

void GA_PrimitiveList::getPrimitiveTypeCounts ( UT_Array< std::pair< int, exint >> &  type_count_pairs,
const GA_Range range = nullptr 
) const

Append to a run-length encoded array of pairs of a primitive type ID and a count of those primitives. A detail with 5 polygons, followed by 3 tetrahedra, followed by 4 polygons will yield: {GA_PRIMPOLY, 5}, {GA_PRIMTETRAHEDRON, 3}, {GA_PRIMPOLY, 4}

const GA_PrimitiveTracker& GA_PrimitiveList::getTracker ( ) const
inline

Definition at line 280 of file GA_PrimitiveList.h.

SYS_FORCE_INLINE int GA_PrimitiveList::getTypeId ( GA_Offset  primoff) const

Returns the type ID of the primitive at the specified primitive offset. You must include GA_Primitive.h to use this.

Definition at line 1047 of file GA_Primitive.h.

SYS_FORCE_INLINE GA_Size GA_PrimitiveList::getVertexCount ( GA_Offset  primoff) const

Returns the number of vertices in the primitive at the specified primitive offset. You must include GA_Primitive.h to use this.

Definition at line 998 of file GA_Primitive.h.

SYS_FORCE_INLINE GA_OffsetListRef GA_PrimitiveList::getVertexList ( GA_Offset  primoff) const

Returns a shallow copy of the vertex list of the primitive at the specified primitive offset. You must include GA_Primitive.h to use this.

Definition at line 902 of file GA_Primitive.h.

SYS_FORCE_INLINE GA_Offset GA_PrimitiveList::getVertexOffset ( GA_Offset  primoff,
GA_Size  i 
) const

Returns the vertex offset in the primitive at the specified primitive offset in vertex list position i. If you're accessing all vertex offsets, it'll be faster to call getVertexList() once and either read from that or call forEach(fucntor) on it. You must include GA_Primitive.h to use this.

Definition at line 1022 of file GA_Primitive.h.

void GA_PrimitiveList::hardenAllVertexListPages ( )

NOTE: This is not threadsafe. It hardens all vertex list pages, if applicable.

GA_OffsetList* GA_PrimitiveList::hardenVertexListPage ( GA_PageNum  pagenum)

NOTE: This will only work if !isFullRepresentation() NOTE: This is safe to call from multiple threads as long as pagenum is different for each and hardenVertexListPageTable() has been called outside threaded code.

void GA_PrimitiveList::hardenVertexListPageTable ( )
inline

NOTE: This is not threadsafe. Also, this just hardens the table, not any pages.

Definition at line 199 of file GA_PrimitiveList.h.

bool GA_PrimitiveList::hasLocalTransform ( const GA_PrimitiveFactory factory) const
inline

Test whether the primitive list contains any primitives that have a local transform.

Definition at line 267 of file GA_PrimitiveList.h.

void GA_PrimitiveList::initVertexLists ( GA_Offset  prim_block_start,
GA_Offset  vertex_block_start,
GA_Size  nprimitives,
GA_Size  nvertices_each,
bool  closed = false 
)
void GA_PrimitiveList::initVertexLists ( GA_Offset  prim_block_start,
GA_Offset  vertex_block_start,
const GA_PolyCounts vertex_counts,
bool  closed = false 
)
void GA_PrimitiveList::initVertexLists ( GA_Offset  prim_block_start,
GA_Offset  vertex_block_start,
const GA_PolyCounts vertex_counts,
const exint closed_span_lengths = nullptr,
const exint  ncopies = 1 
)

First value of closed_span_lengths is the number with closed false. To start with closed true, have a value of 0 first, then the number with closed true. nullptr means closed false for all primitives.

bool GA_PrimitiveList::isFullRepresentation ( ) const
inline

Returns true iff the primitive list representation is as separate allocations for each primitive, instead of using the paged array format.

Definition at line 158 of file GA_PrimitiveList.h.

SYS_FORCE_INLINE bool GA_PrimitiveList::isVertexListPageConstant ( GA_PageNum  pagenum) const
inline

Returns true iff the specified vertex list page is constant.

Definition at line 165 of file GA_PrimitiveList.h.

bool GA_PrimitiveList::jsonLoad ( UT_JSONParser p,
GA_LoadMap load,
GA_Offset load_end 
)

Load from a JSON stream

See Also
JSON_FileFormat
bool GA_PrimitiveList::jsonSave ( UT_JSONWriter w,
const GA_SaveMap save 
) const

Save data to a JSON stream.

JSON Schema: GA_PrimitiveList

{
"name" : "GA_PrimitiveList",
"description" : "An array of primitive objects",
"type" : "array",
"items" : { "$ref":"GA_Primitive" },
}
See Also
JSON_FileFormat, GA_Primitive
void GA_PrimitiveList::merge ( GA_Detail dgeo,
const GA_MergeMap map 
)
GA_Offset GA_PrimitiveList::offsetSize ( ) const
inline

Offset size of the list.

Definition at line 139 of file GA_PrimitiveList.h.

void GA_PrimitiveList::replace ( GA_Detail dstgeo,
const GA_Detail srcgeo 
)

NOTE: Since the primitive maps of dstgeo and srcgeo must have already been made equal by the time this is called.

SYS_FORCE_INLINE void GA_PrimitiveList::setClosedFlag ( GA_Offset  primoff,
bool  closed 
)

Sets the "closed" flag for polygon primitives. For NURBS curve or Bezier curve primitives, use GEO_Face::close() or GEO_Face::open(). You must include GA_Primitive.h to use this.

Definition at line 1088 of file GA_Primitive.h.

SYS_FORCE_INLINE void GA_PrimitiveList::setVertexList ( GA_Offset  primoff,
const GA_OffsetListRef vertices 
)

NOTE: This is safe to call from multiple threads as long as they aren't writing to the same page, and hardenVertexListPageTable() has been called from single-threaded code. You must include GA_Primitive.h to use this.

Definition at line 932 of file GA_Primitive.h.

SYS_FORCE_INLINE void GA_PrimitiveList::setVertexList ( GA_Offset  primoff,
const GA_OffsetList vertices 
)

NOTE: This is safe to call from multiple threads as long as they aren't writing to the same page, and hardenVertexListPageTable() has been called from single-threaded code. You must include GA_Primitive.h to use this.

Definition at line 956 of file GA_Primitive.h.

SYS_FORCE_INLINE void GA_PrimitiveList::setVertexList ( GA_Offset  primoff,
GA_OffsetList &&  vertices 
)

NOTE: This is safe to call from multiple threads as long as they aren't writing to the same page, and hardenVertexListPageTable() has been called from single-threaded code. You must include GA_Primitive.h to use this.

Definition at line 977 of file GA_Primitive.h.

void GA_PrimitiveList::stashAll ( )
bool GA_PrimitiveList::validate ( const GA_Detail detail) const

Goes through the primitive list to confirm that it's in a consistent state, returning true if it is, and false if it isn't. This is only for debugging purposes.

Friends And Related Function Documentation

friend class GA_Detail
friend

Definition at line 397 of file GA_PrimitiveList.h.


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