HDK
|
#include <GA_Topology.h>
Classes | |
class | ga_StorageSwitch |
Static Public Member Functions | |
static int | computeStorageDownShift (int storage_level, GA_Size size) |
static int | computeStorageUpShift (int storage_level, GA_Size size) |
static GA_Storage | getStorage (int level) |
static TopologyCE | nameToTopologyCE (const char *name) |
static const char * | topologyCEToName (TopologyCE topotype) |
Definition at line 31 of file GA_Topology.h.
Definition at line 391 of file GA_Topology.h.
GA_Topology::GA_Topology | ( | GA_Detail & | detail | ) |
GA_Topology::~GA_Topology | ( | ) |
Definition at line 160 of file GA_Topology.h.
Functions to maintain topological information.
Definition at line 158 of file GA_Topology.h.
bool GA_Topology::checkStorageChange | ( | ) |
The topology attributes try to store minimal amounts of information. That is, if there are only 4 points in the geometry, we won't store the indices as 64-bit integers. This method will change the storage attributes if needed.
void GA_Topology::cloneDataId | ( | const GA_Topology & | src, |
bool | allow_clear = false |
||
) |
Call GA_Attribute::cloneDataId on all the attributes we hold.
Definition at line 72 of file GA_Topology.h.
Definition at line 86 of file GA_Topology.h.
void GA_Topology::countMemory | ( | UT_MemoryCounter & | counter, |
bool | inclusive | ||
) | const |
This counts memory using the given UT_MemoryCounter. NOTE: GA_Topology doesn't own any of the memory it points to, so there's not much to count.
void GA_Topology::createHedgeTopologyLinks | ( | ) |
Creates hedge topology attributes and computes them for the existing detail.
void GA_Topology::defragmentElements | ( | const GA_Defragment & | defrag | ) |
Called by GA_Detail::defragment when defragmenting offset lists
NOTE: defragmentLinks will bump the data ID of myPointRef, myVertexRef, or myPrimitiveRef if any of those are modified, because they are modified when defragmenting an index map that is different from their owner, i.e. their link owner's index map. defragmentElements does NOT bump any data IDs.
void GA_Topology::defragmentLinks | ( | const GA_Defragment & | defrag | ) |
Called by GA_Detail::defragment when defragmenting offset lists
NOTE: defragmentLinks will bump the data ID of myPointRef, myVertexRef, or myPrimitiveRef if any of those are modified, because they are modified when defragmenting an index map that is different from their owner, i.e. their link owner's index map. defragmentElements does NOT bump any data IDs.
void GA_Topology::destroyHedgeTopologyLinks | ( | ) |
Destroys the hedge topology attributes.
void GA_Topology::flushCECaches | ( | ) |
Remove all CE Caches, copying back any marked as written to.
void GA_Topology::flushCEWriteCaches | ( | bool | clearwriteback = true | ) |
Any CE cache which was marked as written to will be copied back to the CPU. It will be left on the GPU, however.
void GA_Topology::getAdjacentBoundaryVertices | ( | GA_Offset | vtx, |
GA_Offset & | prev_vtx, | ||
GA_Offset & | next_vtx | ||
) | const |
Returns the next and previous boundary vertices of a given vertex in its primitive.
vtx | input vertex |
prev_vtx | reference into which previous boundary vertex of vtx will be written |
next_vtx | reference into which next boundary vertex of vtx will be written |
GA_DataId GA_Topology::getDataId | ( | ) | const |
Return the data ID for the topology attributes.
|
inline |
Definition at line 221 of file GA_Topology.h.
|
inline |
Definition at line 231 of file GA_Topology.h.
|
inline |
Definition at line 223 of file GA_Topology.h.
|
inline |
Definition at line 233 of file GA_Topology.h.
|
inlinestatic |
Definition at line 100 of file GA_Topology.h.
|
inline |
Returns the current storage level as an int. Call GA_Topology::getStorage(topology.getStorageLevel()) to get the GA_Storage.
Definition at line 385 of file GA_Topology.h.
|
inline |
Definition at line 229 of file GA_Topology.h.
|
inline |
Definition at line 239 of file GA_Topology.h.
|
inline |
Definition at line 227 of file GA_Topology.h.
|
inline |
Definition at line 237 of file GA_Topology.h.
|
inline |
Definition at line 225 of file GA_Topology.h.
|
inline |
Definition at line 235 of file GA_Topology.h.
bool GA_Topology::hasPendingCEWriteBack | ( | ) | const |
The topology data may be on the GPU. This also includes some meta-topology info such as prim->points. Note topology is in index space on the GPU, not offset, so we always have a non tirival mapping.
Currently writing isn't supported. Gets a named topology attribute, verifying it was cached with a matching data id. If not, flushes any cache and returns null.
Returns the next hedge in the equivalence class of the given hedge.
Definition at line 348 of file GA_Topology.h.
Returns the previous hedge in the equivalence class of the given hedge.
The equivalence class of a hedge consists of all hedges whose two endpoints coincide with those of the hedge in question (although they may be reversely paired). By endpoints of a hedge we mean the two points into which the tail and head vertex of a hedge are respectively wired.
Definition at line 343 of file GA_Topology.h.
returns the primary hedge in the equivalence class of a given hedge
bool GA_Topology::isFull | ( | ) | const |
Test whether all required attributes built.
|
inline |
Returns true if hedge topology is maintained
A hedge (short for half-edge) embodies the notion of an edge localised to a primitive incident to it. An edge incident to k primitives therefore leads to k distinct hedges, one belonging to each of the primitives. Unlike edges, hedges are oriented and therefore have distinct tail and head vertices. The points wired to the tail and head vertices of a hedge are respectively called its tail and head points and together make up the endpoints of the given hedge. Two hedges are called equivalent if and only if their endpoints (as sets) coincide, i.e. if and only if either they both have the same tail point and the same head point, or the head point of one is the same as the tail point of another and vice versa. Equivalence of hedges puts them into equivalence classes.
Definition at line 279 of file GA_Topology.h.
bool GA_Topology::isPointShared | ( | GA_Offset | pt | ) | const |
Test to see whether a point is used by more than one vertex.
bool GA_Topology::isPointUsed | ( | GA_Offset | pt | ) | const |
Test to see whether a point is used.
|
inline |
Returns true if the input hedge is a primary hedge.
Each equivalence class of hedges (linked into a circular linked list using myHedgePrevRef and myHedgeNextRef) must have exactly one primary hedge. All other hedges in the class are marked secondary by being added to the group mySecondaryHedges. This is an invariant maintained at all times.
Definition at line 330 of file GA_Topology.h.
bool GA_Topology::isValidHedge | ( | GA_Offset | src_vtx | ) | const |
Return true if the argument is the tail vertex of a "valid" hedge.
A hedge is valid if and only if (1) it belongs to a primitive that supports hedges and (2) the primitive returns a non-negative vertex offset for its next boundary vertex. A valid hedge is singleton if it is not linked up with any other hedges into an equivalence class. NOTE 1: The validity of a hedge has nothing to do with its vertices being wired to points. NOTE 2: All valid hedges with unwired vertices are singletons. The next and previous hedge references of an invalid hedge must be GA_INVALID_OFFSET and those of a singleton hedge must be the hedge itself. This will be how we distinguish valid hedges from invalid ones.
bool GA_Topology::jsonLoadPointRef | ( | UT_JSONParser & | p, |
const GA_LoadMap & | s | ||
) |
bool GA_Topology::jsonSavePointRef | ( | UT_JSONWriter & | w, |
const GA_SaveMap & | s | ||
) | const |
|
inline |
This method constructs the topology attributes for the detail. It should only be called by GA_Detail. Please use rebuildTopology() from other code.
Definition at line 115 of file GA_Topology.h.
|
inline |
Creates hedge topology attributes if they don't already exist
Definition at line 285 of file GA_Topology.h.
void GA_Topology::makeHedgeRef | ( | ) |
Creates the hedge topology attributes
void GA_Topology::makeMinimal | ( | ) |
makeMinimal() deletes the non-essential topology attributes. All optional attributes (the options which allow reverse lookup of elements) are deleted. The attribute to map vertex to point (myPointRef) remains untouched.
void GA_Topology::makePointRef | ( | ) |
Make the attribute to store vertex->point reference (mandatory)
void GA_Topology::makePrimitiveRef | ( | ) |
Make the attribute to store vertex->primitive reference (optional)
void GA_Topology::makeVertexRef | ( | ) |
Make the attributes to store point->vertex references (optional) Note: This method will create 3 attributes
void GA_Topology::mergeRebuild | ( | const GA_MergeMap & | map | ) |
Make any changes to the topology attributes to accommodate the new data (i.e. change their sizes if need be). This method is called before the merge begins.
|
static |
GA_CEAttribute* GA_Topology::queryCEAttribute | ( | TopologyCE | topotype, |
GA_StorageClass | storage, | ||
GA_Precision | precision, | ||
int & | tuplesize, | ||
bool | isarray, | ||
bool | read, | ||
bool | write | ||
) |
The topology data may be on the GPU. This also includes some meta-topology info such as prim->points. Note topology is in index space on the GPU, not offset, so we always have a non tirival mapping.
Currently writing isn't supported. Gets a named topology attribute, verifying it was cached with a matching data id. If not, flushes any cache and returns null.
void GA_Topology::rebuildHedgeTopologyLinks | ( | ) |
Tosses out existing topology links and rebuilds the whole thing from scratch.
void GA_Topology::rebuildTopology | ( | bool | rebuild_topology = true , |
bool | support_hedge = false |
||
) |
Re-create the topology links. This method will re-create all the topological information. If the rebuild_topology
option is true, then any missing attributes will be created. If support_hedge is true, then half-edge topology attributes are constructed.
void GA_Topology::relinkHedge | ( | GA_Offset | src_vtx, |
GA_Offset | dst_vtx, | ||
GA_Offset | into_src_vtx = GA_INVALID_OFFSET |
||
) |
Same as linkHedge, but first unlinks hedge before calling linkHedge.
This is equivalent to calling relinkHedge on both of the hedges that are incident to a vtx.
void GA_Topology::relinkVertexHedges | ( | GA_Offset | vtx, |
GA_Offset | prev_into_src_vtx, | ||
GA_Offset | next_into_src_vtx | ||
) |
This is equivalent to calling relinkHedge on both of the hedges that are incident to a vtx. Instead of searching for equivalent hedges to link into, it respectively links the the hedges whose head and tail vertices are vtx into prev_into_src_vtx and next_into_src_vtx.
void GA_Topology::setCEAttribute | ( | UT_UniquePtr< GA_CEAttribute > && | ceattrib, |
TopologyCE | topotype, | ||
bool | leave_on_gpu = false |
||
) |
Stores this as the canonical CE attribute for this topoid, marking current data id as the valid version.
void GA_Topology::stealCEAttributes | ( | const GA_Topology & | src | ) |
Steal the CE attribute from the source topology, leaving the src with a null CE attribute.
|
static |
bool GA_Topology::validate | ( | ) | const |
Verify that the topologies are constructed correctly This is just for debugging purposes, and so may call printf
Wires vertex to the point and completely ignores the affected hedges.
This is equivalent to wireVertexPoint before hedges were introduced, or when hedge attributes do not exist. Note that if hedge attributes are present, this should be called at the risk of violating hedge invariants. It is useful, for example, if all the vertices wired to a point are being wired to another point and therefore there is no need to update hedge attributes.
void GA_Topology::wireVertexPointAndRelinkHedges | ( | GA_Offset | vtx, |
GA_Offset | pt, | ||
GA_Offset | prev_into_src_vtx, | ||
GA_Offset | next_into_src_vtx | ||
) |
Wires vertex to the point and links the the hedges whose head and tail vertices are vtx into prev_into_src_vtx and next_into_src_vtx respectively.