OpenVDB 3.2.0

Grid.h
Go to the documentation of this file.
1 //
3 // Copyright (c) 2012-2016 DreamWorks Animation LLC
4 //
5 // All rights reserved. This software is distributed under the
6 // Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
7 //
8 // Redistributions of source code must retain the above copyright
9 // and license notice and the following restrictions and disclaimer.
10 //
11 // * Neither the name of DreamWorks Animation nor the names of
12 // its contributors may be used to endorse or promote products derived
13 // from this software without specific prior written permission.
14 //
15 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
20 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 // IN NO EVENT SHALL THE COPYRIGHT HOLDERS' AND CONTRIBUTORS' AGGREGATE
27 // LIABILITY FOR ALL CLAIMS REGARDLESS OF THEIR BASIS EXCEED US$250.00.
28 //
30
31 #ifndef OPENVDB_GRID_HAS_BEEN_INCLUDED
32 #define OPENVDB_GRID_HAS_BEEN_INCLUDED
33
34 #include <iostream>
35 #include <set>
36 #include <vector>
37 #include <boost/static_assert.hpp>
38 #include <boost/type_traits/remove_const.hpp>
39 #include <boost/type_traits/is_floating_point.hpp>
40 #include <openvdb/Types.h>
41 #include <openvdb/util/Name.h>
42 #include <openvdb/math/Transform.h>
43 #include <openvdb/tree/Tree.h>
44 #include <openvdb/metadata/MetaMap.h>
45 #include <openvdb/Exceptions.h>
46
47
48 namespace openvdb {
49 OPENVDB_USE_VERSION_NAMESPACE
50 namespace OPENVDB_VERSION_NAME {
51
52 typedef tree::TreeBase TreeBase;
53
54 template<typename> class Grid; // forward declaration
55
56
61 template<typename GridType>
62 inline typename GridType::Ptr createGrid(const typename GridType::ValueType& background);
63
64
68 template<typename GridType>
69 inline typename GridType::Ptr createGrid();
70
71
76 template<typename TreePtrType>
77 inline typename Grid<typename TreePtrType::element_type>::Ptr createGrid(TreePtrType);
78
79
94 template<typename GridType>
95 typename GridType::Ptr createLevelSet(
96 Real voxelSize = 1.0, Real halfWidth = LEVEL_SET_HALF_WIDTH);
97
98
100
101
103 class OPENVDB_API GridBase: public MetaMap
104 {
105 public:
106 typedef boost::shared_ptr<GridBase> Ptr;
107 typedef boost::shared_ptr<const GridBase> ConstPtr;
108
109 typedef Ptr (*GridFactory)();
110
111
112 virtual ~GridBase() {}
113
116 virtual GridBase::Ptr copyGrid(CopyPolicy treePolicy = CP_SHARE) const = 0;
117
119 virtual GridBase::Ptr deepCopyGrid() const = 0;
120
121
122 //
123 // Registry methods
124 //
126 static Ptr createGrid(const Name& type);
127
129 static bool isRegistered(const Name &type);
130
132 static void clearRegistry();
133
134
135 //
136 // Grid type methods
137 //
139 virtual Name type() const = 0;
141 virtual Name valueType() const = 0;
142
144 template<typename GridType>
145 bool isType() const { return (this->type() == GridType::gridType()); }
146
148 template<typename GridType>
151 static typename GridType::Ptr grid(const GridBase::Ptr&);
152 template<typename GridType>
153 static typename GridType::ConstPtr grid(const GridBase::ConstPtr&);
154 template<typename GridType>
155 static typename GridType::ConstPtr constGrid(const GridBase::Ptr&);
156 template<typename GridType>
157 static typename GridType::ConstPtr constGrid(const GridBase::ConstPtr&);
159
161 TreeBase::Ptr baseTreePtr();
164 TreeBase::ConstPtr baseTreePtr() const { return this->constBaseTreePtr(); }
165 virtual TreeBase::ConstPtr constBaseTreePtr() const = 0;
167
169 TreeBase& baseTree() { return const_cast<TreeBase&>(this->constBaseTree()); }
174 const TreeBase& baseTree() const { return this->constBaseTree(); }
175 const TreeBase& constBaseTree() const { return *(this->constBaseTreePtr()); }
177
183 virtual void setTree(TreeBase::Ptr) = 0;
184
186 virtual void newTree() = 0;
187
189 virtual bool empty() const = 0;
191 virtual void clear() = 0;
192
198 virtual void pruneGrid(float tolerance = 0.0) = 0;
199
200 #ifndef OPENVDB_2_ABI_COMPATIBLE
201 void clipGrid(const BBoxd&);
206
211 virtual void clip(const CoordBBox&) = 0;
212 #endif
213
214
215 //
216 // Metadata
217 //
219 std::string getName() const;
221 void setName(const std::string&);
222
224 std::string getCreator() const;
226 void setCreator(const std::string&);
227
230 bool saveFloatAsHalf() const;
231 void setSaveFloatAsHalf(bool);
232
234 GridClass getGridClass() const;
236 void setGridClass(GridClass);
238 void clearGridClass();
239
241 static std::string gridClassToString(GridClass);
243 static std::string gridClassToMenuName(GridClass);
247 static GridClass stringToGridClass(const std::string&);
248
251 VecType getVectorType() const;
254 void setVectorType(VecType);
256 void clearVectorType();
257
259 static std::string vecTypeToString(VecType);
262 static std::string vecTypeExamples(VecType);
265 static std::string vecTypeDescription(VecType);
266 static VecType stringToVecType(const std::string&);
267
271 bool isInWorldSpace() const;
273 void setIsInWorldSpace(bool);
274
275 // Standard metadata field names
276 // (These fields should normally not be accessed directly, but rather
277 // via the accessor methods above, when available.)
278 // Note: Visual C++ requires these declarations to be separate statements.
279 static const char* const META_GRID_CLASS;
280 static const char* const META_GRID_CREATOR;
281 static const char* const META_GRID_NAME;
282 static const char* const META_SAVE_HALF_FLOAT;
283 static const char* const META_IS_LOCAL_SPACE;
284 static const char* const META_VECTOR_TYPE;
285 static const char* const META_FILE_BBOX_MIN;
286 static const char* const META_FILE_BBOX_MAX;
287 static const char* const META_FILE_COMPRESSION;
288 static const char* const META_FILE_MEM_BYTES;
289 static const char* const META_FILE_VOXEL_COUNT;
290
291
292 //
293 // Statistics
294 //
296 virtual Index64 activeVoxelCount() const = 0;
297
300 virtual CoordBBox evalActiveVoxelBoundingBox() const = 0;
301
303 virtual Coord evalActiveVoxelDim() const = 0;
304
306 virtual Index64 memUsage() const = 0;
307
312 void addStatsMetadata();
317 MetaMap::Ptr getStatsMetadata() const;
318
319
320 //
321 // Transform methods
322 //
324 math::Transform::Ptr transformPtr() { return mTransform; }
327 math::Transform::ConstPtr transformPtr() const { return mTransform; }
328 math::Transform::ConstPtr constTransformPtr() const { return mTransform; }
330
331 math::Transform& transform() { return *mTransform; }
336 const math::Transform& transform() const { return *mTransform; }
337 const math::Transform& constTransform() const { return *mTransform; }
339 void setTransform(math::Transform::Ptr);
345
347 Vec3d voxelSize() const { return transform().voxelSize(); }
350 Vec3d voxelSize(const Vec3d& xyz) const { return transform().voxelSize(xyz); }
352 bool hasUniformVoxels() const { return mTransform->hasUniformScale(); }
354 Vec3d indexToWorld(const Vec3d& xyz) const { return transform().indexToWorld(xyz); }
356 Vec3d indexToWorld(const Coord& ijk) const { return transform().indexToWorld(ijk); }
358 Vec3d worldToIndex(const Vec3d& xyz) const { return transform().worldToIndex(xyz); }
360
361
362 //
363 // I/O methods
364 //
367 virtual void readTopology(std::istream&) = 0;
370 virtual void writeTopology(std::ostream&) const = 0;
371
373 virtual void readBuffers(std::istream&) = 0;
374 #ifndef OPENVDB_2_ABI_COMPATIBLE
375 virtual void readBuffers(std::istream&, const CoordBBox&) = 0;
382 virtual void readNonresidentBuffers() const = 0;
383 #endif
384 virtual void writeBuffers(std::ostream&) const = 0;
386
388 void readTransform(std::istream& is) { transform().read(is); }
390 void writeTransform(std::ostream& os) const { transform().write(os); }
391
393 virtual void print(std::ostream& = std::cout, int verboseLevel = 1) const = 0;
394
395
396 protected:
398 GridBase(): mTransform(math::Transform::createLinearTransform()) {}
399
401 GridBase(const GridBase& other): MetaMap(other), mTransform(other.mTransform->copy()) {}
402
404 GridBase(const GridBase& other, ShallowCopy): MetaMap(other), mTransform(other.mTransform) {}
405
407 static void registerGrid(const Name& type, GridFactory);
409 static void unregisterGrid(const Name& type);
410
411
412 private:
413 math::Transform::Ptr mTransform;
414 }; // class GridBase
415
416
418
419
420 typedef std::vector<GridBase::Ptr> GridPtrVec;
421 typedef GridPtrVec::iterator GridPtrVecIter;
422 typedef GridPtrVec::const_iterator GridPtrVecCIter;
423 typedef boost::shared_ptr<GridPtrVec> GridPtrVecPtr;
424
425 typedef std::vector<GridBase::ConstPtr> GridCPtrVec;
426 typedef GridCPtrVec::iterator GridCPtrVecIter;
427 typedef GridCPtrVec::const_iterator GridCPtrVecCIter;
428 typedef boost::shared_ptr<GridCPtrVec> GridCPtrVecPtr;
429
430 typedef std::set<GridBase::Ptr> GridPtrSet;
431 typedef GridPtrSet::iterator GridPtrSetIter;
432 typedef GridPtrSet::const_iterator GridPtrSetCIter;
433 typedef boost::shared_ptr<GridPtrSet> GridPtrSetPtr;
434
435 typedef std::set<GridBase::ConstPtr> GridCPtrSet;
436 typedef GridCPtrSet::iterator GridCPtrSetIter;
437 typedef GridCPtrSet::const_iterator GridCPtrSetCIter;
438 typedef boost::shared_ptr<GridCPtrSet> GridCPtrSetPtr;
439
440
442 struct OPENVDB_API GridNamePred
443 {
444 GridNamePred(const Name& _name): name(_name) {}
445 bool operator()(const GridBase::ConstPtr& g) const { return g && g->getName() == name; }
446 Name name;
447 };
448
450 template<typename GridPtrContainerT>
451 inline typename GridPtrContainerT::value_type
452 findGridByName(const GridPtrContainerT& container, const Name& name)
453 {
454 typedef typename GridPtrContainerT::value_type GridPtrT;
455 typename GridPtrContainerT::const_iterator it =
456 std::find_if(container.begin(), container.end(), GridNamePred(name));
457 return (it == container.end() ? GridPtrT() : *it);
458 }
459
461 template<typename KeyT, typename GridPtrT>
462 inline GridPtrT
463 findGridByName(const std::map<KeyT, GridPtrT>& container, const Name& name)
464 {
465 typedef std::map<KeyT, GridPtrT> GridPtrMapT;
466 for (typename GridPtrMapT::const_iterator it = container.begin(), end = container.end();
467 it != end; ++it)
468 {
469 const GridPtrT& grid = it->second;
470 if (grid && grid->getName() == name) return grid;
471 }
472 return GridPtrT();
473 }
475
476
478
479
481 template<typename _TreeType>
482 class Grid: public GridBase
483 {
484 public:
485 typedef boost::shared_ptr<Grid> Ptr;
486 typedef boost::shared_ptr<const Grid> ConstPtr;
487
488 typedef _TreeType TreeType;
489 typedef typename _TreeType::Ptr TreePtrType;
490 typedef typename _TreeType::ConstPtr ConstTreePtrType;
491 typedef typename _TreeType::ValueType ValueType;
492 typedef typename _TreeType::BuildType BuildType;
493
494 typedef typename _TreeType::ValueOnIter ValueOnIter;
495 typedef typename _TreeType::ValueOnCIter ValueOnCIter;
496 typedef typename _TreeType::ValueOffIter ValueOffIter;
497 typedef typename _TreeType::ValueOffCIter ValueOffCIter;
498 typedef typename _TreeType::ValueAllIter ValueAllIter;
499 typedef typename _TreeType::ValueAllCIter ValueAllCIter;
500
501 typedef typename tree::ValueAccessor<_TreeType, true> Accessor;
502 typedef typename tree::ValueAccessor<const _TreeType, true> ConstAccessor;
503 typedef typename tree::ValueAccessor<_TreeType, false> UnsafeAccessor;
504 typedef typename tree::ValueAccessor<const _TreeType, false> ConstUnsafeAccessor;
505
512 template<typename OtherValueType>
513 struct ValueConverter {
514 typedef Grid<typename TreeType::template ValueConverter<OtherValueType>::Type> Type;
515 };
516
518 static Ptr create(const ValueType& background);
520 static Ptr create();
523 static Ptr create(TreePtrType);
526 static Ptr create(const GridBase& other);
527
528
530 Grid();
532 explicit Grid(const ValueType& background);
536 explicit Grid(TreePtrType);
538 Grid(const Grid&);
544 template<typename OtherTreeType>
545 explicit Grid(const Grid<OtherTreeType>&);
547 Grid(const Grid&, ShallowCopy);
550 explicit Grid(const GridBase&);
551
552 virtual ~Grid() {}
553
555 Ptr copy(CopyPolicy treePolicy = CP_SHARE) const;
561 virtual GridBase::Ptr copyGrid(CopyPolicy treePolicy = CP_SHARE) const;
563
564 Ptr deepCopy() const { return Ptr(new Grid(*this)); }
566 virtual GridBase::Ptr deepCopyGrid() const { return this->deepCopy(); }
568
570 virtual Name type() const { return this->gridType(); }
572 static Name gridType() { return TreeType::treeType(); }
573
574
575 //
576 // Voxel access methods
577 //
579 virtual Name valueType() const { return tree().valueType(); }
580
584 const ValueType& background() const { return mTree->background(); }
585
587 virtual bool empty() const { return tree().empty(); }
589 virtual void clear() { tree().clear(); }
590
594 Accessor getAccessor() { return Accessor(tree()); }
603 UnsafeAccessor getUnsafeAccessor() { return UnsafeAccessor(tree()); }
605 ConstAccessor getAccessor() const { return ConstAccessor(tree()); }
607 ConstAccessor getConstAccessor() const { return ConstAccessor(tree()); }
609 ConstUnsafeAccessor getConstUnsafeAccessor() const { return ConstUnsafeAccessor(tree()); }
618
620 ValueOnIter beginValueOn() { return tree().beginValueOn(); }
622 ValueOnCIter beginValueOn() const { return tree().cbeginValueOn(); }
623 ValueOnCIter cbeginValueOn() const { return tree().cbeginValueOn(); }
625
626 ValueOffIter beginValueOff() { return tree().beginValueOff(); }
628 ValueOffCIter beginValueOff() const { return tree().cbeginValueOff(); }
629 ValueOffCIter cbeginValueOff() const { return tree().cbeginValueOff(); }
631
632 ValueAllIter beginValueAll() { return tree().beginValueAll(); }
634 ValueAllCIter beginValueAll() const { return tree().cbeginValueAll(); }
635 ValueAllCIter cbeginValueAll() const { return tree().cbeginValueAll(); }
637
639 void evalMinMax(ValueType& minVal, ValueType& maxVal) const;
640
642 void sparseFill(const CoordBBox& bbox, const ValueType& value, bool active = true);
651 void fill(const CoordBBox& bbox, const ValueType& value, bool active = true)
652 {
653 this->sparseFill(bbox, value, active);
654 }
656
666 void denseFill(const CoordBBox& bbox, const ValueType& value, bool active = true);
667
669 virtual void pruneGrid(float tolerance = 0.0);
670
671 #ifndef OPENVDB_2_ABI_COMPATIBLE
672 virtual void clip(const CoordBBox&);
677 #endif
678
684 void merge(Grid& other, MergePolicy policy = MERGE_ACTIVE_STATES);
685
699 template<typename OtherTreeType>
700 void topologyUnion(const Grid<OtherTreeType>& other);
701
714 template<typename OtherTreeType>
715 void topologyIntersection(const Grid<OtherTreeType>& other);
716
727 template<typename OtherTreeType>
728 void topologyDifference(const Grid<OtherTreeType>& other);
729
730 //
731 // Statistics
732 //
734 virtual Index64 activeVoxelCount() const { return tree().activeVoxelCount(); }
736 virtual CoordBBox evalActiveVoxelBoundingBox() const;
738 virtual Coord evalActiveVoxelDim() const;
739
742 virtual Index64 memUsage() const { return tree().memUsage(); }
743
744
745 //
746 // Tree methods
747 //
749 TreePtrType treePtr() { return mTree; }
752 ConstTreePtrType treePtr() const { return mTree; }
753 ConstTreePtrType constTreePtr() const { return mTree; }
754 virtual TreeBase::ConstPtr constBaseTreePtr() const { return mTree; }
756
757 TreeType& tree() { return *mTree; }
762 const TreeType& tree() const { return *mTree; }
763 const TreeType& constTree() const { return *mTree; }
765
771 virtual void setTree(TreeBase::Ptr);
772
775 virtual void newTree();
776
777
778 //
779 // I/O methods
780 //
783 virtual void readTopology(std::istream&);
786 virtual void writeTopology(std::ostream&) const;
787
789 virtual void readBuffers(std::istream&);
790 #ifndef OPENVDB_2_ABI_COMPATIBLE
791 virtual void readBuffers(std::istream&, const CoordBBox&);
798 virtual void readNonresidentBuffers() const;
799 #endif
800 virtual void writeBuffers(std::ostream&) const;
802
804 virtual void print(std::ostream& = std::cout, int verboseLevel = 1) const;
805
806
807 //
808 // Registry methods
809 //
811 static bool isRegistered() { return GridBase::isRegistered(Grid::gridType()); }
813 static void registerGrid() { GridBase::registerGrid(Grid::gridType(), Grid::factory); }
815 static void unregisterGrid() { GridBase::unregisterGrid(Grid::gridType()); }
816
817
818 private:
820 Grid& operator=(const Grid& other);
821
823 static GridBase::Ptr factory() { return Grid::create(); }
824
825 TreePtrType mTree;
826 }; // class Grid
827
828
830
831
839 template<typename GridType>
840 inline typename GridType::Ptr
841 gridPtrCast(const GridBase::Ptr& grid)
842 {
843 return GridBase::grid<GridType>(grid);
844 }
845
846
855 template<typename GridType>
856 inline typename GridType::ConstPtr
857 gridConstPtrCast(const GridBase::ConstPtr& grid)
858 {
859 return GridBase::constGrid<GridType>(grid);
860 }
861
862
864
865
872 template<typename GridType>
873 inline typename GridType::Ptr
874 deepCopyTypedGrid(const GridBase::ConstPtr& grid)
875 {
876 if (!grid || !grid->isType<GridType>()) return typename GridType::Ptr();
877 return gridPtrCast<GridType>(grid->deepCopyGrid());
878 }
879
880
881 template<typename GridType>
882 inline typename GridType::Ptr
883 deepCopyTypedGrid(const GridBase& grid)
884 {
885 if (!grid.isType<GridType>()) return typename GridType::Ptr();
886 return gridPtrCast<GridType>(grid.deepCopyGrid());
887 }
889
890
892
893
895 template<typename _TreeType>
898 struct TreeAdapter
899 {
900 typedef _TreeType TreeType;
901 typedef typename boost::remove_const<TreeType>::type NonConstTreeType;
902 typedef typename TreeType::Ptr TreePtrType;
903 typedef typename TreeType::ConstPtr ConstTreePtrType;
904 typedef typename NonConstTreeType::Ptr NonConstTreePtrType;
905 typedef Grid<TreeType> GridType;
906 typedef Grid<NonConstTreeType> NonConstGridType;
907 typedef typename GridType::Ptr GridPtrType;
908 typedef typename NonConstGridType::Ptr NonConstGridPtrType;
909 typedef typename GridType::ConstPtr ConstGridPtrType;
910 typedef typename TreeType::ValueType ValueType;
911 typedef typename tree::ValueAccessor<TreeType> AccessorType;
912 typedef typename tree::ValueAccessor<const TreeType> ConstAccessorType;
913 typedef typename tree::ValueAccessor<NonConstTreeType> NonConstAccessorType;
914
915 static TreeType& tree(TreeType& t) { return t; }
916 static TreeType& tree(GridType& g) { return g.tree(); }
917 static const TreeType& tree(const TreeType& t) { return t; }
918 static const TreeType& tree(const GridType& g) { return g.tree(); }
919 static const TreeType& constTree(TreeType& t) { return t; }
920 static const TreeType& constTree(GridType& g) { return g.constTree(); }
921 static const TreeType& constTree(const TreeType& t) { return t; }
922 static const TreeType& constTree(const GridType& g) { return g.constTree(); }
923 };
924
925
927 template<typename _TreeType>
928 struct TreeAdapter<Grid<_TreeType> >
929 {
930 typedef _TreeType TreeType;
931 typedef typename boost::remove_const<TreeType>::type NonConstTreeType;
932 typedef typename TreeType::Ptr TreePtrType;
933 typedef typename TreeType::ConstPtr ConstTreePtrType;
934 typedef typename NonConstTreeType::Ptr NonConstTreePtrType;
935 typedef Grid<TreeType> GridType;
936 typedef Grid<NonConstTreeType> NonConstGridType;
937 typedef typename GridType::Ptr GridPtrType;
938 typedef typename NonConstGridType::Ptr NonConstGridPtrType;
939 typedef typename GridType::ConstPtr ConstGridPtrType;
940 typedef typename TreeType::ValueType ValueType;
941 typedef typename tree::ValueAccessor<TreeType> AccessorType;
942 typedef typename tree::ValueAccessor<const TreeType> ConstAccessorType;
943 typedef typename tree::ValueAccessor<NonConstTreeType> NonConstAccessorType;
944
945 static TreeType& tree(TreeType& t) { return t; }
946 static TreeType& tree(GridType& g) { return g.tree(); }
947 static const TreeType& tree(const TreeType& t) { return t; }
948 static const TreeType& tree(const GridType& g) { return g.tree(); }
949 static const TreeType& constTree(TreeType& t) { return t; }
950 static const TreeType& constTree(GridType& g) { return g.constTree(); }
951 static const TreeType& constTree(const TreeType& t) { return t; }
952 static const TreeType& constTree(const GridType& g) { return g.constTree(); }
953 };
954
956 template<typename _TreeType>
957 struct TreeAdapter<tree::ValueAccessor<_TreeType> >
958 {
959 typedef _TreeType TreeType;
960 typedef typename boost::remove_const<TreeType>::type NonConstTreeType;
961 typedef typename TreeType::Ptr TreePtrType;
962 typedef typename TreeType::ConstPtr ConstTreePtrType;
963 typedef typename NonConstTreeType::Ptr NonConstTreePtrType;
964 typedef Grid<TreeType> GridType;
965 typedef Grid<NonConstTreeType> NonConstGridType;
966 typedef typename GridType::Ptr GridPtrType;
967 typedef typename NonConstGridType::Ptr NonConstGridPtrType;
968 typedef typename GridType::ConstPtr ConstGridPtrType;
969 typedef typename TreeType::ValueType ValueType;
970 typedef typename tree::ValueAccessor<TreeType> AccessorType;
971 typedef typename tree::ValueAccessor<const TreeType> ConstAccessorType;
972 typedef typename tree::ValueAccessor<NonConstTreeType> NonConstAccessorType;
973
974 static TreeType& tree(TreeType& t) { return t; }
975 static TreeType& tree(GridType& g) { return g.tree(); }
976 static TreeType& tree(AccessorType& a) { return a.tree(); }
977 static const TreeType& tree(const TreeType& t) { return t; }
978 static const TreeType& tree(const GridType& g) { return g.tree(); }
979 static const TreeType& tree(const AccessorType& a) { return a.tree(); }
980 static const TreeType& constTree(TreeType& t) { return t; }
981 static const TreeType& constTree(GridType& g) { return g.constTree(); }
982 static const TreeType& constTree(const TreeType& t) { return t; }
983 static const TreeType& constTree(const GridType& g) { return g.constTree(); }
984 };
985
987
988
990
991
992 template<typename GridType>
993 inline typename GridType::Ptr
994 GridBase::grid(const GridBase::Ptr& grid)
995 {
996 // The string comparison on type names is slower than a dynamic_pointer_cast, but
997 // it is safer when pointers cross dso boundaries, as they do in many Houdini nodes.
998 if (grid && grid->type() == GridType::gridType()) {
999 return boost::static_pointer_cast<GridType>(grid);
1000 }
1001 return typename GridType::Ptr();
1002 }
1003
1004
1005 template<typename GridType>
1006 inline typename GridType::ConstPtr
1007 GridBase::grid(const GridBase::ConstPtr& grid)
1008 {
1009 return boost::const_pointer_cast<const GridType>(
1010 GridBase::grid<GridType>(boost::const_pointer_cast<GridBase>(grid)));
1011 }
1012
1013
1014 template<typename GridType>
1015 inline typename GridType::ConstPtr
1016 GridBase::constGrid(const GridBase::Ptr& grid)
1017 {
1018 return boost::const_pointer_cast<const GridType>(GridBase::grid<GridType>(grid));
1019 }
1020
1021
1022 template<typename GridType>
1023 inline typename GridType::ConstPtr
1024 GridBase::constGrid(const GridBase::ConstPtr& grid)
1025 {
1026 return boost::const_pointer_cast<const GridType>(
1027 GridBase::grid<GridType>(boost::const_pointer_cast<GridBase>(grid)));
1028 }
1029
1030
1031 inline TreeBase::Ptr
1032 GridBase::baseTreePtr()
1033 {
1034 return boost::const_pointer_cast<TreeBase>(this->constBaseTreePtr());
1035 }
1036
1037
1038 inline void
1039 GridBase::setTransform(math::Transform::Ptr xform)
1040 {
1041 if (!xform) OPENVDB_THROW(ValueError, "Transform pointer is null");
1042 mTransform = xform;
1043 }
1044
1045
1047
1048
1049 template<typename TreeT>
1050 inline Grid<TreeT>::Grid(): mTree(new TreeType)
1051 {
1052 }
1053
1054
1055 template<typename TreeT>
1056 inline Grid<TreeT>::Grid(const ValueType &background): mTree(new TreeType(background))
1057 {
1058 }
1059
1060
1061 template<typename TreeT>
1062 inline Grid<TreeT>::Grid(TreePtrType tree): mTree(tree)
1063 {
1064 if (!tree) OPENVDB_THROW(ValueError, "Tree pointer is null");
1065 }
1066
1067
1068 template<typename TreeT>
1069 inline Grid<TreeT>::Grid(const Grid& other):
1070 GridBase(other),
1071 mTree(boost::static_pointer_cast<TreeType>(other.mTree->copy()))
1072 {
1073 }
1074
1075
1076 template<typename TreeT>
1077 template<typename OtherTreeType>
1078 inline Grid<TreeT>::Grid(const Grid<OtherTreeType>& other):
1079 GridBase(other),
1080 mTree(new TreeType(other.constTree()))
1081 {
1082 }
1083
1084
1085 template<typename TreeT>
1086 inline Grid<TreeT>::Grid(const Grid& other, ShallowCopy):
1087 GridBase(other, ShallowCopy()),
1088 mTree(other.mTree)
1089 {
1090 }
1091
1092
1093 template<typename TreeT>
1094 inline Grid<TreeT>::Grid(const GridBase& other):
1095 GridBase(other),
1096 mTree(new TreeType)
1097 {
1098 }
1099
1100
1101 //static
1102 template<typename TreeT>
1103 inline typename Grid<TreeT>::Ptr
1104 Grid<TreeT>::create()
1105 {
1106 return Grid::create(zeroVal<ValueType>());
1107 }
1108
1109
1110 //static
1111 template<typename TreeT>
1112 inline typename Grid<TreeT>::Ptr
1113 Grid<TreeT>::create(const ValueType& background)
1114 {
1115 return Ptr(new Grid(background));
1116 }
1117
1118
1119 //static
1120 template<typename TreeT>
1121 inline typename Grid<TreeT>::Ptr
1122 Grid<TreeT>::create(TreePtrType tree)
1123 {
1124 return Ptr(new Grid(tree));
1125 }
1126
1127
1128 //static
1129 template<typename TreeT>
1130 inline typename Grid<TreeT>::Ptr
1131 Grid<TreeT>::create(const GridBase& other)
1132 {
1133 return Ptr(new Grid(other));
1134 }
1135
1136
1138
1139
1140 template<typename TreeT>
1141 inline typename Grid<TreeT>::Ptr
1142 Grid<TreeT>::copy(CopyPolicy treePolicy) const
1143 {
1144 Ptr ret;
1145 switch (treePolicy) {
1146 case CP_NEW:
1147 ret.reset(new Grid(*this, ShallowCopy()));
1148 ret->newTree();
1149 break;
1150 case CP_COPY:
1151 ret.reset(new Grid(*this));
1152 break;
1153 case CP_SHARE:
1154 ret.reset(new Grid(*this, ShallowCopy()));
1155 break;
1156 }
1157 return ret;
1158 }
1159
1160
1161 template<typename TreeT>
1162 inline GridBase::Ptr
1163 Grid<TreeT>::copyGrid(CopyPolicy treePolicy) const
1164 {
1165 return this->copy(treePolicy);
1166 }
1167
1168
1170
1171
1172 template<typename TreeT>
1173 inline void
1174 Grid<TreeT>::setTree(TreeBase::Ptr tree)
1175 {
1176 if (!tree) OPENVDB_THROW(ValueError, "Tree pointer is null");
1177 if (tree->type() != TreeType::treeType()) {
1178 OPENVDB_THROW(TypeError, "Cannot assign a tree of type "
1179 + tree->type() + " to a grid of type " + this->type());
1180 }
1181 mTree = boost::static_pointer_cast<TreeType>(tree);
1182 }
1183
1184
1185 template<typename TreeT>
1186 inline void
1187 Grid<TreeT>::newTree()
1188 {
1189 mTree.reset(new TreeType(this->background()));
1190 }
1191
1192
1194
1195
1196 template<typename TreeT>
1197 inline void
1198 Grid<TreeT>::sparseFill(const CoordBBox& bbox, const ValueType& value, bool active)
1199 {
1200 tree().sparseFill(bbox, value, active);
1201 }
1202
1203 template<typename TreeT>
1204 inline void
1205 Grid<TreeT>::denseFill(const CoordBBox& bbox, const ValueType& value, bool active)
1206 {
1207 tree().denseFill(bbox, value, active);
1208 }
1209
1210 template<typename TreeT>
1211 inline void
1212 Grid<TreeT>::pruneGrid(float tolerance)
1213 {
1214 this->tree().prune(ValueType(zeroVal<ValueType>() + tolerance));
1215 }
1216
1217 #ifndef OPENVDB_2_ABI_COMPATIBLE
1218 template<typename TreeT>
1219 inline void
1220 Grid<TreeT>::clip(const CoordBBox& bbox)
1221 {
1222 tree().clip(bbox);
1223 }
1224 #endif
1225
1226
1227 template<typename TreeT>
1228 inline void
1229 Grid<TreeT>::merge(Grid& other, MergePolicy policy)
1230 {
1231 tree().merge(other.tree(), policy);
1232 }
1233
1234
1235 template<typename TreeT>
1236 template<typename OtherTreeType>
1237 inline void
1238 Grid<TreeT>::topologyUnion(const Grid<OtherTreeType>& other)
1239 {
1240 tree().topologyUnion(other.tree());
1241 }
1242
1243
1244 template<typename TreeT>
1245 template<typename OtherTreeType>
1246 inline void
1247 Grid<TreeT>::topologyIntersection(const Grid<OtherTreeType>& other)
1248 {
1249 tree().topologyIntersection(other.tree());
1250 }
1251
1252
1253 template<typename TreeT>
1254 template<typename OtherTreeType>
1255 inline void
1256 Grid<TreeT>::topologyDifference(const Grid<OtherTreeType>& other)
1257 {
1258 tree().topologyDifference(other.tree());
1259 }
1260
1261
1263
1264
1265 template<typename TreeT>
1266 inline void
1267 Grid<TreeT>::evalMinMax(ValueType& minVal, ValueType& maxVal) const
1268 {
1269 tree().evalMinMax(minVal, maxVal);
1270 }
1271
1272
1273 template<typename TreeT>
1274 inline CoordBBox
1275 Grid<TreeT>::evalActiveVoxelBoundingBox() const
1276 {
1277 CoordBBox bbox;
1278 tree().evalActiveVoxelBoundingBox(bbox);
1279 return bbox;
1280 }
1281
1282
1283 template<typename TreeT>
1284 inline Coord
1285 Grid<TreeT>::evalActiveVoxelDim() const
1286 {
1287 Coord dim;
1288 const bool nonempty = tree().evalActiveVoxelDim(dim);
1289 return (nonempty ? dim : Coord());
1290 }
1291
1292
1294
1295
1298
1299 template<typename TreeT>
1300 inline void
1301 Grid<TreeT>::readTopology(std::istream& is)
1302 {
1303 tree().readTopology(is, saveFloatAsHalf());
1304 }
1305
1306
1307 template<typename TreeT>
1308 inline void
1309 Grid<TreeT>::writeTopology(std::ostream& os) const
1310 {
1311 tree().writeTopology(os, saveFloatAsHalf());
1312 }
1313
1314
1315 template<typename TreeT>
1316 inline void
1317 Grid<TreeT>::readBuffers(std::istream& is)
1318 {
1319 tree().readBuffers(is, saveFloatAsHalf());
1320 }
1321
1322
1323 #ifndef OPENVDB_2_ABI_COMPATIBLE
1324
1325 template<typename TreeT>
1326 inline void
1327 Grid<TreeT>::readBuffers(std::istream& is, const CoordBBox& bbox)
1328 {
1329 tree().readBuffers(is, bbox, saveFloatAsHalf());
1330 }
1331
1332
1333 template<typename TreeT>
1334 inline void
1335 Grid<TreeT>::readNonresidentBuffers() const
1336 {
1337 tree().readNonresidentBuffers();
1338 }
1339
1340 #endif // !OPENVDB_2_ABI_COMPATIBLE
1341
1342
1343 template<typename TreeT>
1344 inline void
1345 Grid<TreeT>::writeBuffers(std::ostream& os) const
1346 {
1347 tree().writeBuffers(os, saveFloatAsHalf());
1348 }
1349
1350
1351 template<typename TreeT>
1352 inline void
1353 Grid<TreeT>::print(std::ostream& os, int verboseLevel) const
1354 {
1355 tree().print(os, verboseLevel);
1356
1357 if (metaCount() > 0) {
1358 os << "Additional metadata:" << std::endl;
1359 for (ConstMetaIterator it = beginMeta(), end = endMeta(); it != end; ++it) {
1360 os << " " << it->first;
1361 if (it->second) {
1362 const std::string value = it->second->str();
1363 if (!value.empty()) os << ": " << value;
1364 }
1365 os << "\n";
1366 }
1367 }
1368
1369 os << "Transform:" << std::endl;
1370 transform().print(os, /*indent=*/" ");
1371 os << std::endl;
1372 }
1373
1374
1376
1377
1378 template<typename GridType>
1379 inline typename GridType::Ptr
1380 createGrid(const typename GridType::ValueType& background)
1381 {
1382 return GridType::create(background);
1383 }
1384
1385
1386 template<typename GridType>
1387 inline typename GridType::Ptr
1388 createGrid()
1389 {
1390 return GridType::create();
1391 }
1392
1393
1394 template<typename TreePtrType>
1395 inline typename Grid<typename TreePtrType::element_type>::Ptr
1396 createGrid(TreePtrType tree)
1397 {
1398 typedef typename TreePtrType::element_type TreeType;
1399 return Grid<TreeType>::create(tree);
1400 }
1401
1402
1403 template<typename GridType>
1404 typename GridType::Ptr
1405 createLevelSet(Real voxelSize, Real halfWidth)
1406 {
1407 typedef typename GridType::ValueType ValueType;
1408
1409 // GridType::ValueType is required to be a floating-point scalar.
1410 BOOST_STATIC_ASSERT(boost::is_floating_point<ValueType>::value);
1411
1412 typename GridType::Ptr grid = GridType::create(
1413 /*background=*/static_cast<ValueType>(voxelSize * halfWidth));
1414 grid->setTransform(math::Transform::createLinearTransform(voxelSize));
1415 grid->setGridClass(GRID_LEVEL_SET);
1416 return grid;
1417 }
1418
1419 } // namespace OPENVDB_VERSION_NAME
1420 } // namespace openvdb
1421
1422 #endif // OPENVDB_GRID_HAS_BEEN_INCLUDED
1423
1424 // Copyright (c) 2012-2016 DreamWorks Animation LLC
1425 // All rights reserved. This software is distributed under the
1426 // Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
openvdb::v3_2_0::Grid::registerGrid
static void registerGrid()
Register this grid type along with a factory function.
Definition: Grid.h:813
openvdb::v3_2_0::GridBase::deepCopyGrid
virtual GridBase::Ptr deepCopyGrid() const =0
Return a new grid whose metadata, transform and tree are deep copies of this grid&#39;s.
openvdb::v3_2_0::GridCPtrSetPtr
boost::shared_ptr< GridCPtrSet > GridCPtrSetPtr
Definition: Grid.h:438
openvdb::v3_2_0::CP_COPY
Definition: Types.h:434
openvdb::v3_2_0::TreeAdapter< Grid< _TreeType > >::ConstGridPtrType
GridType::ConstPtr ConstGridPtrType
Definition: Grid.h:939
openvdb::v3_2_0::GridCPtrVecIter
GridCPtrVec::iterator GridCPtrVecIter
Definition: Grid.h:426
openvdb::v3_2_0::tree::TreeBase
Base class for typed trees.
Definition: Tree.h:65
openvdb::v3_2_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::AccessorType
tree::ValueAccessor< TreeType > AccessorType
Definition: Grid.h:970
openvdb::v3_2_0::ShallowCopy
Definition: Types.h:439
openvdb::v3_2_0::TreeAdapter< Grid< _TreeType > >::tree
static const TreeType & tree(const GridType &g)
Definition: Grid.h:948
openvdb::v3_2_0::Grid::readNonresidentBuffers
virtual void readNonresidentBuffers() const
Read all of this grid&#39;s data buffers that are not yet resident in memory (because delayed loading is ...
Definition: Grid.h:1335
openvdb::v3_2_0::Grid::getAccessor
Accessor getAccessor()
Return an accessor that provides random read and write access to this grid&#39;s voxels. The accessor is safe in the sense that it is registered by the tree of this grid.
Definition: Grid.h:594
openvdb::v3_2_0::Grid::clear
virtual void clear()
Empty this grid, so that all voxels become inactive background voxels.
Definition: Grid.h:589
openvdb::v3_2_0::Grid::ValueConverter::Type
Grid< typename TreeType::template ValueConverter< OtherValueType >::Type > Type
Definition: Grid.h:514
openvdb::v3_2_0::GridBase::META_GRID_NAME
static const char *const META_GRID_NAME
Definition: Grid.h:281
openvdb::v3_2_0::TreeAdapter::TreePtrType
TreeType::Ptr TreePtrType
Definition: Grid.h:902
OPENVDB_API
#define OPENVDB_API
Helper macros for defining library symbol visibility.
Definition: Platform.h:195
openvdb::v3_2_0::GridClass
GridClass
Definition: Types.h:211
openvdb::v3_2_0::Grid::tree
const TreeType & tree() const
Return a reference to this grid&#39;s tree, which might be shared with other grids.
Definition: Grid.h:762
openvdb::v3_2_0::Grid::readTopology
virtual void readTopology(std::istream &)
Read the grid topology from a stream. This will read only the grid structure, not the actual data buf...
Definition: Grid.h:1301
openvdb::v3_2_0::Grid::valueType
virtual Name valueType() const
Return the name of the type of a voxel&#39;s value (e.g., "float" or "vec3d").
Definition: Grid.h:579
openvdb::v3_2_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::tree
static TreeType & tree(GridType &g)
Definition: Grid.h:975
openvdb::v3_2_0::TreeAdapter< Grid< _TreeType > >::ValueType
TreeType::ValueType ValueType
Definition: Grid.h:940
openvdb::v3_2_0::TreeAdapter::AccessorType
tree::ValueAccessor< TreeType > AccessorType
Definition: Grid.h:911
openvdb::v3_2_0::GridBase::transformPtr
math::Transform::ConstPtr transformPtr() const
Return a pointer to this grid&#39;s transform, which might be shared with other grids.
Definition: Grid.h:327
openvdb::v3_2_0::GridBase::ConstPtr
boost::shared_ptr< const GridBase > ConstPtr
Definition: Grid.h:107
Types.h
openvdb::v3_2_0::GridBase::baseTree
const TreeBase & baseTree() const
Return a reference to this grid&#39;s tree, which might be shared with other grids.
Definition: Grid.h:174
openvdb::v3_2_0::Grid::beginValueAll
ValueAllCIter beginValueAll() const
Return an iterator over all of this grid&#39;s values (tile and voxel).
Definition: Grid.h:634
openvdb::v3_2_0::TreeAdapter< Grid< _TreeType > >::AccessorType
tree::ValueAccessor< TreeType > AccessorType
Definition: Grid.h:941
openvdb::v3_2_0::math::Transform::createLinearTransform
static Transform::Ptr createLinearTransform(double voxelSize=1.0)
Create and return a shared pointer to a new transform.
openvdb::v3_2_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::constTree
static const TreeType & constTree(GridType &g)
Definition: Grid.h:981
openvdb::v3_2_0::GridBase
Abstract base class for typed grids.
Definition: Grid.h:103
openvdb::v3_2_0::TreeAdapter< Grid< _TreeType > >::constTree
static const TreeType & constTree(TreeType &t)
Definition: Grid.h:949
openvdb::v3_2_0::GridPtrVec
std::vector< GridBase::Ptr > GridPtrVec
Definition: Grid.h:420
openvdb::v3_2_0::Grid::TreeType
_TreeType TreeType
Definition: Grid.h:488
openvdb::v3_2_0::Grid::BuildType
_TreeType::BuildType BuildType
Definition: Grid.h:492
openvdb::v3_2_0::GridBase::unregisterGrid
static void unregisterGrid(const Name &type)
Remove a grid type from the registry.
MetaMap.h
openvdb::v3_2_0::TreeAdapter::NonConstTreeType
boost::remove_const< TreeType >::type NonConstTreeType
Definition: Grid.h:901
openvdb::v3_2_0::TreeAdapter< Grid< _TreeType > >::ConstTreePtrType
TreeType::ConstPtr ConstTreePtrType
Definition: Grid.h:933
openvdb::v3_2_0::Grid::getUnsafeAccessor
UnsafeAccessor getUnsafeAccessor()
Return an accessor that provides random read and write access to this grid&#39;s voxels. The accessor is unsafe in the sense that it is not registered by the tree of this grid. In some rare cases this can give a performance advantage over a registered accessor but it is unsafe if the tree topology is modified.
Definition: Grid.h:603
openvdb::v3_2_0::Grid::topologyIntersection
void topologyIntersection(const Grid< OtherTreeType > &other)
Intersect this grid&#39;s set of active values with the active values of the other grid, whose value type may be different.
Definition: Grid.h:1247
openvdb::v3_2_0::GridBase::isType
bool isType() const
Return true if this grid is of the same type as the template parameter.
Definition: Grid.h:145
openvdb::v3_2_0::GridCPtrVec
std::vector< GridBase::ConstPtr > GridCPtrVec
Definition: Grid.h:425
openvdb::v3_2_0::tree::TreeBase::ConstPtr
boost::shared_ptr< const TreeBase > ConstPtr
Definition: Tree.h:69
openvdb::v3_2_0::gridPtrCast
GridType::Ptr gridPtrCast(const GridBase::Ptr &grid)
Cast a generic grid pointer to a pointer to a grid of a concrete class.
Definition: Grid.h:841
openvdb::v3_2_0::TreeAdapter::GridPtrType
GridType::Ptr GridPtrType
Definition: Grid.h:907
openvdb::v3_2_0::MetaMap::ConstMetaIterator
MetadataMap::const_iterator ConstMetaIterator
Definition: MetaMap.h:54
openvdb::v3_2_0::GridBase::constBaseTree
const TreeBase & constBaseTree() const
Return a reference to this grid&#39;s tree, which might be shared with other grids.
Definition: Grid.h:175
openvdb::v3_2_0::Grid::constTree
const TreeType & constTree() const
Return a reference to this grid&#39;s tree, which might be shared with other grids.
Definition: Grid.h:763
openvdb::v3_2_0::GridBase::isRegistered
static bool isRegistered(const Name &type)
Return true if the given grid type name is registered.
openvdb::v3_2_0::io::getGridClass
OPENVDB_API uint32_t getGridClass(std::ios_base &)
Return the class (GRID_LEVEL_SET, GRID_UNKNOWN, etc.) of the grid currently being read from or writte...
openvdb::v3_2_0::GridPtrSetCIter
GridPtrSet::const_iterator GridPtrSetCIter
Definition: Grid.h:432
openvdb::v3_2_0::VecType
VecType
Definition: Types.h:241
openvdb::v3_2_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::NonConstTreePtrType
NonConstTreeType::Ptr NonConstTreePtrType
Definition: Grid.h:963
openvdb::v3_2_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::ValueType
TreeType::ValueType ValueType
Definition: Grid.h:969
OPENVDB_THROW
#define OPENVDB_THROW(exception, message)
Definition: Exceptions.h:97
openvdb::v3_2_0::TreeAdapter::ConstAccessorType
tree::ValueAccessor< const TreeType > ConstAccessorType
Definition: Grid.h:912
openvdb::v3_2_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::GridType
Grid< TreeType > GridType
Definition: Grid.h:964
openvdb::v3_2_0::MERGE_ACTIVE_STATES
Definition: Types.h:265
openvdb::v3_2_0::Grid::beginValueOn
ValueOnCIter beginValueOn() const
Return an iterator over all of this grid&#39;s active values (tile and voxel).
Definition: Grid.h:622
openvdb::v3_2_0::Name
std::string Name
Definition: Name.h:44
openvdb::v3_2_0::LEVEL_SET_HALF_WIDTH
static const Real LEVEL_SET_HALF_WIDTH
Definition: Types.h:219
openvdb::v3_2_0::Grid::constTreePtr
ConstTreePtrType constTreePtr() const
Return a pointer to this grid&#39;s tree, which might be shared with other grids. The pointer is guarante...
Definition: Grid.h:753
openvdb::v3_2_0::MetaMap
Container that maps names (strings) to values of arbitrary types.
Definition: MetaMap.h:46
openvdb::v3_2_0::Grid::Accessor
tree::ValueAccessor< _TreeType, true > Accessor
Definition: Grid.h:501
openvdb::v3_2_0::TreeAdapter< Grid< _TreeType > >::tree
static TreeType & tree(GridType &g)
Definition: Grid.h:946
openvdb::v3_2_0::TreeAdapter< Grid< _TreeType > >::NonConstTreePtrType
NonConstTreeType::Ptr NonConstTreePtrType
Definition: Grid.h:934
openvdb::v3_2_0::MetaMap::metaCount
size_t metaCount() const
Definition: MetaMap.h:118
openvdb::v3_2_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::TreePtrType
TreeType::Ptr TreePtrType
Definition: Grid.h:961
openvdb::v3_2_0::TreeAdapter< Grid< _TreeType > >::GridPtrType
GridType::Ptr GridPtrType
Definition: Grid.h:937
openvdb::v3_2_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::ConstGridPtrType
GridType::ConstPtr ConstGridPtrType
Definition: Grid.h:968
openvdb::v3_2_0::Grid::memUsage
virtual Index64 memUsage() const
Definition: Grid.h:742
openvdb::v3_2_0::Grid::topologyDifference
void topologyDifference(const Grid< OtherTreeType > &other)
Difference this grid&#39;s set of active values with the active values of the other grid, whose value type may be different.
Definition: Grid.h:1256
openvdb::v3_2_0::Grid::ValueOffIter
_TreeType::ValueOffIter ValueOffIter
Definition: Grid.h:496
openvdb::v3_2_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::NonConstGridType
Grid< NonConstTreeType > NonConstGridType
Definition: Grid.h:965
openvdb::v3_2_0::TreeAdapter< Grid< _TreeType > >::ConstAccessorType
tree::ValueAccessor< const TreeType > ConstAccessorType
Definition: Grid.h:942
openvdb::v3_2_0::GridPtrSetIter
GridPtrSet::iterator GridPtrSetIter
Definition: Grid.h:431
openvdb::v3_2_0::Grid::TreePtrType
_TreeType::Ptr TreePtrType
Definition: Grid.h:489
openvdb::v3_2_0::math::Coord
Signed (x, y, z) 32-bit integer coordinates.
Definition: Coord.h:47
openvdb::v3_2_0::TreeAdapter< Grid< _TreeType > >::NonConstTreeType
boost::remove_const< TreeType >::type NonConstTreeType
Definition: Grid.h:931
openvdb::v3_2_0::tree::TreeBase::Ptr
boost::shared_ptr< TreeBase > Ptr
Definition: Tree.h:68
openvdb::v3_2_0::Grid::cbeginValueOff
ValueOffCIter cbeginValueOff() const
Return an iterator over all of this grid&#39;s inactive values (tile and voxel).
Definition: Grid.h:629
openvdb::v3_2_0::Grid::deepCopyGrid
virtual GridBase::Ptr deepCopyGrid() const
Return a new grid whose metadata, transform and tree are deep copies of this grid&#39;s.
Definition: Grid.h:566
openvdb::v3_2_0::Grid::ValueOffCIter
_TreeType::ValueOffCIter ValueOffCIter
Definition: Grid.h:497
openvdb::v3_2_0::Grid::ValueConverter
ValueConverter<T>::Type is the type of a grid having the same hierarchy as this grid but a different ...
Definition: Grid.h:513
openvdb::v3_2_0::TreeAdapter::ConstGridPtrType
GridType::ConstPtr ConstGridPtrType
Definition: Grid.h:909
openvdb::v3_2_0::GridNamePred::name
Name name
Definition: Grid.h:446
Transform.h
openvdb::v3_2_0::GridPtrVecPtr
boost::shared_ptr< GridPtrVec > GridPtrVecPtr
Definition: Grid.h:423
openvdb::v3_2_0::Grid::merge
void merge(Grid &other, MergePolicy policy=MERGE_ACTIVE_STATES)
Efficiently merge another grid into this grid using one of several schemes.
Definition: Grid.h:1229
openvdb::v3_2_0::math::BBox< Vec3d >
openvdb::v3_2_0::TreeAdapter< Grid< _TreeType > >::tree
static TreeType & tree(TreeType &t)
Definition: Grid.h:945
openvdb::v3_2_0::TreeAdapter::GridType
Grid< TreeType > GridType
Definition: Grid.h:905
openvdb::v3_2_0::GridBase::readTransform
void readTransform(std::istream &is)
Read in the transform for this grid.
Definition: Grid.h:388
openvdb::v3_2_0::GridBase::hasUniformVoxels
bool hasUniformVoxels() const
Return true if the voxels in world space are uniformly sized cubes.
Definition: Grid.h:352
openvdb::v3_2_0::TreeAdapter::tree
static const TreeType & tree(const TreeType &t)
Definition: Grid.h:917
openvdb::v3_2_0::Grid::getConstAccessor
ConstAccessor getConstAccessor() const
Return an accessor that provides random read-only access to this grid&#39;s voxels.
Definition: Grid.h:607
openvdb::v3_2_0::Grid::Ptr
boost::shared_ptr< Grid > Ptr
Definition: Grid.h:485
openvdb::v3_2_0::GridBase::registerGrid
static void registerGrid(const Name &type, GridFactory)
Register a grid type along with a factory function.
openvdb::v3_2_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::constTree
static const TreeType & constTree(const GridType &g)
Definition: Grid.h:983
openvdb::v3_2_0::Grid::background
const ValueType & background() const
Return this grid&#39;s background value.
Definition: Grid.h:584
openvdb::v3_2_0::GridPtrSetPtr
boost::shared_ptr< GridPtrSet > GridPtrSetPtr
Definition: Grid.h:433
Tree.h
openvdb::v3_2_0::tree::ValueAccessor
Definition: ValueAccessor.h:219
openvdb::v3_2_0::math::Transform::ConstPtr
boost::shared_ptr< const Transform > ConstPtr
Definition: Transform.h:70
openvdb::v3_2_0::TreeAdapter< Grid< _TreeType > >::constTree
static const TreeType & constTree(const GridType &g)
Definition: Grid.h:952
openvdb::v3_2_0::GridBase::transform
math::Transform & transform()
Return a reference to this grid&#39;s transform, which might be shared with other grids.
Definition: Grid.h:335
openvdb::v3_2_0::Grid::ConstUnsafeAccessor
tree::ValueAccessor< const _TreeType, false > ConstUnsafeAccessor
Definition: Grid.h:504
openvdb::v3_2_0::GridBase::META_FILE_MEM_BYTES
static const char *const META_FILE_MEM_BYTES
Definition: Grid.h:288
openvdb::v3_2_0::Grid::tree
TreeType & tree()
Return a reference to this grid&#39;s tree, which might be shared with other grids.
Definition: Grid.h:761
openvdb::v3_2_0::Grid::evalActiveVoxelBoundingBox
virtual CoordBBox evalActiveVoxelBoundingBox() const
Return the axis-aligned bounding box of all active voxels.
Definition: Grid.h:1275
openvdb::v3_2_0::MetaMap::beginMeta
MetaIterator beginMeta()
Definition: MetaMap.h:111
openvdb::v3_2_0::Real
double Real
Definition: Types.h:64
openvdb::v3_2_0::GridBase::GridBase
GridBase()
Initialize with an identity linear transform.
Definition: Grid.h:398
openvdb::v3_2_0::Grid::setTree
virtual void setTree(TreeBase::Ptr)
Associate the given tree with this grid, in place of its existing tree.
Definition: Grid.h:1174
openvdb::v3_2_0::TreeAdapter::constTree
static const TreeType & constTree(const TreeType &t)
Definition: Grid.h:921
openvdb::v3_2_0::GridBase::META_FILE_BBOX_MAX
static const char *const META_FILE_BBOX_MAX
Definition: Grid.h:286
openvdb::v3_2_0::Grid::denseFill
void denseFill(const CoordBBox &bbox, const ValueType &value, bool active=true)
Set all voxels within a given axis-aligned box to a constant value.
Definition: Grid.h:1205
openvdb::v3_2_0::GridBase::baseTreePtr
TreeBase::ConstPtr baseTreePtr() const
Return a pointer to this grid&#39;s tree, which might be shared with other grids. The pointer is guarante...
Definition: Grid.h:164
openvdb::v3_2_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::TreeType
_TreeType TreeType
Definition: Grid.h:959
openvdb::v3_2_0::Grid::Grid
Grid()
Construct a new grid with background value zero.
Definition: Grid.h:1050
openvdb::v3_2_0::TreeAdapter< Grid< _TreeType > >::TreeType
_TreeType TreeType
Definition: Grid.h:930
openvdb::v3_2_0::TreeAdapter< Grid< _TreeType > >::NonConstGridType
Grid< NonConstTreeType > NonConstGridType
Definition: Grid.h:936
openvdb::v3_2_0::Grid::ValueOnIter
_TreeType::ValueOnIter ValueOnIter
Definition: Grid.h:494
openvdb::v3_2_0::Index64
uint64_t Index64
Definition: Types.h:57
Exceptions.h
openvdb::v3_2_0::GridBase::baseTreePtr
TreeBase::Ptr baseTreePtr()
Return a pointer to this grid&#39;s tree, which might be shared with other grids. The pointer is guarante...
Definition: Grid.h:1032
openvdb::v3_2_0::Grid::create
static Ptr create()
Return a new grid with background value zero.
Definition: Grid.h:1104
OPENVDB_VERSION_NAME
#define OPENVDB_VERSION_NAME
Definition: version.h:43
openvdb::v3_2_0::TreeAdapter< Grid< _TreeType > >::NonConstAccessorType
tree::ValueAccessor< NonConstTreeType > NonConstAccessorType
Definition: Grid.h:943
openvdb::v3_2_0::math::Vec3d
Vec3< double > Vec3d
Definition: Vec3.h:651
openvdb::v3_2_0::tools::clip
OPENVDB_STATIC_SPECIALIZATION GridType::Ptr clip(const GridType &grid, const BBoxd &)
Clip the given grid against a world-space bounding box and return a new grid containing the result...
Definition: Clip.h:356
openvdb::v3_2_0::Grid::type
virtual Name type() const
Return the name of this grid&#39;s type.
Definition: Grid.h:570
openvdb::v3_2_0::Grid::writeBuffers
virtual void writeBuffers(std::ostream &) const
Write out all data buffers for this grid.
Definition: Grid.h:1345
openvdb::v3_2_0::GridCPtrSetCIter
GridCPtrSet::const_iterator GridCPtrSetCIter
Definition: Grid.h:437
openvdb::v3_2_0::TreeAdapter::tree
static TreeType & tree(GridType &g)
Definition: Grid.h:916
openvdb::v3_2_0::Grid::ValueOnCIter
_TreeType::ValueOnCIter ValueOnCIter
Definition: Grid.h:495
openvdb::v3_2_0::math::Transform
Calculate an axis-aligned bounding box in index space from a bounding sphere in world space...
Definition: Transform.h:66
openvdb::v3_2_0::Grid::print
virtual void print(std::ostream &=std::cout, int verboseLevel=1) const
Output a human-readable description of this grid.
Definition: Grid.h:1353
openvdb::v3_2_0::GridBase::saveFloatAsHalf
bool saveFloatAsHalf() const
Return true if this grid should be written out with floating-point voxel values (including components...
openvdb::v3_2_0::Grid::UnsafeAccessor
tree::ValueAccessor< _TreeType, false > UnsafeAccessor
Definition: Grid.h:503
openvdb::v3_2_0::TreeAdapter
This adapter allows code that is templated on a Tree type to accept either a Tree type or a Grid type...
Definition: Grid.h:898
openvdb::v3_2_0::TreeAdapter< Grid< _TreeType > >::TreePtrType
TreeType::Ptr TreePtrType
Definition: Grid.h:932
openvdb::v3_2_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::constTree
static const TreeType & constTree(const TreeType &t)
Definition: Grid.h:982
openvdb::v3_2_0::CopyPolicy
CopyPolicy
Definition: Types.h:434
openvdb::v3_2_0::MergePolicy
MergePolicy
Definition: Types.h:264
openvdb::v3_2_0::CP_SHARE
Definition: Types.h:434
openvdb::v3_2_0::GridBase::constTransformPtr
math::Transform::ConstPtr constTransformPtr() const
Return a pointer to this grid&#39;s transform, which might be shared with other grids.
Definition: Grid.h:328
openvdb::v3_2_0::TreeAdapter< Grid< _TreeType > >::constTree
static const TreeType & constTree(GridType &g)
Definition: Grid.h:950
openvdb::v3_2_0::GridBase::createGrid
static Ptr createGrid(const Name &type)
Create a new grid of the given (registered) type.
openvdb::v3_2_0::GridBase::voxelSize
Vec3d voxelSize() const
Return the size of this grid&#39;s voxels.
Definition: Grid.h:347
openvdb
Definition: Exceptions.h:39
openvdb::v3_2_0::TreeAdapter< Grid< _TreeType > >::NonConstGridPtrType
NonConstGridType::Ptr NonConstGridPtrType
Definition: Grid.h:938
openvdb::v3_2_0::Grid::writeTopology
virtual void writeTopology(std::ostream &) const
Write the grid topology to a stream. This will write only the grid structure, not the actual data buf...
Definition: Grid.h:1309
openvdb::v3_2_0::TreeAdapter::constTree
static const TreeType & constTree(const GridType &g)
Definition: Grid.h:922
openvdb::v3_2_0::TreeAdapter< Grid< _TreeType > >::tree
static const TreeType & tree(const TreeType &t)
Definition: Grid.h:947
openvdb::v3_2_0::GridBase::META_GRID_CREATOR
static const char *const META_GRID_CREATOR
Definition: Grid.h:280
openvdb::v3_2_0::gridConstPtrCast
GridType::ConstPtr gridConstPtrCast(const GridBase::ConstPtr &grid)
Cast a generic const grid pointer to a const pointer to a grid of a concrete class.
Definition: Grid.h:857
openvdb::v3_2_0::Grid::ValueAllIter
_TreeType::ValueAllIter ValueAllIter
Definition: Grid.h:498
openvdb::v3_2_0::createGrid
Grid< typename TreePtrType::element_type >::Ptr createGrid(TreePtrType)
Create a new grid of the appropriate type that wraps the given tree.
Definition: Grid.h:1396
openvdb::v3_2_0::GridPtrSet
std::set< GridBase::Ptr > GridPtrSet
Definition: Grid.h:430
openvdb::v3_2_0::Grid::unregisterGrid
static void unregisterGrid()
Remove this grid type from the registry.
Definition: Grid.h:815
openvdb::v3_2_0::Grid::cbeginValueOn
ValueOnCIter cbeginValueOn() const
Return an iterator over all of this grid&#39;s active values (tile and voxel).
Definition: Grid.h:623
openvdb::v3_2_0::GridBase::voxelSize
Vec3d voxelSize(const Vec3d &xyz) const
Return the size of this grid&#39;s voxel at position (x, y, z).
Definition: Grid.h:350
openvdb::v3_2_0::Grid::evalMinMax
void evalMinMax(ValueType &minVal, ValueType &maxVal) const
Return the minimum and maximum active values in this grid.
Definition: Grid.h:1267
openvdb::v3_2_0::Grid::empty
virtual bool empty() const
Return true if this grid contains only inactive background voxels.
Definition: Grid.h:587
openvdb::v3_2_0::findGridByName
GridPtrT findGridByName(const std::map< KeyT, GridPtrT > &container, const Name &name)
Return the first grid in the given map whose name is name.
Definition: Grid.h:463
openvdb::v3_2_0::Grid::treePtr
ConstTreePtrType treePtr() const
Return a pointer to this grid&#39;s tree, which might be shared with other grids. The pointer is guarante...
Definition: Grid.h:752
openvdb::v3_2_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::NonConstAccessorType
tree::ValueAccessor< NonConstTreeType > NonConstAccessorType
Definition: Grid.h:972
openvdb::v3_2_0::Grid::sparseFill
void sparseFill(const CoordBBox &bbox, const ValueType &value, bool active=true)
Set all voxels within a given axis-aligned box to a constant value.
Definition: Grid.h:1198
openvdb::v3_2_0::GridCPtrVecPtr
boost::shared_ptr< GridCPtrVec > GridCPtrVecPtr
Definition: Grid.h:428
openvdb::v3_2_0::TreeAdapter::ConstTreePtrType
TreeType::ConstPtr ConstTreePtrType
Definition: Grid.h:903
openvdb::v3_2_0::Grid::ValueType
_TreeType::ValueType ValueType
Definition: Grid.h:491
openvdb::v3_2_0::GridPtrVecCIter
GridPtrVec::const_iterator GridPtrVecCIter
Definition: Grid.h:422
openvdb::v3_2_0::GridCPtrSet
std::set< GridBase::ConstPtr > GridCPtrSet
Definition: Grid.h:435
openvdb::v3_2_0::TreeAdapter::NonConstTreePtrType
NonConstTreeType::Ptr NonConstTreePtrType
Definition: Grid.h:904
openvdb::v3_2_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::tree
static const TreeType & tree(const AccessorType &a)
Definition: Grid.h:979
openvdb::v3_2_0::io::setGridClass
OPENVDB_API void setGridClass(std::ios_base &, uint32_t)
Associate with the given stream the class (GRID_LEVEL_SET, GRID_UNKNOWN, etc.) of the grid currently ...
openvdb::v3_2_0::Grid::cbeginValueAll
ValueAllCIter cbeginValueAll() const
Return an iterator over all of this grid&#39;s values (tile and voxel).
Definition: Grid.h:635
openvdb::v3_2_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::tree
static const TreeType & tree(const TreeType &t)
Definition: Grid.h:977
openvdb::v3_2_0::TypeError
Definition: Exceptions.h:87
openvdb::v3_2_0::math::Transform::print
void print(std::ostream &os=std::cout, const std::string &indent="") const
Print a description of this transform.
openvdb::v3_2_0::GridPtrVecIter
GridPtrVec::iterator GridPtrVecIter
Definition: Grid.h:421
openvdb::v3_2_0::TreeAdapter::TreeType
_TreeType TreeType
Definition: Grid.h:900
openvdb::v3_2_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::tree
static TreeType & tree(TreeType &t)
Definition: Grid.h:974
openvdb::v3_2_0::Grid::ValueAllCIter
_TreeType::ValueAllCIter ValueAllCIter
Definition: Grid.h:499
openvdb::v3_2_0::TreeAdapter::ValueType
TreeType::ValueType ValueType
Definition: Grid.h:910
openvdb::v3_2_0::TreeAdapter::tree
static const TreeType & tree(const GridType &g)
Definition: Grid.h:918
openvdb::v3_2_0::TreeAdapter::NonConstGridType
Grid< NonConstTreeType > NonConstGridType
Definition: Grid.h:906
openvdb::v3_2_0::GridBase::indexToWorld
Vec3d indexToWorld(const Coord &ijk) const
Apply this grid&#39;s transform to the given coordinates.
Definition: Grid.h:356
openvdb::v3_2_0::MetaMap::endMeta
MetaIterator endMeta()
Definition: MetaMap.h:112
openvdb::v3_2_0::TreeBase
tree::TreeBase TreeBase
Definition: Grid.h:52
openvdb::v3_2_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::ConstAccessorType
tree::ValueAccessor< const TreeType > ConstAccessorType
Definition: Grid.h:971
openvdb::v3_2_0::Grid::ConstPtr
boost::shared_ptr< const Grid > ConstPtr
Definition: Grid.h:486
openvdb::v3_2_0::GridNamePred::operator()
bool operator()(const GridBase::ConstPtr &g) const
Definition: Grid.h:445
openvdb::v3_2_0::Grid::pruneGrid
virtual void pruneGrid(float tolerance=0.0)
Reduce the memory footprint of this grid by increasing its sparseness.
Definition: Grid.h:1212
openvdb::v3_2_0::TreeAdapter::tree
static TreeType & tree(TreeType &t)
Definition: Grid.h:915
openvdb::v3_2_0::Grid::topologyUnion
void topologyUnion(const Grid< OtherTreeType > &other)
Union this grid&#39;s set of active values with the active values of the other grid, whose value type may...
Definition: Grid.h:1238
openvdb::v3_2_0::GridBase::META_FILE_BBOX_MIN
static const char *const META_FILE_BBOX_MIN
Definition: Grid.h:285
openvdb::v3_2_0::Grid::copyGrid
virtual GridBase::Ptr copyGrid(CopyPolicy treePolicy=CP_SHARE) const
Return a new grid of the same type as this grid and whose metadata and transform are deep copies of t...
Definition: Grid.h:1163
openvdb::v3_2_0::math::CoordBBox
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:259
openvdb::v3_2_0::GridBase::transform
const math::Transform & transform() const
Return a reference to this grid&#39;s transform, which might be shared with other grids.
Definition: Grid.h:336
openvdb::v3_2_0::GridBase::GridBase
GridBase(const GridBase &other, ShallowCopy)
Copy another grid&#39;s metadata but share its transform.
Definition: Grid.h:404
openvdb::v3_2_0::GridBase::META_FILE_VOXEL_COUNT
static const char *const META_FILE_VOXEL_COUNT
Definition: Grid.h:289
openvdb::v3_2_0::TreeAdapter::constTree
static const TreeType & constTree(GridType &g)
Definition: Grid.h:920
openvdb::v3_2_0::GridBase::META_FILE_COMPRESSION
static const char *const META_FILE_COMPRESSION
Definition: Grid.h:287
openvdb::v3_2_0::Grid::ConstTreePtrType
_TreeType::ConstPtr ConstTreePtrType
Definition: Grid.h:490
openvdb::v3_2_0::GridBase::META_GRID_CLASS
static const char *const META_GRID_CLASS
Definition: Grid.h:279
openvdb::v3_2_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::constTree
static const TreeType & constTree(TreeType &t)
Definition: Grid.h:980
openvdb::v3_2_0::GridBase::writeTransform
void writeTransform(std::ostream &os) const
Write out the transform for this grid.
Definition: Grid.h:390
openvdb::v3_2_0::GridNamePred
Predicate functor that returns true for grids that have a specified name.
Definition: Grid.h:442
openvdb::v3_2_0::Grid::gridType
static Name gridType()
Return the name of this type of grid.
Definition: Grid.h:572
openvdb::v3_2_0::ValueError
Definition: Exceptions.h:88
openvdb::v3_2_0::Grid::clip
virtual void clip(const CoordBBox &)
Clip this grid to the given index-space bounding box.
Definition: Grid.h:1220
openvdb::v3_2_0::Grid::copy
Ptr copy(CopyPolicy treePolicy=CP_SHARE) const
Return a new grid of the same type as this grid and whose metadata and transform are deep copies of t...
Definition: Grid.h:1142
openvdb::v3_2_0::Grid::newTree
virtual void newTree()
Associate a new, empty tree with this grid, in place of its existing tree.
Definition: Grid.h:1187
openvdb::v3_2_0::GridBase::Ptr
boost::shared_ptr< GridBase > Ptr
Definition: Grid.h:106
openvdb::v3_2_0::Grid::ConstAccessor
tree::ValueAccessor< const _TreeType, true > ConstAccessor
Definition: Grid.h:502
openvdb::v3_2_0::createLevelSet
GridType::Ptr createLevelSet(Real voxelSize=1.0, Real halfWidth=LEVEL_SET_HALF_WIDTH)
Create a new grid of type GridType classified as a "Level Set", i.e., a narrow-band level set...
Definition: Grid.h:1405
openvdb::v3_2_0::Grid::readBuffers
virtual void readBuffers(std::istream &)
Read all data buffers for this grid.
Definition: Grid.h:1317
openvdb::v3_2_0::tree::ValueAccessorBase::tree
TreeType & tree() const
Return a reference to the tree associated with this accessor.
Definition: ValueAccessor.h:147
openvdb::v3_2_0::GridCPtrVecCIter
GridCPtrVec::const_iterator GridCPtrVecCIter
Definition: Grid.h:427
openvdb::v3_2_0::GridBase::GridBase
GridBase(const GridBase &other)
Deep copy another grid&#39;s metadata and transform.
Definition: Grid.h:401
openvdb::v3_2_0::deepCopyTypedGrid
GridType::Ptr deepCopyTypedGrid(const GridBase &grid)
Return a pointer to a deep copy of the given grid, provided that the grid&#39;s concrete type is GridType...
Definition: Grid.h:883
openvdb::v3_2_0::TreeAdapter< Grid< _TreeType > >::GridType
Grid< TreeType > GridType
Definition: Grid.h:935
openvdb::v3_2_0::GridBase::META_VECTOR_TYPE
static const char *const META_VECTOR_TYPE
Definition: Grid.h:284
openvdb::v3_2_0::GRID_LEVEL_SET
Definition: Types.h:213
openvdb::v3_2_0::GridCPtrSetIter
GridCPtrSet::iterator GridCPtrSetIter
Definition: Grid.h:436
OPENVDB_USE_VERSION_NAMESPACE
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:71
openvdb::v3_2_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::NonConstTreeType
boost::remove_const< TreeType >::type NonConstTreeType
Definition: Grid.h:960
openvdb::v3_2_0::Grid::~Grid
virtual ~Grid()
Definition: Grid.h:552
openvdb::v3_2_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::tree
static const TreeType & tree(const GridType &g)
Definition: Grid.h:978
openvdb::v3_2_0::GridBase::constGrid
static GridType::ConstPtr constGrid(const GridBase::Ptr &)
Return the result of downcasting a GridBase pointer to a Grid pointer of the specified type...
Definition: Grid.h:1016
openvdb::v3_2_0::TreeAdapter::constTree
static const TreeType & constTree(TreeType &t)
Definition: Grid.h:919
openvdb::v3_2_0::GridBase::META_IS_LOCAL_SPACE
static const char *const META_IS_LOCAL_SPACE
Definition: Grid.h:283
openvdb::v3_2_0::Grid::fill
void fill(const CoordBBox &bbox, const ValueType &value, bool active=true)
Set all voxels within a given axis-aligned box to a constant value.
Definition: Grid.h:651
openvdb::v3_2_0::GridBase::setTransform
void setTransform(math::Transform::Ptr)
Associate the given transform with this grid, in place of its existing transform. ...
Definition: Grid.h:1039
openvdb::v3_2_0::TreeAdapter::NonConstGridPtrType
NonConstGridType::Ptr NonConstGridPtrType
Definition: Grid.h:908
openvdb::v3_2_0::Grid::activeVoxelCount
virtual Index64 activeVoxelCount() const
Return the number of active voxels.
Definition: Grid.h:734
openvdb::v3_2_0::Grid::beginValueOff
ValueOffCIter beginValueOff() const
Return an iterator over all of this grid&#39;s inactive values (tile and voxel).
Definition: Grid.h:628
openvdb::v3_2_0::GridBase::~GridBase
virtual ~GridBase()
Definition: Grid.h:112
openvdb::v3_2_0::GridNamePred::GridNamePred
GridNamePred(const Name &_name)
Definition: Grid.h:444
openvdb::v3_2_0::CP_NEW
Definition: Types.h:434
openvdb::v3_2_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::GridPtrType
GridType::Ptr GridPtrType
Definition: Grid.h:966
openvdb::v3_2_0::math::Transform::Ptr
boost::shared_ptr< Transform > Ptr
Definition: Transform.h:69
openvdb::v3_2_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::NonConstGridPtrType
NonConstGridType::Ptr NonConstGridPtrType
Definition: Grid.h:967
openvdb::v3_2_0::Grid::constBaseTreePtr
virtual TreeBase::ConstPtr constBaseTreePtr() const
Return a pointer to this grid&#39;s tree, which might be shared with other grids. The pointer is guarante...
Definition: Grid.h:754
openvdb::v3_2_0::Grid::evalActiveVoxelDim
virtual Coord evalActiveVoxelDim() const
Return the dimensions of the axis-aligned bounding box of all active voxels.
Definition: Grid.h:1285
openvdb::v3_2_0::GridBase::constTransform
const math::Transform & constTransform() const
Return a reference to this grid&#39;s transform, which might be shared with other grids.
Definition: Grid.h:337
openvdb::v3_2_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::ConstTreePtrType
TreeType::ConstPtr ConstTreePtrType
Definition: Grid.h:962
openvdb::v3_2_0::Grid
Container class that associates a tree with a transform and metadata.
Definition: Grid.h:54
openvdb::v3_2_0::Grid::isRegistered
static bool isRegistered()
Return true if this grid type is registered.
Definition: Grid.h:811
openvdb::v3_2_0::TreeAdapter::NonConstAccessorType
tree::ValueAccessor< NonConstTreeType > NonConstAccessorType
Definition: Grid.h:913
Name.h
openvdb::v3_2_0::GridBase::grid
static GridType::Ptr grid(const GridBase::Ptr &)
Return the result of downcasting a GridBase pointer to a Grid pointer of the specified type...
Definition: Grid.h:994
openvdb::v3_2_0::TreeAdapter< Grid< _TreeType > >::constTree
static const TreeType & constTree(const TreeType &t)
Definition: Grid.h:951
openvdb::v3_2_0::GridBase::META_SAVE_HALF_FLOAT
static const char *const META_SAVE_HALF_FLOAT
Definition: Grid.h:282
openvdb::v3_2_0::MetaMap::Ptr
boost::shared_ptr< MetaMap > Ptr
Definition: MetaMap.h:49
openvdb::v3_2_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::tree
static TreeType & tree(AccessorType &a)
Definition: Grid.h:976