HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AttributeSet.h
Go to the documentation of this file.
1 // Copyright Contributors to the OpenVDB Project
2 // SPDX-License-Identifier: MPL-2.0
3 
4 /// @file points/AttributeSet.h
5 ///
6 /// @authors Dan Bailey, Mihai Alden
7 ///
8 /// @brief Set of Attribute Arrays which tracks metadata about each array.
9 
10 #ifndef OPENVDB_POINTS_ATTRIBUTE_SET_HAS_BEEN_INCLUDED
11 #define OPENVDB_POINTS_ATTRIBUTE_SET_HAS_BEEN_INCLUDED
12 
13 #include "AttributeArray.h"
14 #include <openvdb/version.h>
15 #include <openvdb/MetaMap.h>
16 
17 #include <limits>
18 #include <memory>
19 #include <vector>
20 
21 
22 class TestAttributeSet;
23 
24 
25 namespace openvdb {
27 namespace OPENVDB_VERSION_NAME {
28 namespace points {
29 
30 
31 using GroupType = uint8_t;
32 
33 
34 ////////////////////////////////////////
35 
36 
37 /// Ordered collection of uniquely-named attribute arrays
39 {
40 public:
41  enum { INVALID_POS = std::numeric_limits<size_t>::max() };
42 
43  using Ptr = std::shared_ptr<AttributeSet>;
44  using ConstPtr = std::shared_ptr<const AttributeSet>;
45  using UniquePtr = std::unique_ptr<AttributeSet>;
46 
47  class Descriptor;
48 
49  using DescriptorPtr = std::shared_ptr<Descriptor>;
50  using DescriptorConstPtr = std::shared_ptr<const Descriptor>;
51 
52  //////////
53 
54  struct Util
55  {
56  /// Attribute and type name pair.
57  struct NameAndType {
58  NameAndType(const std::string& n, const NamePair& t, const Index s = 1)
59  : name(n), type(t), stride(s) {}
63  };
64 
65  using NameAndTypeVec = std::vector<NameAndType>;
66  using NameToPosMap = std::map<std::string, size_t>;
67  using GroupIndex = std::pair<size_t, uint8_t>;
68  };
69 
70  //////////
71 
72  AttributeSet();
73 
74  /// Construct a new AttributeSet from the given AttributeSet.
75  /// @param attributeSet the old attribute set
76  /// @param arrayLength the desired length of the arrays in the new AttributeSet
77  /// @param lock an optional scoped registry lock to avoid contention
78  /// @note This constructor is typically used to resize an existing AttributeSet as
79  /// it transfers attribute metadata such as hidden and transient flags
80  AttributeSet(const AttributeSet& attributeSet, Index arrayLength,
81  const AttributeArray::ScopedRegistryLock* lock = nullptr);
82 
83  /// Construct a new AttributeSet from the given Descriptor.
84  /// @param descriptor stored in the new AttributeSet and used in construction
85  /// @param arrayLength the desired length of the arrays in the new AttributeSet
86  /// @param lock an optional scoped registry lock to avoid contention
87  /// @note Descriptors do not store attribute metadata such as hidden and transient flags
88  /// which live on the AttributeArrays, so for constructing from an existing AttributeSet
89  /// use the AttributeSet(const AttributeSet&, Index) constructor instead
90  AttributeSet(const DescriptorPtr& descriptor, Index arrayLength = 1,
91  const AttributeArray::ScopedRegistryLock* lock = nullptr);
92 
93  /// Shallow copy constructor, the descriptor and attribute arrays will be shared.
94  AttributeSet(const AttributeSet&);
95 
96  /// Disallow copy assignment, since it wouldn't be obvious whether the copy is deep or shallow.
97  AttributeSet& operator=(const AttributeSet&) = delete;
98 
99  //@{
100  /// @brief Return a reference to this attribute set's descriptor, which might
101  /// be shared with other sets.
102  Descriptor& descriptor() { return *mDescr; }
103  const Descriptor& descriptor() const { return *mDescr; }
104  //@}
105 
106  /// @brief Return a pointer to this attribute set's descriptor, which might be
107  /// shared with other sets
108  DescriptorPtr descriptorPtr() const { return mDescr; }
109 
110  /// Return the number of attributes in this set.
111  size_t size() const { return mAttrs.size(); }
112 
113  /// Return the number of bytes of memory used by this attribute set.
114  size_t memUsage() const;
115 
116  /// @brief Return the position of the attribute array whose name is @a name,
117  /// or @c INVALID_POS if no match is found.
118  size_t find(const std::string& name) const;
119 
120  /// @brief Replace the attribute array whose name is @a name.
121  /// @return The position of the updated attribute array or @c INVALID_POS
122  /// if the given name does not exist or if the replacement failed because
123  /// the new array type does not comply with the descriptor.
124  size_t replace(const std::string& name, const AttributeArray::Ptr&);
125 
126  /// @brief Replace the attribute array stored at position @a pos in this container.
127  /// @return The position of the updated attribute array or @c INVALID_POS
128  /// if replacement failed because the new array type does not comply with
129  /// the descriptor.
130  size_t replace(size_t pos, const AttributeArray::Ptr&);
131 
132  //@{
133  /// @brief Return a pointer to the attribute array whose name is @a name or
134  /// a null pointer if no match is found.
135  const AttributeArray* getConst(const std::string& name) const;
136  const AttributeArray* get(const std::string& name) const;
137  AttributeArray* get(const std::string& name);
138  //@}
139 
140  //@{
141  /// @brief Return a pointer to the attribute array stored at position @a pos
142  /// in this set.
143  const AttributeArray* getConst(size_t pos) const;
144  const AttributeArray* get(size_t pos) const;
145  AttributeArray* get(size_t pos);
146  //@}
147 
148  //@{
149  /// @brief Return the group offset from the name or index of the group
150  /// A group attribute array is a single byte (8-bit), each bit of which
151  /// can denote a group. The group offset is the position of the bit that
152  /// denotes the requested group if all group attribute arrays in the set
153  /// (and only attribute arrays marked as group) were to be laid out linearly
154  /// according to their order in the set.
155  size_t groupOffset(const Name& groupName) const;
156  size_t groupOffset(const Util::GroupIndex& index) const;
157  //@}
158 
159  /// Return the group index from the name of the group
160  Util::GroupIndex groupIndex(const Name& groupName) const;
161  /// Return the group index from the offset of the group
162  /// @note see offset description for groupOffset()
163  Util::GroupIndex groupIndex(const size_t offset) const;
164 
165  /// Return the indices of the attribute arrays which are group attribute arrays
166  std::vector<size_t> groupAttributeIndices() const;
167 
168  /// Return true if the attribute array stored at position @a pos is shared.
169  bool isShared(size_t pos) const;
170  /// @brief If the attribute array stored at position @a pos is shared,
171  /// replace the array with a deep copy of itself that is not
172  /// shared with anyone else.
173  void makeUnique(size_t pos);
174 
175  /// Append attribute @a attribute (simple method)
177  const NamePair& type,
178  const Index strideOrTotalSize = 1,
179  const bool constantStride = true,
180  const Metadata* defaultValue = nullptr);
181 
184  const NamePair& type,
185  const Index strideOrTotalSize,
186  const bool constantStride,
187  Metadata::Ptr defaultValue);
188 
189  /// Append attribute @a attribute (descriptor-sharing)
190  /// Requires current descriptor to match @a expected
191  /// On append, current descriptor is replaced with @a replacement
192  /// Provide a @a lock object to avoid contention from appending in parallel
193  AttributeArray::Ptr appendAttribute(const Descriptor& expected, DescriptorPtr& replacement,
194  const size_t pos, const Index strideOrTotalSize = 1,
195  const bool constantStride = true,
196  const Metadata* defaultValue = nullptr,
197  const AttributeArray::ScopedRegistryLock* lock = nullptr);
198 
200  AttributeArray::Ptr appendAttribute(const Descriptor& expected, DescriptorPtr& replacement,
201  const size_t pos, const Index strideOrTotalSize,
202  const bool constantStride,
204 
205  /// @brief Remove and return an attribute array by name
206  /// @param name the name of the attribute array to release
207  /// @details Detaches the attribute array from this attribute set and returns it, if
208  /// @a name is invalid, returns an empty shared pointer. This also updates the descriptor
209  /// to remove the reference to the attribute array.
210  /// @note AttributeArrays are stored as shared pointers, so they are not guaranteed
211  /// to be unique. Check the reference count before blindly re-using in a new AttributeSet.
212  AttributeArray::Ptr removeAttribute(const Name& name);
213 
214  /// @brief Remove and return an attribute array by index
215  /// @param pos the position index of the attribute to release
216  /// @details Detaches the attribute array from this attribute set and returns it, if
217  /// @a pos is invalid, returns an empty shared pointer. This also updates the descriptor
218  /// to remove the reference to the attribute array.
219  /// @note AttributeArrays are stored as shared pointers, so they are not guaranteed
220  /// to be unique. Check the reference count before blindly re-using in a new AttributeSet.
221  AttributeArray::Ptr removeAttribute(const size_t pos);
222 
223  /// @brief Remove and return an attribute array by index (unsafe method)
224  /// @param pos the position index of the attribute to release
225  /// @details Detaches the attribute array from this attribute set and returns it, if
226  /// @a pos is invalid, returns an empty shared pointer.
227  /// In cases where the AttributeSet is due to be destroyed, a small performance
228  /// advantage can be gained by leaving the attribute array as a nullptr and not
229  /// updating the descriptor. However, this leaves the AttributeSet in an invalid
230  /// state making it unsafe to call any methods that implicitly derefence the attribute array.
231  /// @note AttributeArrays are stored as shared pointers, so they are not guaranteed
232  /// to be unique. Check the reference count before blindly re-using in a new AttributeSet.
233  /// @warning Only use this method if you're an expert and know the risks of not
234  /// updating the array of attributes or the descriptor.
235  AttributeArray::Ptr removeAttributeUnsafe(const size_t pos);
236 
237  /// Drop attributes with @a pos indices (simple method)
238  /// Creates a new descriptor for this attribute set
239  void dropAttributes(const std::vector<size_t>& pos);
240 
241  /// Drop attributes with @a pos indices (descriptor-sharing method)
242  /// Requires current descriptor to match @a expected
243  /// On drop, current descriptor is replaced with @a replacement
244  void dropAttributes(const std::vector<size_t>& pos,
245  const Descriptor& expected, DescriptorPtr& replacement);
246 
247  /// Re-name attributes in set to match a provided descriptor
248  /// Replaces own descriptor with @a replacement
249  void renameAttributes(const Descriptor& expected, const DescriptorPtr& replacement);
250 
251  /// Re order attribute set to match a provided descriptor
252  /// Replaces own descriptor with @a replacement
253  void reorderAttributes(const DescriptorPtr& replacement);
254 
255  /// Replace the current descriptor with a @a replacement
256  /// Note the provided Descriptor must be identical to the replacement
257  /// unless @a allowMismatchingDescriptors is true (default is false)
258  void resetDescriptor(const DescriptorPtr& replacement, const bool allowMismatchingDescriptors = false);
259 
260  /// Read the entire set from a stream.
261  void read(std::istream&);
262  /// Write the entire set to a stream.
263  /// @param outputTransient if true, write out transient attributes
264  void write(std::ostream&, bool outputTransient = false) const;
265 
266  /// This will read the attribute descriptor from a stream.
267  void readDescriptor(std::istream&);
268  /// This will write the attribute descriptor to a stream.
269  /// @param outputTransient if true, write out transient attributes
270  void writeDescriptor(std::ostream&, bool outputTransient = false) const;
271 
272  /// This will read the attribute metadata from a stream.
273  void readMetadata(std::istream&);
274  /// This will write the attribute metadata to a stream.
275  /// @param outputTransient if true, write out transient attributes
276  /// @param paged if true, data is written out in pages
277  void writeMetadata(std::ostream&, bool outputTransient = false, bool paged = false) const;
278 
279  /// This will read the attribute data from a stream.
280  void readAttributes(std::istream&);
281  /// This will write the attribute data to a stream.
282  /// @param outputTransient if true, write out transient attributes
283  void writeAttributes(std::ostream&, bool outputTransient = false) const;
284 
285  /// Compare the descriptors and attribute arrays on the attribute sets
286  /// Exit early if the descriptors do not match
287  bool operator==(const AttributeSet& other) const;
288  bool operator!=(const AttributeSet& other) const { return !this->operator==(other); }
289 
290 private:
291  using AttrArrayVec = std::vector<AttributeArray::Ptr>;
292 
293  DescriptorPtr mDescr;
294  AttrArrayVec mAttrs;
295 }; // class AttributeSet
296 
297 ////////////////////////////////////////
298 
299 
300 /// A container for ABI=5 to help ease introduction of upcoming features
301 namespace future {
302  class Container
303  {
304  class Element { };
305  std::vector<std::shared_ptr<Element>> mElements;
306  };
307 }
308 
309 
310 ////////////////////////////////////////
311 
312 
313 /// @brief An immutable object that stores name, type and AttributeSet position
314 /// for a constant collection of attribute arrays.
315 /// @note The attribute name is actually mutable, but the attribute type
316 /// and position can not be changed after creation.
317 class OPENVDB_API AttributeSet::Descriptor
318 {
319 public:
320  using Ptr = std::shared_ptr<Descriptor>;
321 
326  using ConstIterator = NameToPosMap::const_iterator;
327 
328  /// Utility method to construct a NameAndType sequence.
329  struct Inserter {
331  Inserter& add(const NameAndType& nameAndType) {
332  vec.push_back(nameAndType); return *this;
333  }
334  Inserter& add(const Name& name, const NamePair& type) {
335  vec.emplace_back(name, type); return *this;
336  }
337  Inserter& add(const NameAndTypeVec& other) {
338  for (NameAndTypeVec::const_iterator it = other.begin(), itEnd = other.end(); it != itEnd; ++it) {
339  vec.emplace_back(it->name, it->type);
340  }
341  return *this;
342  }
343  };
344 
345  //////////
346 
347  Descriptor();
348 
349  /// Copy constructor
350  Descriptor(const Descriptor&);
351 
352  /// Create a new descriptor from a position attribute type and assumes "P" (for convenience).
353  static Ptr create(const NamePair&);
354 
355  /// Create a new descriptor as a duplicate with a new attribute appended
356  Ptr duplicateAppend(const Name& name, const NamePair& type) const;
357 
358  /// Create a new descriptor as a duplicate with existing attributes dropped
359  Ptr duplicateDrop(const std::vector<size_t>& pos) const;
360 
361  /// Return the number of attributes in this descriptor.
362  size_t size() const { return mTypes.size(); }
363 
364  /// Return the number of attributes with this attribute type
365  size_t count(const NamePair& type) const;
366 
367  /// Return the number of bytes of memory used by this attribute set.
368  size_t memUsage() const;
369 
370  /// @brief Return the position of the attribute array whose name is @a name,
371  /// or @c INVALID_POS if no match is found.
372  size_t find(const std::string& name) const;
373 
374  /// Rename an attribute array
375  size_t rename(const std::string& fromName, const std::string& toName);
376 
377  /// Return the name of the attribute array's type.
378  const Name& valueType(size_t pos) const;
379  /// Return the name of the attribute array's type.
380  const NamePair& type(size_t pos) const;
381 
382  /// Retrieve metadata map
383  MetaMap& getMetadata();
384  const MetaMap& getMetadata() const;
385 
386  /// Return true if the attribute has a default value
387  bool hasDefaultValue(const Name& name) const;
388  /// Get a default value for an existing attribute
389  template<typename ValueType>
390  ValueType getDefaultValue(const Name& name) const
391  {
392  const size_t pos = find(name);
393  if (pos == INVALID_POS) {
394  OPENVDB_THROW(LookupError, "Cannot find attribute name to set default value.")
395  }
396 
397  std::stringstream ss;
398  ss << "default:" << name;
399 
400  auto metadata = mMetadata.getMetadata<TypedMetadata<ValueType>>(ss.str());
401 
402  if (metadata) return metadata->value();
403 
404  return zeroVal<ValueType>();
405  }
406  /// Set a default value for an existing attribute
407  void setDefaultValue(const Name& name, const Metadata& defaultValue);
408  // Remove the default value if it exists
409  void removeDefaultValue(const Name& name);
410  // Prune any default values for which the key is no longer present
411  void pruneUnusedDefaultValues();
412 
413  /// Return true if this descriptor is equal to the given one.
414  bool operator==(const Descriptor&) const;
415  /// Return true if this descriptor is not equal to the given one.
416  bool operator!=(const Descriptor& rhs) const { return !this->operator==(rhs); }
417  /// Return true if this descriptor contains the same attributes
418  /// as the given descriptor, ignoring attribute order
419  bool hasSameAttributes(const Descriptor& rhs) const;
420 
421  /// Return a reference to the name-to-position map.
422  const NameToPosMap& map() const { return mNameMap; }
423  /// Return a reference to the name-to-position group map.
424  const NameToPosMap& groupMap() const { return mGroupMap; }
425 
426  /// Return @c true if group exists
427  bool hasGroup(const Name& group) const;
428  /// @brief Define a group name to offset mapping
429  /// @param group group name
430  /// @param offset group offset
431  /// @param checkValidOffset throws if offset out-of-range or in-use
432  void setGroup(const Name& group, const size_t offset,
433  const bool checkValidOffset = false);
434  /// Drop any mapping keyed by group name
435  void dropGroup(const Name& group);
436  /// Clear all groups
437  void clearGroups();
438  /// Rename a group
439  size_t renameGroup(const std::string& fromName, const std::string& toName);
440  /// Return a unique name for a group based on given name
441  const Name uniqueGroupName(const Name& name) const;
442 
443  //@{
444  /// @brief Return the group offset from the name or index of the group
445  /// A group attribute array is a single byte (8-bit), each bit of which
446  /// can denote a group. The group offset is the position of the bit that
447  /// denotes the requested group if all group attribute arrays in the set
448  /// (and only attribute arrays marked as group) were to be laid out linearly
449  /// according to their order in the set.
450  size_t groupOffset(const Name& groupName) const;
451  size_t groupOffset(const GroupIndex& index) const;
452  //@}
453 
454  /// Return the group index from the name of the group
455  GroupIndex groupIndex(const Name& groupName) const;
456  /// Return the group index from the offset of the group
457  /// @note see offset description for groupOffset()
458  GroupIndex groupIndex(const size_t offset) const;
459 
460  /// Return number of bits occupied by a group attribute array
461  static size_t groupBits() { return sizeof(GroupType) * CHAR_BIT; }
462 
463  /// Return the total number of available groups
464  /// (group bits * number of group attributes)
465  size_t availableGroups() const;
466 
467  /// Return the number of empty group slots which correlates to the number of groups
468  /// that can be stored without increasing the number of group attribute arrays
469  size_t unusedGroups() const;
470 
471  /// Return @c true if there are sufficient empty slots to allow compacting
472  bool canCompactGroups() const;
473 
474  /// @brief Return a group offset that is not in use
475  /// @param hint if provided, request a specific offset as a hint
476  /// @return index of an offset or size_t max if no available group offsets
477  size_t unusedGroupOffset(size_t hint = std::numeric_limits<size_t>::max()) const;
478 
480  size_t nextUnusedGroupOffset() const;
481 
482  /// @brief Determine if a move is required to efficiently compact the data and store the
483  /// source name, offset and the target offset in the input parameters
484  /// @param sourceName source name
485  /// @param sourceOffset source offset
486  /// @param targetOffset target offset
487  /// @return @c true if move is required to compact the data
488  bool requiresGroupMove(Name& sourceName, size_t& sourceOffset, size_t& targetOffset) const;
489 
490  /// @brief Test if there are any group names shared by both descriptors which
491  /// have a different index
492  /// @param rhs the descriptor to compare with
493  /// @return @c true if an index collision exists
494  bool groupIndexCollision(const Descriptor& rhs) const;
495 
496  /// Return a unique name for an attribute array based on given name
497  const Name uniqueName(const Name& name) const;
498 
499  /// Return true if the name is valid
500  static bool validName(const Name& name);
501 
502  /// @brief Extract each name from @a nameStr into @a includeNames, or into @a excludeNames
503  /// if the name is prefixed with a caret.
504  /// @param nameStr the input string of names
505  /// @param includeNames on exit, the list of names that are not prefixed with a caret
506  /// @param excludeNames on exit, the list of names that are prefixed with a caret
507  /// @param includeAll on exit, @c true if a "*" wildcard is present in the @a includeNames
508  static void parseNames( std::vector<std::string>& includeNames,
509  std::vector<std::string>& excludeNames,
510  bool& includeAll,
511  const std::string& nameStr);
512 
513  /// @brief Extract each name from @a nameStr into @a includeNames, or into @a excludeNames
514  /// if the name is prefixed with a caret.
515  static void parseNames( std::vector<std::string>& includeNames,
516  std::vector<std::string>& excludeNames,
517  const std::string& nameStr);
518 
519  /// Serialize this descriptor to the given stream.
520  void write(std::ostream&) const;
521  /// Unserialize this transform from the given stream.
522  void read(std::istream&);
523 
524 protected:
525  /// Append to a vector of names and types from this Descriptor in position order
526  void appendTo(NameAndTypeVec& attrs) const;
527 
528  /// Create a new descriptor from the given attribute and type name pairs
529  /// and copy the group maps and metamap.
530  static Ptr create(const NameAndTypeVec&, const NameToPosMap&, const MetaMap&);
531 
532  size_t insert(const std::string& name, const NamePair& typeName);
533 
534 private:
535  friend class ::TestAttributeSet;
536 
537  NameToPosMap mNameMap;
538  std::vector<NamePair> mTypes;
539  NameToPosMap mGroupMap;
540  MetaMap mMetadata;
541  // as this change is part of an ABI change, there's no good reason to reduce the reserved
542  // space aside from keeping the memory size of an AttributeSet the same for convenience
543  // (note that this assumes a typical three-pointer implementation for std::vector)
544  future::Container mFutureContainer; // occupies 3 reserved slots
545  int64_t mReserved[5]; // for future use
546 }; // class Descriptor
547 
548 } // namespace points
549 } // namespace OPENVDB_VERSION_NAME
550 } // namespace openvdb
551 
552 #endif // OPENVDB_POINTS_ATTRIBUTE_ARRAY_HAS_BEEN_INCLUDED
GLdouble s
Definition: glew.h:1390
vbool4 insert(const vbool4 &a, bool val)
Helper: substitute val for a[i].
Definition: simd.h:3340
vint4 max(const vint4 &a, const vint4 &b)
Definition: simd.h:4703
Definition: ImfName.h:54
ValueType getDefaultValue(const Name &name) const
Get a default value for an existing attribute.
Definition: AttributeSet.h:390
Descriptor & descriptor()
Return a reference to this attribute set's descriptor, which might be shared with other sets...
Definition: AttributeSet.h:102
const Descriptor & descriptor() const
Return a reference to this attribute set's descriptor, which might be shared with other sets...
Definition: AttributeSet.h:103
GLuint const GLchar * name
Definition: glew.h:1814
void dropGroup(PointDataTree &tree, const Name &group, const bool compact=true)
Drops an existing group from the VDB tree.
Definition: PointGroup.h:404
bool operator!=(const Descriptor &rhs) const
Return true if this descriptor is not equal to the given one.
Definition: AttributeSet.h:416
T & value()
Return this metadata's value.
Definition: Metadata.h:249
GLuint index
Definition: glew.h:1814
OIIO_API bool rename(string_view from, string_view to, std::string &err)
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:166
std::shared_ptr< const AttributeSet > ConstPtr
Definition: AttributeSet.h:44
bool operator!=(const AttributeSet &other) const
Definition: AttributeSet.h:288
void read(T &in, bool &v)
Definition: ImfXdr.h:611
Container that maps names (strings) to values of arbitrary types.
Definition: MetaMap.h:19
Utility method to construct a NameAndType sequence.
Definition: AttributeSet.h:329
void renameAttributes(PointDataTreeT &tree, const std::vector< Name > &oldNames, const std::vector< Name > &newNames)
Rename attributes in a VDB tree.
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
void appendAttribute(PointDataTreeT &tree, const Name &name, const NamePair &type, const Index strideOrTotalSize=1, const bool constantStride=true, const Metadata *defaultValue=nullptr, const bool hidden=false, const bool transient=false)
Appends a new attribute to the VDB tree (this method does not require a templated AttributeType) ...
Base class for storing attribute data.
#define OPENVDB_API
Helper macros for defining library symbol visibility.
Definition: Platform.h:230
std::string OIIO_API replace(string_view str, string_view pattern, string_view replacement, bool global=false)
Templated metadata class to hold specific types.
Definition: Metadata.h:121
std::shared_ptr< const Descriptor > DescriptorConstPtr
Definition: AttributeSet.h:50
GLsizei n
Definition: glew.h:4040
void dropAttributes(PointDataTreeT &tree, const std::vector< size_t > &indices)
Drops attributes from the VDB tree.
const NameToPosMap & groupMap() const
Return a reference to the name-to-position group map.
Definition: AttributeSet.h:424
NameAndType(const std::string &n, const NamePair &t, const Index s=1)
Definition: AttributeSet.h:58
std::pair< Name, Name > NamePair
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1253
Inserter & add(const NameAndType &nameAndType)
Definition: AttributeSet.h:331
GLsizei stride
Definition: glew.h:1523
GLsizei const GLchar *const * string
Definition: glew.h:1844
std::unique_ptr< AttributeSet > UniquePtr
Definition: AttributeSet.h:45
FMT_CONSTEXPR bool find(Ptr first, Ptr last, T value, Ptr &out)
Definition: format.h:2104
GLuint GLdouble GLdouble GLint GLint const GLdouble * points
Definition: glew.h:3446
GLuint GLuint GLsizei count
Definition: glew.h:1253
Base class for storing metadata information in a grid.
Definition: Metadata.h:23
void setGroup(PointDataTree &tree, const PointIndexTree &indexTree, const std::vector< short > &membership, const Name &group, const bool remove=false)
Sets group membership from a PointIndexTree-ordered vector.
Definition: PointGroup.h:546
size_t size() const
Return the number of attributes in this set.
Definition: AttributeSet.h:111
Ordered collection of uniquely-named attribute arrays.
Definition: AttributeSet.h:38
Inserter & add(const Name &name, const NamePair &type)
Definition: AttributeSet.h:334
static size_t groupBits()
Return number of bits occupied by a group attribute array.
Definition: AttributeSet.h:461
Attribute Array storage templated on type and compression codec.
void write(T &out, bool v)
Definition: ImfXdr.h:332
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:112
GLdouble GLdouble t
Definition: glew.h:1398
DescriptorPtr descriptorPtr() const
Return a pointer to this attribute set's descriptor, which might be shared with other sets...
Definition: AttributeSet.h:108
#define OPENVDB_THROW(exception, message)
Definition: Exceptions.h:82
type
Definition: core.h:528
GLboolean GLuint group
Definition: glew.h:2745
const NameToPosMap & map() const
Return a reference to the name-to-position map.
Definition: AttributeSet.h:422
GLintptr offset
Definition: glew.h:1682