11 #ifndef OPENVDB_AX_COMPILER_LEAF_LOCAL_DATA_HAS_BEEN_INCLUDED 12 #define OPENVDB_AX_COMPILER_LEAF_LOCAL_DATA_HAS_BEEN_INCLUDED 15 #include <openvdb/version.h> 29 namespace codegen_internal {
46 using UniquePtr = std::unique_ptr<PointLeafLocalData>;
53 using LeafNode = openvdb::points::PointDataTree::LeafNodeType;
84 static const size_t maxGroupsInArray =
85 #if (OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER > 7 || \ 86 (OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER >= 7 && \ 87 OPENVDB_LIBRARY_MINOR_VERSION_NUMBER >= 1)) 88 points::AttributeSet::Descriptor::groupBits();
91 points::point_group_internal::GroupInfo::groupBits();
94 if (mArrays.empty() || mOffset == maxGroupsInArray) {
96 mArrays.emplace_back(
new GroupArrayT(static_cast<openvdb::Index>(mPointCount)));
103 std::unique_ptr<GroupHandleT>& handle = mHandles[name];
115 const auto iter = mHandles.find(name);
116 if (iter == mHandles.end())
return nullptr;
117 return iter->second.get();
124 inline bool hasGroup(
const std::string& name)
const {
125 return mHandles.find(name) != mHandles.end();
134 inline void getGroups(std::set<std::string>& groups)
const {
135 for (
const auto& iter : mHandles) {
136 groups.insert(iter.first);
144 for (
auto& array : mArrays) array->compact();
162 const auto arrayMapIter = mStringMap.find(const_cast<points::AttributeArray*>(array));
163 if (arrayMapIter == mStringMap.end())
return false;
164 const auto iter = arrayMapIter->second.find(idx);
165 if (iter == arrayMapIter->second.end())
return false;
179 mStringMap[array][idx] = data;
190 const auto arrayMapIter = mStringMap.find(array);
191 if (arrayMapIter == mStringMap.end())
return;
192 arrayMapIter->second.erase(idx);
193 if (arrayMapIter->second.empty()) mStringMap.erase(arrayMapIter);
204 for (
const auto& arrayIter : mStringMap) {
205 for (
const auto& iter : arrayIter.second) {
206 inserter.
insert(iter.second);
209 return !mStringMap.empty();
220 const size_t mPointCount;
221 std::vector<std::unique_ptr<GroupArrayT>> mArrays;
223 std::map<std::string, std::unique_ptr<GroupHandleT>> mHandles;
234 #endif // OPENVDB_AX_COMPILER_LEAF_LOCAL_DATA_HAS_BEEN_INCLUDED
Base class for storing attribute data.
Definition: AttributeArray.h:93
std::unique_ptr< PointLeafLocalData > UniquePtr
Definition: PointLeafLocalData.h:46
bool insertNewStrings(points::StringMetaInserter &inserter) const
Insert all new point strings stored across all collected string attribute arrays into a StringMetaIns...
Definition: PointLeafLocalData.h:203
uint8_t GroupType
Definition: AttributeSet.h:32
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...
Definition: PointLeafLocalData.h:189
bool hasGroup(const std::string &name) const
Return true if a valid group handle exists.
Definition: PointLeafLocalData.h:124
TypedAttributeArray< GroupType, GroupCodec > GroupAttributeArray
Definition: AttributeGroup.h:41
std::map< uint64_t, std::string > PointStringMap
Definition: PointLeafLocalData.h:50
const StringArrayMap & getStringArrayMap() const
Returns a const reference to the string array map.
Definition: PointLeafLocalData.h:214
openvdb::points::PointDataTree::LeafNodeType LeafNode
Definition: PointLeafLocalData.h:53
Attribute Array storage templated on type and compression codec.
openvdb::points::GroupAttributeArray GroupArrayT
Definition: PointLeafLocalData.h:47
openvdb::points::GroupWriteHandle GroupHandleT
Definition: PointLeafLocalData.h:48
std::map< points::AttributeArray *, PointStringMap > StringArrayMap
Definition: PointLeafLocalData.h:51
Point attribute manipulation in a VDB Point Grid.
Point group manipulation in a VDB Point Grid.
GroupHandleT * getOrInsert(const std::string &name)
Group methods.
Definition: PointLeafLocalData.h:79
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...
Definition: PointLeafLocalData.h:178
#define OPENVDB_ASSERT(X)
Definition: Assert.h:41
Definition: Exceptions.h:13
void compact()
Compact all arrays stored on this object. This does not invalidate any active write handles...
Definition: PointLeafLocalData.h:143
bool getNewStringData(const points::AttributeArray *array, const uint64_t idx, std::string &data) const
String methods.
Definition: PointLeafLocalData.h:161
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...
Definition: PointLeafLocalData.h:134
Attribute-owned data structure for points. Point attributes are stored in leaf nodes and ordered by v...
PointLeafLocalData(const size_t count)
Construct a new data object to keep track of various data objects created per leaf by the point compu...
Definition: PointLeafLocalData.h:61
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h.in:121
Various functions can request the use and initialization of point data from within the kernel that do...
Definition: PointLeafLocalData.h:44
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h.in:218