OpenVDB  8.1.1
Public Types | Public Member Functions | List of all members
PointLeafLocalData Struct Reference

Various functions can request the use and initialization of point data from within the kernel that does not use the standard attribute handle methods. This data can then be accessed after execution to perform post-processes such as adding new groups, adding new string attributes or updating positions. More...

#include <PointLeafLocalData.h>

Public Types

using UniquePtr = std::unique_ptr< PointLeafLocalData >
 
using GroupArrayT = openvdb::points::GroupAttributeArray
 
using GroupHandleT = openvdb::points::GroupWriteHandle
 
using PointStringMap = std::map< uint64_t, std::string >
 
using StringArrayMap = std::map< points::AttributeArray *, PointStringMap >
 
using LeafNode = openvdb::points::PointDataTree::LeafNodeType
 

Public Member Functions

 PointLeafLocalData (const size_t count)
 Construct a new data object to keep track of various data objects created per leaf by the point compute generator. More...
 
GroupHandleTgetOrInsert (const std::string &name)
 Group methods. More...
 
GroupHandleTget (const std::string &name) const
 Return a group write handle to a specific group name if it exists. Returns a nullptr if no group exists of the given name. More...
 
bool hasGroup (const std::string &name) const
 Return true if a valid group handle exists. More...
 
void getGroups (std::set< std::string > &groups) const
 Populate a set with all the groups which have been inserted into this object. Used to compute a final set of all new groups which have been created across all leaf nodes. More...
 
void compact ()
 Compact all arrays stored on this object. This does not invalidate any active write handles. More...
 
bool getNewStringData (const points::AttributeArray *array, const uint64_t idx, std::string &data) const
 String methods. More...
 
void setNewStringData (points::AttributeArray *array, const uint64_t idx, const std::string &data)
 Set new string data associated with a particular point on a particular string attribute array. More...
 
void removeNewStringData (points::AttributeArray *array, const uint64_t idx)
 Remove any new string data associated with a particular point on a particular string attribute array. Does nothing if no data exists. More...
 
bool insertNewStrings (points::StringMetaInserter &inserter) const
 Insert all new point strings stored across all collected string attribute arrays into a StringMetaInserter. Returns false if the inserter was not accessed and true if it was potentially modified. More...
 
const StringArrayMapgetStringArrayMap () const
 Returns a const reference to the string array map. More...
 

Detailed Description

Various functions can request the use and initialization of point data from within the kernel that does not use the standard attribute handle methods. This data can then be accessed after execution to perform post-processes such as adding new groups, adding new string attributes or updating positions.

Note
Due to the way string handles work, string write attribute handles cannot be constructed in parallel, nor can read handles retrieve values in parallel if there is a chance the shared metadata is being written to (with set()). As the compiler allows for any arbitrary string setting/getting, leaf local maps are used for temporary storage per point. The maps use the string array pointers as a key for later synchronization.

Member Typedef Documentation

using GroupArrayT = openvdb::points::GroupAttributeArray
using GroupHandleT = openvdb::points::GroupWriteHandle
using LeafNode = openvdb::points::PointDataTree::LeafNodeType
using PointStringMap = std::map<uint64_t, std::string>
using UniquePtr = std::unique_ptr<PointLeafLocalData>

Constructor & Destructor Documentation

PointLeafLocalData ( const size_t  count)
inline

Construct a new data object to keep track of various data objects created per leaf by the point compute generator.

Parameters
countThe number of points within the current leaf, used to initialize the size of new arrays

Member Function Documentation

void compact ( )
inline

Compact all arrays stored on this object. This does not invalidate any active write handles.

GroupHandleT* get ( const std::string &  name) const
inline

Return a group write handle to a specific group name if it exists. Returns a nullptr if no group exists of the given name.

Parameters
nameThe group name
void getGroups ( std::set< std::string > &  groups) const
inline

Populate a set with all the groups which have been inserted into this object. Used to compute a final set of all new groups which have been created across all leaf nodes.

Parameters
groupsThe set to populate
bool getNewStringData ( const points::AttributeArray array,
const uint64_t  idx,
std::string &  data 
) const
inline

String methods.

Get any new string data associated with a particular point on a particular string attribute array. Returns true if data was set, false if no data was found.

Parameters
arrayThe array pointer to use as a key lookup
idxThe point index
dataThe string to set if data is stored
GroupHandleT* getOrInsert ( const std::string &  name)
inline

Group methods.

Return a group write handle to a specific group name, creating the group array if it doesn't exist. This includes either registering a new offset or allocating an entire array. The returned handle is guaranteed to be valid.

Parameters
nameThe group name
const StringArrayMap& getStringArrayMap ( ) const
inline

Returns a const reference to the string array map.

bool hasGroup ( const std::string &  name) const
inline

Return true if a valid group handle exists.

Parameters
nameThe group name
bool insertNewStrings ( points::StringMetaInserter inserter) const
inline

Insert all new point strings stored across all collected string attribute arrays into a StringMetaInserter. Returns false if the inserter was not accessed and true if it was potentially modified.

Parameters
inserterThe string meta inserter to update
void removeNewStringData ( points::AttributeArray array,
const uint64_t  idx 
)
inline

Remove any new string data associated with a particular point on a particular string attribute array. Does nothing if no data exists.

Parameters
arrayThe array pointer to use as a key lookup
idxThe point index
void setNewStringData ( points::AttributeArray array,
const uint64_t  idx,
const std::string &  data 
)
inline

Set new string data associated with a particular point on a particular string attribute array.

Parameters
arrayThe array pointer to use as a key lookup
idxThe point index
dataThe string to set

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