OpenVDB 13.0.0

Loading...
Searching...
No Matches
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 <openvdb_ax/codegen/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.
GroupHandleT * | getOrInsert (const std::string &name)
| Group methods.
GroupHandleT * | get (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.
bool | hasGroup (const std::string &name) const
| Return true if a valid group handle exists.
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.
void | compact ()
| Compact all arrays stored on this object. This does not invalidate any active write handles.
bool | getNewStringData (const points::AttributeArray *array, const uint64_t idx, std::string &data) const
| String methods.
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.
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.
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.
const StringArrayMap & | getStringArrayMap () const
| Returns a const reference to the string array map.

## 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

## ◆ GroupArrayT

using GroupArrayT = openvdb::points::GroupAttributeArray

## ◆ GroupHandleT

using GroupHandleT = openvdb::points::GroupWriteHandle

## ◆ LeafNode

using LeafNode = openvdb::points::PointDataTree::LeafNodeType

## ◆ PointStringMap

using PointStringMap = std::map<uint64_t, std::string>

## ◆ StringArrayMap

using StringArrayMap = std::map<points::AttributeArray*, PointStringMap>

## ◆ UniquePtr

using UniquePtr = std::unique_ptr<PointLeafLocalData>

## Constructor & Destructor Documentation

## ◆ PointLeafLocalData()

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

  count | The number of points within the current leaf, used to initialize the size of new arrays

## Member Function Documentation

## ◆ compact()

void compact | ( |  | ) |
| inline

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

## ◆ get()

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

  name | The group name

## ◆ getGroups()

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

  groups | The set to populate

## ◆ getNewStringData()

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

  array | The array pointer to use as a key lookup
  idx | The point index
  data | The string to set if data is stored

## ◆ getOrInsert()

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

  name | The group name

## ◆ getStringArrayMap()

const StringArrayMap & getStringArrayMap | ( |  | ) | const
| inline

Returns a const reference to the string array map.

## ◆ hasGroup()

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

Return true if a valid group handle exists.

Parameters

  name | The group name

## ◆ insertNewStrings()

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

  inserter | The string meta inserter to update

## ◆ removeNewStringData()

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

  array | The array pointer to use as a key lookup
  idx | The point index

## ◆ setNewStringData()

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

  array | The array pointer to use as a key lookup
  idx | The point index
  data | The string to set