OpenVDB: Grid.h Source File

OpenVDB 3.1.0

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

Grid.h
Go to the documentation of this file.
1 //
3 // Copyright (c) 2012-2015 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
493 typedef typename _TreeType::ValueOnIter ValueOnIter;
494 typedef typename _TreeType::ValueOnCIter ValueOnCIter;
495 typedef typename _TreeType::ValueOffIter ValueOffIter;
496 typedef typename _TreeType::ValueOffCIter ValueOffCIter;
497 typedef typename _TreeType::ValueAllIter ValueAllIter;
498 typedef typename _TreeType::ValueAllCIter ValueAllCIter;
499
500 typedef typename tree::ValueAccessor<_TreeType, true> Accessor;
501 typedef typename tree::ValueAccessor<const _TreeType, true> ConstAccessor;
502 typedef typename tree::ValueAccessor<_TreeType, false> UnsafeAccessor;
503 typedef typename tree::ValueAccessor<const _TreeType, false> ConstUnsafeAccessor;
504
511 template<typename OtherValueType>
512 struct ValueConverter {
513 typedef Grid<typename TreeType::template ValueConverter<OtherValueType>::Type> Type;
514 };
515
517 static Ptr create(const ValueType& background);
519 static Ptr create();
522 static Ptr create(TreePtrType);
525 static Ptr create(const GridBase& other);
526
527
529 Grid();
531 explicit Grid(const ValueType& background);
535 explicit Grid(TreePtrType);
537 Grid(const Grid&);
543 template<typename OtherTreeType>
544 explicit Grid(const Grid<OtherTreeType>&);
546 Grid(const Grid&, ShallowCopy);
549 Grid(const GridBase&);
550
551 virtual ~Grid() {}
552
554 Ptr copy(CopyPolicy treePolicy = CP_SHARE) const;
560 virtual GridBase::Ptr copyGrid(CopyPolicy treePolicy = CP_SHARE) const;
562
563 Ptr deepCopy() const { return Ptr(new Grid(*this)); }
565 virtual GridBase::Ptr deepCopyGrid() const { return this->deepCopy(); }
567
569 virtual Name type() const { return this->gridType(); }
571 static Name gridType() { return TreeType::treeType(); }
572
573
574 //
575 // Voxel access methods
576 //
578 virtual Name valueType() const { return tree().valueType(); }
579
583 const ValueType& background() const { return mTree->background(); }
584
586 virtual bool empty() const { return tree().empty(); }
588 virtual void clear() { tree().clear(); }
589
593 Accessor getAccessor() { return Accessor(tree()); }
602 Accessor getUnsafeAccessor() { return UnsafeAccessor(tree()); }
604 ConstAccessor getAccessor() const { return ConstAccessor(tree()); }
606 ConstAccessor getConstAccessor() const { return ConstAccessor(tree()); }
608 ConstAccessor getConstUnsafeAccessor() const { return ConstUnsafeAccessor(tree()); }
617
619 ValueOnIter beginValueOn() { return tree().beginValueOn(); }
621 ValueOnCIter beginValueOn() const { return tree().cbeginValueOn(); }
622 ValueOnCIter cbeginValueOn() const { return tree().cbeginValueOn(); }
624
625 ValueOffIter beginValueOff() { return tree().beginValueOff(); }
627 ValueOffCIter beginValueOff() const { return tree().cbeginValueOff(); }
628 ValueOffCIter cbeginValueOff() const { return tree().cbeginValueOff(); }
630
631 ValueAllIter beginValueAll() { return tree().beginValueAll(); }
633 ValueAllCIter beginValueAll() const { return tree().cbeginValueAll(); }
634 ValueAllCIter cbeginValueAll() const { return tree().cbeginValueAll(); }
636
638 void evalMinMax(ValueType& minVal, ValueType& maxVal) const;
639
648 void fill(const CoordBBox& bbox, const ValueType& value, bool active = true);
649
651 virtual void pruneGrid(float tolerance = 0.0);
652
653 #ifndef OPENVDB_2_ABI_COMPATIBLE
654 virtual void clip(const CoordBBox&);
659 #endif
660
666 void merge(Grid& other, MergePolicy policy = MERGE_ACTIVE_STATES);
667
681 template<typename OtherTreeType>
682 void topologyUnion(const Grid<OtherTreeType>& other);
683
696 template<typename OtherTreeType>
697 void topologyIntersection(const Grid<OtherTreeType>& other);
698
709 template<typename OtherTreeType>
710 void topologyDifference(const Grid<OtherTreeType>& other);
711
712 //
713 // Statistics
714 //
716 virtual Index64 activeVoxelCount() const { return tree().activeVoxelCount(); }
718 virtual CoordBBox evalActiveVoxelBoundingBox() const;
720 virtual Coord evalActiveVoxelDim() const;
721
724 virtual Index64 memUsage() const { return tree().memUsage(); }
725
726
727 //
728 // Tree methods
729 //
731 TreePtrType treePtr() { return mTree; }
734 ConstTreePtrType treePtr() const { return mTree; }
735 ConstTreePtrType constTreePtr() const { return mTree; }
736 virtual TreeBase::ConstPtr constBaseTreePtr() const { return mTree; }
738
739 TreeType& tree() { return *mTree; }
744 const TreeType& tree() const { return *mTree; }
745 const TreeType& constTree() const { return *mTree; }
747
753 virtual void setTree(TreeBase::Ptr);
754
757 virtual void newTree();
758
759
760 //
761 // I/O methods
762 //
765 virtual void readTopology(std::istream&);
768 virtual void writeTopology(std::ostream&) const;
769
771 virtual void readBuffers(std::istream&);
772 #ifndef OPENVDB_2_ABI_COMPATIBLE
773 virtual void readBuffers(std::istream&, const CoordBBox&);
780 virtual void readNonresidentBuffers() const;
781 #endif
782 virtual void writeBuffers(std::ostream&) const;
784
786 virtual void print(std::ostream& = std::cout, int verboseLevel = 1) const;
787
788
789 //
790 // Registry methods
791 //
793 static bool isRegistered() { return GridBase::isRegistered(Grid::gridType()); }
795 static void registerGrid() { GridBase::registerGrid(Grid::gridType(), Grid::factory); }
797 static void unregisterGrid() { GridBase::unregisterGrid(Grid::gridType()); }
798
799
800 private:
802 Grid& operator=(const Grid& other);
803
805 static GridBase::Ptr factory() { return Grid::create(); }
806
807 TreePtrType mTree;
808 }; // class Grid
809
810
812
813
821 template<typename GridType>
822 inline typename GridType::Ptr
823 gridPtrCast(const GridBase::Ptr& grid)
824 {
825 return GridBase::grid<GridType>(grid);
826 }
827
828
837 template<typename GridType>
838 inline typename GridType::ConstPtr
839 gridConstPtrCast(const GridBase::ConstPtr& grid)
840 {
841 return GridBase::constGrid<GridType>(grid);
842 }
843
844
846
847
854 template<typename GridType>
855 inline typename GridType::Ptr
856 deepCopyTypedGrid(const GridBase::ConstPtr& grid)
857 {
858 if (!grid || !grid->isType<GridType>()) return typename GridType::Ptr();
859 return gridPtrCast<GridType>(grid->deepCopyGrid());
860 }
861
862
863 template<typename GridType>
864 inline typename GridType::Ptr
865 deepCopyTypedGrid(const GridBase& grid)
866 {
867 if (!grid.isType<GridType>()) return typename GridType::Ptr();
868 return gridPtrCast<GridType>(grid.deepCopyGrid());
869 }
871
872
874
875
877 template<typename _TreeType>
880 struct TreeAdapter
881 {
882 typedef _TreeType TreeType;
883 typedef typename boost::remove_const<TreeType>::type NonConstTreeType;
884 typedef typename TreeType::Ptr TreePtrType;
885 typedef typename TreeType::ConstPtr ConstTreePtrType;
886 typedef typename NonConstTreeType::Ptr NonConstTreePtrType;
887 typedef Grid<TreeType> GridType;
888 typedef Grid<NonConstTreeType> NonConstGridType;
889 typedef typename GridType::Ptr GridPtrType;
890 typedef typename NonConstGridType::Ptr NonConstGridPtrType;
891 typedef typename GridType::ConstPtr ConstGridPtrType;
892 typedef typename TreeType::ValueType ValueType;
893 typedef typename tree::ValueAccessor<TreeType> AccessorType;
894 typedef typename tree::ValueAccessor<const TreeType> ConstAccessorType;
895 typedef typename tree::ValueAccessor<NonConstTreeType> NonConstAccessorType;
896
897 static TreeType& tree(TreeType& t) { return t; }
898 static TreeType& tree(GridType& g) { return g.tree(); }
899 static const TreeType& tree(const TreeType& t) { return t; }
900 static const TreeType& tree(const GridType& g) { return g.tree(); }
901 static const TreeType& constTree(TreeType& t) { return t; }
902 static const TreeType& constTree(GridType& g) { return g.constTree(); }
903 static const TreeType& constTree(const TreeType& t) { return t; }
904 static const TreeType& constTree(const GridType& g) { return g.constTree(); }
905 };
906
907
909 template<typename _TreeType>
910 struct TreeAdapter<Grid<_TreeType> >
911 {
912 typedef _TreeType TreeType;
913 typedef typename boost::remove_const<TreeType>::type NonConstTreeType;
914 typedef typename TreeType::Ptr TreePtrType;
915 typedef typename TreeType::ConstPtr ConstTreePtrType;
916 typedef typename NonConstTreeType::Ptr NonConstTreePtrType;
917 typedef Grid<TreeType> GridType;
918 typedef Grid<NonConstTreeType> NonConstGridType;
919 typedef typename GridType::Ptr GridPtrType;
920 typedef typename NonConstGridType::Ptr NonConstGridPtrType;
921 typedef typename GridType::ConstPtr ConstGridPtrType;
922 typedef typename TreeType::ValueType ValueType;
923 typedef typename tree::ValueAccessor<TreeType> AccessorType;
924 typedef typename tree::ValueAccessor<const TreeType> ConstAccessorType;
925 typedef typename tree::ValueAccessor<NonConstTreeType> NonConstAccessorType;
926
927 static TreeType& tree(TreeType& t) { return t; }
928 static TreeType& tree(GridType& g) { return g.tree(); }
929 static const TreeType& tree(const TreeType& t) { return t; }
930 static const TreeType& tree(const GridType& g) { return g.tree(); }
931 static const TreeType& constTree(TreeType& t) { return t; }
932 static const TreeType& constTree(GridType& g) { return g.constTree(); }
933 static const TreeType& constTree(const TreeType& t) { return t; }
934 static const TreeType& constTree(const GridType& g) { return g.constTree(); }
935 };
936
938 template<typename _TreeType>
939 struct TreeAdapter<tree::ValueAccessor<_TreeType> >
940 {
941 typedef _TreeType TreeType;
942 typedef typename boost::remove_const<TreeType>::type NonConstTreeType;
943 typedef typename TreeType::Ptr TreePtrType;
944 typedef typename TreeType::ConstPtr ConstTreePtrType;
945 typedef typename NonConstTreeType::Ptr NonConstTreePtrType;
946 typedef Grid<TreeType> GridType;
947 typedef Grid<NonConstTreeType> NonConstGridType;
948 typedef typename GridType::Ptr GridPtrType;
949 typedef typename NonConstGridType::Ptr NonConstGridPtrType;
950 typedef typename GridType::ConstPtr ConstGridPtrType;
951 typedef typename TreeType::ValueType ValueType;
952 typedef typename tree::ValueAccessor<TreeType> AccessorType;
953 typedef typename tree::ValueAccessor<const TreeType> ConstAccessorType;
954 typedef typename tree::ValueAccessor<NonConstTreeType> NonConstAccessorType;
955
956 static TreeType& tree(TreeType& t) { return t; }
957 static TreeType& tree(GridType& g) { return g.tree(); }
958 static TreeType& tree(AccessorType& a) { return a.tree(); }
959 static const TreeType& tree(const TreeType& t) { return t; }
960 static const TreeType& tree(const GridType& g) { return g.tree(); }
961 static const TreeType& tree(const AccessorType& a) { return a.tree(); }
962 static const TreeType& constTree(TreeType& t) { return t; }
963 static const TreeType& constTree(GridType& g) { return g.constTree(); }
964 static const TreeType& constTree(const TreeType& t) { return t; }
965 static const TreeType& constTree(const GridType& g) { return g.constTree(); }
966 };
967
969
970
972
973
974 template<typename GridType>
975 inline typename GridType::Ptr
976 GridBase::grid(const GridBase::Ptr& grid)
977 {
978 // The string comparison on type names is slower than a dynamic_pointer_cast, but
979 // it is safer when pointers cross dso boundaries, as they do in many Houdini nodes.
980 if (grid && grid->type() == GridType::gridType()) {
981 return boost::static_pointer_cast<GridType>(grid);
982 }
983 return typename GridType::Ptr();
984 }
985
986
987 template<typename GridType>
988 inline typename GridType::ConstPtr
989 GridBase::grid(const GridBase::ConstPtr& grid)
990 {
991 return boost::const_pointer_cast<const GridType>(
992 GridBase::grid<GridType>(boost::const_pointer_cast<GridBase>(grid)));
993 }
994
995
996 template<typename GridType>
997 inline typename GridType::ConstPtr
998 GridBase::constGrid(const GridBase::Ptr& grid)
999 {
1000 return boost::const_pointer_cast<const GridType>(GridBase::grid<GridType>(grid));
1001 }
1002
1003
1004 template<typename GridType>
1005 inline typename GridType::ConstPtr
1006 GridBase::constGrid(const GridBase::ConstPtr& grid)
1007 {
1008 return boost::const_pointer_cast<const GridType>(
1009 GridBase::grid<GridType>(boost::const_pointer_cast<GridBase>(grid)));
1010 }
1011
1012
1013 inline TreeBase::Ptr
1014 GridBase::baseTreePtr()
1015 {
1016 return boost::const_pointer_cast<TreeBase>(this->constBaseTreePtr());
1017 }
1018
1019
1020 inline void
1021 GridBase::setTransform(math::Transform::Ptr xform)
1022 {
1023 if (!xform) OPENVDB_THROW(ValueError, "Transform pointer is null");
1024 mTransform = xform;
1025 }
1026
1027
1029
1030
1031 template<typename TreeT>
1032 inline Grid<TreeT>::Grid(): mTree(new TreeType)
1033 {
1034 }
1035
1036
1037 template<typename TreeT>
1038 inline Grid<TreeT>::Grid(const ValueType &background): mTree(new TreeType(background))
1039 {
1040 }
1041
1042
1043 template<typename TreeT>
1044 inline Grid<TreeT>::Grid(TreePtrType tree): mTree(tree)
1045 {
1046 if (!tree) OPENVDB_THROW(ValueError, "Tree pointer is null");
1047 }
1048
1049
1050 template<typename TreeT>
1051 inline Grid<TreeT>::Grid(const Grid& other):
1052 GridBase(other),
1053 mTree(boost::static_pointer_cast<TreeType>(other.mTree->copy()))
1054 {
1055 }
1056
1057
1058 template<typename TreeT>
1059 template<typename OtherTreeType>
1060 inline Grid<TreeT>::Grid(const Grid<OtherTreeType>& other):
1061 GridBase(other),
1062 mTree(new TreeType(other.constTree()))
1063 {
1064 }
1065
1066
1067 template<typename TreeT>
1068 inline Grid<TreeT>::Grid(const Grid& other, ShallowCopy):
1069 GridBase(other, ShallowCopy()),
1070 mTree(other.mTree)
1071 {
1072 }
1073
1074
1075 template<typename TreeT>
1076 inline Grid<TreeT>::Grid(const GridBase& other):
1077 GridBase(other),
1078 mTree(new TreeType)
1079 {
1080 }
1081
1082
1083 //static
1084 template<typename TreeT>
1085 inline typename Grid<TreeT>::Ptr
1086 Grid<TreeT>::create()
1087 {
1088 return Grid::create(zeroVal<ValueType>());
1089 }
1090
1091
1092 //static
1093 template<typename TreeT>
1094 inline typename Grid<TreeT>::Ptr
1095 Grid<TreeT>::create(const ValueType& background)
1096 {
1097 return Ptr(new Grid(background));
1098 }
1099
1100
1101 //static
1102 template<typename TreeT>
1103 inline typename Grid<TreeT>::Ptr
1104 Grid<TreeT>::create(TreePtrType tree)
1105 {
1106 return Ptr(new Grid(tree));
1107 }
1108
1109
1110 //static
1111 template<typename TreeT>
1112 inline typename Grid<TreeT>::Ptr
1113 Grid<TreeT>::create(const GridBase& other)
1114 {
1115 return Ptr(new Grid(other));
1116 }
1117
1118
1120
1121
1122 template<typename TreeT>
1123 inline typename Grid<TreeT>::Ptr
1124 Grid<TreeT>::copy(CopyPolicy treePolicy) const
1125 {
1126 Ptr ret;
1127 switch (treePolicy) {
1128 case CP_NEW:
1129 ret.reset(new Grid(*this, ShallowCopy()));
1130 ret->newTree();
1131 break;
1132 case CP_COPY:
1133 ret.reset(new Grid(*this));
1134 break;
1135 case CP_SHARE:
1136 ret.reset(new Grid(*this, ShallowCopy()));
1137 break;
1138 }
1139 return ret;
1140 }
1141
1142
1143 template<typename TreeT>
1144 inline GridBase::Ptr
1145 Grid<TreeT>::copyGrid(CopyPolicy treePolicy) const
1146 {
1147 return this->copy(treePolicy);
1148 }
1149
1150
1152
1153
1154 template<typename TreeT>
1155 inline void
1156 Grid<TreeT>::setTree(TreeBase::Ptr tree)
1157 {
1158 if (!tree) OPENVDB_THROW(ValueError, "Tree pointer is null");
1159 if (tree->type() != TreeType::treeType()) {
1160 OPENVDB_THROW(TypeError, "Cannot assign a tree of type "
1161 + tree->type() + " to a grid of type " + this->type());
1162 }
1163 mTree = boost::static_pointer_cast<TreeType>(tree);
1164 }
1165
1166
1167 template<typename TreeT>
1168 inline void
1169 Grid<TreeT>::newTree()
1170 {
1171 mTree.reset(new TreeType(this->background()));
1172 }
1173
1174
1176
1177
1178 template<typename TreeT>
1179 inline void
1180 Grid<TreeT>::fill(const CoordBBox& bbox, const ValueType& value, bool active)
1181 {
1182 tree().fill(bbox, value, active);
1183 }
1184
1185 template<typename TreeT>
1186 inline void
1187 Grid<TreeT>::pruneGrid(float tolerance)
1188 {
1189 this->tree().prune(ValueType(zeroVal<ValueType>() + tolerance));
1190 }
1191
1192 #ifndef OPENVDB_2_ABI_COMPATIBLE
1193 template<typename TreeT>
1194 inline void
1195 Grid<TreeT>::clip(const CoordBBox& bbox)
1196 {
1197 tree().clip(bbox);
1198 }
1199 #endif
1200
1201
1202 template<typename TreeT>
1203 inline void
1204 Grid<TreeT>::merge(Grid& other, MergePolicy policy)
1205 {
1206 tree().merge(other.tree(), policy);
1207 }
1208
1209
1210 template<typename TreeT>
1211 template<typename OtherTreeType>
1212 inline void
1213 Grid<TreeT>::topologyUnion(const Grid<OtherTreeType>& other)
1214 {
1215 tree().topologyUnion(other.tree());
1216 }
1217
1218
1219 template<typename TreeT>
1220 template<typename OtherTreeType>
1221 inline void
1222 Grid<TreeT>::topologyIntersection(const Grid<OtherTreeType>& other)
1223 {
1224 tree().topologyIntersection(other.tree());
1225 }
1226
1227
1228 template<typename TreeT>
1229 template<typename OtherTreeType>
1230 inline void
1231 Grid<TreeT>::topologyDifference(const Grid<OtherTreeType>& other)
1232 {
1233 tree().topologyDifference(other.tree());
1234 }
1235
1236
1238
1239
1240 template<typename TreeT>
1241 inline void
1242 Grid<TreeT>::evalMinMax(ValueType& minVal, ValueType& maxVal) const
1243 {
1244 tree().evalMinMax(minVal, maxVal);
1245 }
1246
1247
1248 template<typename TreeT>
1249 inline CoordBBox
1250 Grid<TreeT>::evalActiveVoxelBoundingBox() const
1251 {
1252 CoordBBox bbox;
1253 tree().evalActiveVoxelBoundingBox(bbox);
1254 return bbox;
1255 }
1256
1257
1258 template<typename TreeT>
1259 inline Coord
1260 Grid<TreeT>::evalActiveVoxelDim() const
1261 {
1262 Coord dim;
1263 const bool nonempty = tree().evalActiveVoxelDim(dim);
1264 return (nonempty ? dim : Coord());
1265 }
1266
1267
1269
1270
1273
1274 template<typename TreeT>
1275 inline void
1276 Grid<TreeT>::readTopology(std::istream& is)
1277 {
1278 tree().readTopology(is, saveFloatAsHalf());
1279 }
1280
1281
1282 template<typename TreeT>
1283 inline void
1284 Grid<TreeT>::writeTopology(std::ostream& os) const
1285 {
1286 tree().writeTopology(os, saveFloatAsHalf());
1287 }
1288
1289
1290 template<typename TreeT>
1291 inline void
1292 Grid<TreeT>::readBuffers(std::istream& is)
1293 {
1294 tree().readBuffers(is, saveFloatAsHalf());
1295 }
1296
1297
1298 #ifndef OPENVDB_2_ABI_COMPATIBLE
1299
1300 template<typename TreeT>
1301 inline void
1302 Grid<TreeT>::readBuffers(std::istream& is, const CoordBBox& bbox)
1303 {
1304 tree().readBuffers(is, bbox, saveFloatAsHalf());
1305 }
1306
1307
1308 template<typename TreeT>
1309 inline void
1310 Grid<TreeT>::readNonresidentBuffers() const
1311 {
1312 tree().readNonresidentBuffers();
1313 }
1314
1315 #endif // !OPENVDB_2_ABI_COMPATIBLE
1316
1317
1318 template<typename TreeT>
1319 inline void
1320 Grid<TreeT>::writeBuffers(std::ostream& os) const
1321 {
1322 tree().writeBuffers(os, saveFloatAsHalf());
1323 }
1324
1325
1326 template<typename TreeT>
1327 inline void
1328 Grid<TreeT>::print(std::ostream& os, int verboseLevel) const
1329 {
1330 tree().print(os, verboseLevel);
1331
1332 if (metaCount() > 0) {
1333 os << "Additional metadata:" << std::endl;
1334 for (ConstMetaIterator it = beginMeta(), end = endMeta(); it != end; ++it) {
1335 os << " " << it->first;
1336 if (it->second) {
1337 const std::string value = it->second->str();
1338 if (!value.empty()) os << ": " << value;
1339 }
1340 os << "\n";
1341 }
1342 }
1343
1344 os << "Transform:" << std::endl;
1345 transform().print(os, /*indent=*/" ");
1346 os << std::endl;
1347 }
1348
1349
1351
1352
1353 template<typename GridType>
1354 inline typename GridType::Ptr
1355 createGrid(const typename GridType::ValueType& background)
1356 {
1357 return GridType::create(background);
1358 }
1359
1360
1361 template<typename GridType>
1362 inline typename GridType::Ptr
1363 createGrid()
1364 {
1365 return GridType::create();
1366 }
1367
1368
1369 template<typename TreePtrType>
1370 inline typename Grid<typename TreePtrType::element_type>::Ptr
1371 createGrid(TreePtrType tree)
1372 {
1373 typedef typename TreePtrType::element_type TreeType;
1374 return Grid<TreeType>::create(tree);
1375 }
1376
1377
1378 template<typename GridType>
1379 typename GridType::Ptr
1380 createLevelSet(Real voxelSize, Real halfWidth)
1381 {
1382 typedef typename GridType::ValueType ValueType;
1383
1384 // GridType::ValueType is required to be a floating-point scalar.
1385 BOOST_STATIC_ASSERT(boost::is_floating_point<ValueType>::value);
1386
1387 typename GridType::Ptr grid = GridType::create(
1388 /*background=*/static_cast<ValueType>(voxelSize * halfWidth));
1389 grid->setTransform(math::Transform::createLinearTransform(voxelSize));
1390 grid->setGridClass(GRID_LEVEL_SET);
1391 return grid;
1392 }
1393
1394 } // namespace OPENVDB_VERSION_NAME
1395 } // namespace openvdb
1396
1397 #endif // OPENVDB_GRID_HAS_BEEN_INCLUDED
1398
1399 // Copyright (c) 2012-2015 DreamWorks Animation LLC
1400 // All rights reserved. This software is distributed under the
1401 // Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
openvdb::v3_1_0::TreeAdapter< Grid< _TreeType > >::tree
static const TreeType & tree(const GridType &g)
Definition: Grid.h:930
openvdb::v3_1_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:839
openvdb::v3_1_0::GridBase::createGrid
static Ptr createGrid(const Name &type)
Create a new grid of the given (registered) type.
openvdb::v3_1_0::TreeAdapter::AccessorType
tree::ValueAccessor< TreeType > AccessorType
Definition: Grid.h:893
openvdb::v3_1_0::Grid::TreeType
_TreeType TreeType
Definition: Grid.h:488
openvdb::v3_1_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::tree
static TreeType & tree(GridType &g)
Definition: Grid.h:957
openvdb::v3_1_0::TreeAdapter::NonConstAccessorType
tree::ValueAccessor< NonConstTreeType > NonConstAccessorType
Definition: Grid.h:895
openvdb::v3_1_0::TreeAdapter< Grid< _TreeType > >::ConstGridPtrType
GridType::ConstPtr ConstGridPtrType
Definition: Grid.h:921
openvdb::v3_1_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::tree
static const TreeType & tree(const AccessorType &a)
Definition: Grid.h:961
openvdb::v3_1_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::tree
static TreeType & tree(AccessorType &a)
Definition: Grid.h:958
OPENVDB_API
#define OPENVDB_API
Helper macros for defining library symbol visibility.
Definition: Platform.h:195
openvdb::v3_1_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::tree
static TreeType & tree(TreeType &t)
Definition: Grid.h:956
openvdb::v3_1_0::Grid::beginValueAll
ValueAllCIter beginValueAll() const
Return an iterator over all of this grid&#39;s values (tile and voxel).
Definition: Grid.h:633
openvdb::v3_1_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:593
openvdb::v3_1_0::Grid::clear
virtual void clear()
Empty this grid, so that all voxels become inactive background voxels.
Definition: Grid.h:588
openvdb::v3_1_0::tree::TreeBase::ConstPtr
boost::shared_ptr< const TreeBase > ConstPtr
Definition: Tree.h:67
openvdb::v3_1_0::TreeAdapter< Grid< _TreeType > >::ValueType
TreeType::ValueType ValueType
Definition: Grid.h:922
openvdb::v3_1_0::MetaMap::ConstMetaIterator
MetadataMap::const_iterator ConstMetaIterator
Definition: MetaMap.h:54
openvdb::v3_1_0::CP_COPY
Definition: Types.h:411
openvdb::v3_1_0::Grid::empty
virtual bool empty() const
Return true if this grid contains only inactive background voxels.
Definition: Grid.h:586
Types.h
openvdb::v3_1_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:1276
openvdb::v3_1_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_1_0::TreeAdapter< Grid< _TreeType > >::AccessorType
tree::ValueAccessor< TreeType > AccessorType
Definition: Grid.h:923
openvdb::v3_1_0::TreeAdapter::TreePtrType
TreeType::Ptr TreePtrType
Definition: Grid.h:884
openvdb::v3_1_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:1380
openvdb::v3_1_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::ConstTreePtrType
TreeType::ConstPtr ConstTreePtrType
Definition: Grid.h:944
openvdb::v3_1_0::MetaMap::Ptr
boost::shared_ptr< MetaMap > Ptr
Definition: MetaMap.h:49
openvdb::v3_1_0::TreeAdapter< Grid< _TreeType > >::constTree
static const TreeType & constTree(TreeType &t)
Definition: Grid.h:931
openvdb::v3_1_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:1222
openvdb::v3_1_0::GridCPtrVecCIter
GridCPtrVec::const_iterator GridCPtrVecCIter
Definition: Grid.h:427
MetaMap.h
openvdb::v3_1_0::TreeAdapter< Grid< _TreeType > >::ConstTreePtrType
TreeType::ConstPtr ConstTreePtrType
Definition: Grid.h:915
openvdb::v3_1_0::Grid::memUsage
virtual Index64 memUsage() const
Definition: Grid.h:724
openvdb::v3_1_0::GridBase
Abstract base class for typed grids.
Definition: Grid.h:103
openvdb::v3_1_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::ConstGridPtrType
GridType::ConstPtr ConstGridPtrType
Definition: Grid.h:950
openvdb::v3_1_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:823
openvdb::v3_1_0::Grid::background
const ValueType & background() const
Return this grid&#39;s background value.
Definition: Grid.h:583
openvdb::v3_1_0::GridBase::META_GRID_CREATOR
static const char *const META_GRID_CREATOR
Definition: Grid.h:280
openvdb::v3_1_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:744
openvdb::v3_1_0::Grid::Accessor
tree::ValueAccessor< _TreeType, true > Accessor
Definition: Grid.h:500
openvdb::v3_1_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::AccessorType
tree::ValueAccessor< TreeType > AccessorType
Definition: Grid.h:952
openvdb::v3_1_0::GridNamePred::name
Name name
Definition: Grid.h:446
openvdb::v3_1_0::ValueError
Definition: Exceptions.h:88
openvdb::v3_1_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:1145
openvdb::v3_1_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_1_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:1231
openvdb::v3_1_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_THROW
#define OPENVDB_THROW(exception, message)
Definition: Exceptions.h:97
openvdb::v3_1_0::MergePolicy
MergePolicy
Definition: Types.h:257
openvdb::v3_1_0::Grid::evalMinMax
void evalMinMax(ValueType &minVal, ValueType &maxVal) const
Return the minimum and maximum active values in this grid.
Definition: Grid.h:1242
openvdb::v3_1_0::Grid::type
virtual Name type() const
Return the name of this grid&#39;s type.
Definition: Grid.h:569
openvdb::v3_1_0::tree::ValueAccessorBase::tree
TreeType & tree() const
Return a reference to the tree associated with this accessor.
Definition: ValueAccessor.h:147
openvdb::v3_1_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:1284
openvdb::v3_1_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_1_0::MetaMap
Container that maps names (strings) to values of arbitrary types.
Definition: MetaMap.h:46
openvdb::v3_1_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:1328
openvdb::v3_1_0::TreeAdapter< Grid< _TreeType > >::tree
static TreeType & tree(GridType &g)
Definition: Grid.h:928
openvdb::v3_1_0::GridBase::voxelSize
Vec3d voxelSize() const
Return the size of this grid&#39;s voxels.
Definition: Grid.h:347
openvdb::v3_1_0::GridCPtrSetIter
GridCPtrSet::iterator GridCPtrSetIter
Definition: Grid.h:436
openvdb::v3_1_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:355
openvdb::v3_1_0::GridBase::META_GRID_CLASS
static const char *const META_GRID_CLASS
Definition: Grid.h:279
openvdb::v3_1_0::TreeAdapter< Grid< _TreeType > >::ConstAccessorType
tree::ValueAccessor< const TreeType > ConstAccessorType
Definition: Grid.h:924
openvdb::v3_1_0::TreeAdapter< Grid< _TreeType > >::NonConstTreePtrType
NonConstTreeType::Ptr NonConstTreePtrType
Definition: Grid.h:916
openvdb::v3_1_0::TreeAdapter< Grid< _TreeType > >::GridPtrType
GridType::Ptr GridPtrType
Definition: Grid.h:919
openvdb::v3_1_0::Grid::ValueOffCIter
_TreeType::ValueOffCIter ValueOffCIter
Definition: Grid.h:496
openvdb::v3_1_0::GridBase::writeTransform
void writeTransform(std::ostream &os) const
Write out the transform for this grid.
Definition: Grid.h:390
openvdb::v3_1_0::TreeAdapter< Grid< _TreeType > >::NonConstTreeType
boost::remove_const< TreeType >::type NonConstTreeType
Definition: Grid.h:913
openvdb::v3_1_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::constTree
static const TreeType & constTree(const TreeType &t)
Definition: Grid.h:964
openvdb::v3_1_0::GridBase::META_FILE_BBOX_MIN
static const char *const META_FILE_BBOX_MIN
Definition: Grid.h:285
openvdb::v3_1_0::tree::TreeBase::Ptr
boost::shared_ptr< TreeBase > Ptr
Definition: Tree.h:66
openvdb::v3_1_0::Grid::tree
TreeType & tree()
Return a reference to this grid&#39;s tree, which might be shared with other grids.
Definition: Grid.h:743
openvdb::v3_1_0::GridPtrVecCIter
GridPtrVec::const_iterator GridPtrVecCIter
Definition: Grid.h:422
Transform.h
openvdb::v3_1_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:735
openvdb::v3_1_0::MetaMap::beginMeta
MetaIterator beginMeta()
Definition: MetaMap.h:111
openvdb::v3_1_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_1_0::TreeAdapter< Grid< _TreeType > >::tree
static TreeType & tree(TreeType &t)
Definition: Grid.h:927
openvdb::v3_1_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::NonConstTreePtrType
NonConstTreeType::Ptr NonConstTreePtrType
Definition: Grid.h:945
openvdb::v3_1_0::GridBase::GridBase
GridBase(const GridBase &other, ShallowCopy)
Copy another grid&#39;s metadata but share its transform.
Definition: Grid.h:404
openvdb::v3_1_0::GridCPtrSet
std::set< GridBase::ConstPtr > GridCPtrSet
Definition: Grid.h:435
openvdb::v3_1_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::GridType
Grid< TreeType > GridType
Definition: Grid.h:946
openvdb::v3_1_0::GridBase::META_FILE_VOXEL_COUNT
static const char *const META_FILE_VOXEL_COUNT
Definition: Grid.h:289
openvdb::v3_1_0::GridBase::META_VECTOR_TYPE
static const char *const META_VECTOR_TYPE
Definition: Grid.h:284
openvdb::v3_1_0::Grid::ValueOffIter
_TreeType::ValueOffIter ValueOffIter
Definition: Grid.h:495
openvdb::v3_1_0::Grid::TreePtrType
_TreeType::Ptr TreePtrType
Definition: Grid.h:489
openvdb::v3_1_0::GridBase::META_FILE_COMPRESSION
static const char *const META_FILE_COMPRESSION
Definition: Grid.h:287
openvdb::v3_1_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:998
openvdb::v3_1_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_1_0::GridBase::META_IS_LOCAL_SPACE
static const char *const META_IS_LOCAL_SPACE
Definition: Grid.h:283
openvdb::v3_1_0::TreeBase
tree::TreeBase TreeBase
Definition: Grid.h:52
openvdb::v3_1_0::Grid::Grid
Grid()
Construct a new grid with background value zero.
Definition: Grid.h:1032
Tree.h
openvdb::v3_1_0::TreeAdapter::constTree
static const TreeType & constTree(const GridType &g)
Definition: Grid.h:904
openvdb::v3_1_0::TreeAdapter::GridPtrType
GridType::Ptr GridPtrType
Definition: Grid.h:889
openvdb::v3_1_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:736
openvdb::v3_1_0::GridBase::Ptr
boost::shared_ptr< GridBase > Ptr
Definition: Grid.h:106
openvdb::v3_1_0::TreeAdapter< Grid< _TreeType > >::constTree
static const TreeType & constTree(const GridType &g)
Definition: Grid.h:934
openvdb::v3_1_0::tree::TreeBase
Base class for typed trees.
Definition: Tree.h:63
openvdb::v3_1_0::GridCPtrSetPtr
boost::shared_ptr< GridCPtrSet > GridCPtrSetPtr
Definition: Grid.h:438
openvdb::v3_1_0::GridCPtrVecIter
GridCPtrVec::iterator GridCPtrVecIter
Definition: Grid.h:426
openvdb::v3_1_0::Grid::Ptr
boost::shared_ptr< Grid > Ptr
Definition: Grid.h:485
openvdb::v3_1_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:1310
openvdb::v3_1_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:1204
openvdb::v3_1_0::GridBase::GridBase
GridBase(const GridBase &other)
Deep copy another grid&#39;s metadata and transform.
Definition: Grid.h:401
openvdb::v3_1_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::TreeType
_TreeType TreeType
Definition: Grid.h:941
openvdb::v3_1_0::GridClass
GridClass
Definition: Types.h:204
openvdb::v3_1_0::Grid
Container class that associates a tree with a transform and metadata.
Definition: Grid.h:54
openvdb::v3_1_0::TreeAdapter< Grid< _TreeType > >::TreeType
_TreeType TreeType
Definition: Grid.h:912
openvdb::v3_1_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:734
openvdb::v3_1_0::Grid::create
static Ptr create()
Return a new grid with background value zero.
Definition: Grid.h:1086
openvdb::v3_1_0::Grid::activeVoxelCount
virtual Index64 activeVoxelCount() const
Return the number of active voxels.
Definition: Grid.h:716
openvdb::v3_1_0::TreeAdapter< Grid< _TreeType > >::NonConstGridType
Grid< NonConstTreeType > NonConstGridType
Definition: Grid.h:918
Exceptions.h
openvdb::v3_1_0::Grid::ConstUnsafeAccessor
tree::ValueAccessor< const _TreeType, false > ConstUnsafeAccessor
Definition: Grid.h:503
openvdb::v3_1_0::TreeAdapter< Grid< _TreeType > >::NonConstAccessorType
tree::ValueAccessor< NonConstTreeType > NonConstAccessorType
Definition: Grid.h:925
openvdb::v3_1_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::ValueType
TreeType::ValueType ValueType
Definition: Grid.h:951
openvdb::v3_1_0::GridBase::setTransform
void setTransform(math::Transform::Ptr)
Associate the given transform with this grid, in place of its existing transform. ...
Definition: Grid.h:1021
openvdb::v3_1_0::TreeAdapter::TreeType
_TreeType TreeType
Definition: Grid.h:882
OPENVDB_VERSION_NAME
#define OPENVDB_VERSION_NAME
Definition: version.h:43
openvdb::v3_1_0::Grid::ValueOnIter
_TreeType::ValueOnIter ValueOnIter
Definition: Grid.h:493
openvdb::v3_1_0::Grid::setTree
virtual void setTree(TreeBase::Ptr)
Associate the given tree with this grid, in place of its existing tree.
Definition: Grid.h:1156
openvdb::v3_1_0::TreeAdapter::tree
static TreeType & tree(GridType &g)
Definition: Grid.h:898
openvdb::v3_1_0::GridBase::~GridBase
virtual ~GridBase()
Definition: Grid.h:112
openvdb::v3_1_0::TreeAdapter::NonConstGridType
Grid< NonConstTreeType > NonConstGridType
Definition: Grid.h:888
openvdb::v3_1_0::Grid::getConstAccessor
ConstAccessor getConstAccessor() const
Return an accessor that provides random read-only access to this grid&#39;s voxels.
Definition: Grid.h:606
openvdb::v3_1_0::Grid::cbeginValueAll
ValueAllCIter cbeginValueAll() const
Return an iterator over all of this grid&#39;s values (tile and voxel).
Definition: Grid.h:634
openvdb::v3_1_0::Grid::ValueOnCIter
_TreeType::ValueOnCIter ValueOnCIter
Definition: Grid.h:494
openvdb::v3_1_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_1_0::Grid::UnsafeAccessor
tree::ValueAccessor< _TreeType, false > UnsafeAccessor
Definition: Grid.h:502
openvdb::v3_1_0::TreeAdapter::ConstGridPtrType
GridType::ConstPtr ConstGridPtrType
Definition: Grid.h:891
openvdb::v3_1_0::GridPtrSetCIter
GridPtrSet::const_iterator GridPtrSetCIter
Definition: Grid.h:432
openvdb::v3_1_0::TreeAdapter< Grid< _TreeType > >::TreePtrType
TreeType::Ptr TreePtrType
Definition: Grid.h:914
openvdb::v3_1_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:976
openvdb::v3_1_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::constTree
static const TreeType & constTree(TreeType &t)
Definition: Grid.h:962
openvdb::v3_1_0::GridNamePred
Predicate functor that returns true for grids that have a specified name.
Definition: Grid.h:442
openvdb::v3_1_0::GridBase::META_SAVE_HALF_FLOAT
static const char *const META_SAVE_HALF_FLOAT
Definition: Grid.h:282
openvdb::v3_1_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:512
openvdb::v3_1_0::math::Transform::Ptr
boost::shared_ptr< Transform > Ptr
Definition: Transform.h:69
openvdb::v3_1_0::VecType
VecType
Definition: Types.h:234
openvdb::v3_1_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_1_0::GridBase::hasUniformVoxels
bool hasUniformVoxels() const
Return true if the voxels in world space are uniformly sized cubes.
Definition: Grid.h:352
openvdb::v3_1_0::Grid::writeBuffers
virtual void writeBuffers(std::ostream &) const
Write out all data buffers for this grid.
Definition: Grid.h:1320
openvdb::v3_1_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:578
openvdb::v3_1_0::Grid::evalActiveVoxelDim
virtual Coord evalActiveVoxelDim() const
Return the dimensions of the axis-aligned bounding box of all active voxels.
Definition: Grid.h:1260
openvdb::v3_1_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:565
openvdb::v3_1_0::GridBase::unregisterGrid
static void unregisterGrid(const Name &type)
Remove a grid type from the registry.
openvdb::v3_1_0::TreeAdapter::GridType
Grid< TreeType > GridType
Definition: Grid.h:887
openvdb::v3_1_0::TreeAdapter< Grid< _TreeType > >::constTree
static const TreeType & constTree(GridType &g)
Definition: Grid.h:932
openvdb::v3_1_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_1_0::Name
std::string Name
Definition: Name.h:44
openvdb::v3_1_0::Grid::ValueAllIter
_TreeType::ValueAllIter ValueAllIter
Definition: Grid.h:497
openvdb
Definition: Exceptions.h:39
openvdb::v3_1_0::TreeAdapter::tree
static const TreeType & tree(const TreeType &t)
Definition: Grid.h:899
openvdb::v3_1_0::Grid::unregisterGrid
static void unregisterGrid()
Remove this grid type from the registry.
Definition: Grid.h:797
openvdb::v3_1_0::TreeAdapter< Grid< _TreeType > >::NonConstGridPtrType
NonConstGridType::Ptr NonConstGridPtrType
Definition: Grid.h:920
openvdb::v3_1_0::GridBase::META_GRID_NAME
static const char *const META_GRID_NAME
Definition: Grid.h:281
openvdb::v3_1_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::ConstAccessorType
tree::ValueAccessor< const TreeType > ConstAccessorType
Definition: Grid.h:953
openvdb::v3_1_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::GridPtrType
GridType::Ptr GridPtrType
Definition: Grid.h:948
openvdb::v3_1_0::TreeAdapter< Grid< _TreeType > >::tree
static const TreeType & tree(const TreeType &t)
Definition: Grid.h:929
openvdb::v3_1_0::Grid::getUnsafeAccessor
Accessor 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:602
openvdb::v3_1_0::CP_SHARE
Definition: Types.h:411
openvdb::v3_1_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::NonConstAccessorType
tree::ValueAccessor< NonConstTreeType > NonConstAccessorType
Definition: Grid.h:954
openvdb::v3_1_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::NonConstGridType
Grid< NonConstTreeType > NonConstGridType
Definition: Grid.h:947
openvdb::v3_1_0::GridBase::ConstPtr
boost::shared_ptr< const GridBase > ConstPtr
Definition: Grid.h:107
openvdb::v3_1_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:880
openvdb::v3_1_0::GridPtrSetPtr
boost::shared_ptr< GridPtrSet > GridPtrSetPtr
Definition: Grid.h:433
openvdb::v3_1_0::TreeAdapter::constTree
static const TreeType & constTree(const TreeType &t)
Definition: Grid.h:903
openvdb::v3_1_0::MetaMap::endMeta
MetaIterator endMeta()
Definition: MetaMap.h:112
openvdb::v3_1_0::math::Vec3d
Vec3< double > Vec3d
Definition: Vec3.h:643
openvdb::v3_1_0::GRID_LEVEL_SET
Definition: Types.h:206
openvdb::v3_1_0::Grid::ConstPtr
boost::shared_ptr< const Grid > ConstPtr
Definition: Grid.h:486
openvdb::v3_1_0::TreeAdapter::ValueType
TreeType::ValueType ValueType
Definition: Grid.h:892
openvdb::v3_1_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::tree
static const TreeType & tree(const TreeType &t)
Definition: Grid.h:959
openvdb::v3_1_0::GridPtrVecPtr
boost::shared_ptr< GridPtrVec > GridPtrVecPtr
Definition: Grid.h:423
openvdb::v3_1_0::Grid::ValueAllCIter
_TreeType::ValueAllCIter ValueAllCIter
Definition: Grid.h:498
openvdb::v3_1_0::math::BBox< Vec3d >
openvdb::v3_1_0::Grid::cbeginValueOn
ValueOnCIter cbeginValueOn() const
Return an iterator over all of this grid&#39;s active values (tile and voxel).
Definition: Grid.h:622
openvdb::v3_1_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_1_0::math::Transform::print
void print(std::ostream &os=std::cout, const std::string &indent="") const
Print a description of this transform.
openvdb::v3_1_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::constTree
static const TreeType & constTree(const GridType &g)
Definition: Grid.h:965
openvdb::v3_1_0::GridBase::isRegistered
static bool isRegistered(const Name &type)
Return true if the given grid type name is registered.
openvdb::v3_1_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:1213
openvdb::v3_1_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:1124
openvdb::v3_1_0::MetaMap::metaCount
size_t metaCount() const
Definition: MetaMap.h:118
openvdb::v3_1_0::Grid::ValueType
_TreeType::ValueType ValueType
Definition: Grid.h:491
openvdb::v3_1_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:745
openvdb::v3_1_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_1_0::GridPtrVec
std::vector< GridBase::Ptr > GridPtrVec
Definition: Grid.h:420
openvdb::v3_1_0::Real
double Real
Definition: Types.h:64
openvdb::v3_1_0::Grid::pruneGrid
virtual void pruneGrid(float tolerance=0.0)
Reduce the memory footprint of this grid by increasing its sparseness.
Definition: Grid.h:1187
openvdb::v3_1_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::tree
static const TreeType & tree(const GridType &g)
Definition: Grid.h:960
openvdb::v3_1_0::Grid::ConstTreePtrType
_TreeType::ConstPtr ConstTreePtrType
Definition: Grid.h:490
openvdb::v3_1_0::tree::ValueAccessor
Definition: ValueAccessor.h:219
openvdb::v3_1_0::Grid::gridType
static Name gridType()
Return the name of this type of grid.
Definition: Grid.h:571
openvdb::v3_1_0::GridCPtrVec
std::vector< GridBase::ConstPtr > GridCPtrVec
Definition: Grid.h:425
openvdb::v3_1_0::Grid::beginValueOn
ValueOnCIter beginValueOn() const
Return an iterator over all of this grid&#39;s active values (tile and voxel).
Definition: Grid.h:621
openvdb::v3_1_0::TreeAdapter::tree
static TreeType & tree(TreeType &t)
Definition: Grid.h:897
openvdb::v3_1_0::GridBase::readTransform
void readTransform(std::istream &is)
Read in the transform for this grid.
Definition: Grid.h:388
openvdb::v3_1_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_1_0::Index64
uint64_t Index64
Definition: Types.h:57
openvdb::v3_1_0::CopyPolicy
CopyPolicy
Definition: Types.h:411
openvdb::v3_1_0::ShallowCopy
Definition: Types.h:416
openvdb::v3_1_0::GridBase::META_FILE_MEM_BYTES
static const char *const META_FILE_MEM_BYTES
Definition: Grid.h:288
openvdb::v3_1_0::TreeAdapter::constTree
static const TreeType & constTree(GridType &g)
Definition: Grid.h:902
openvdb::v3_1_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:1180
openvdb::v3_1_0::Grid::clip
virtual void clip(const CoordBBox &)
Clip this grid to the given index-space bounding box.
Definition: Grid.h:1195
openvdb::v3_1_0::GridBase::GridBase
GridBase()
Initialize with an identity linear transform.
Definition: Grid.h:398
openvdb::v3_1_0::Grid::newTree
virtual void newTree()
Associate a new, empty tree with this grid, in place of its existing tree.
Definition: Grid.h:1169
openvdb::v3_1_0::Grid::ConstAccessor
tree::ValueAccessor< const _TreeType, true > ConstAccessor
Definition: Grid.h:501
openvdb::v3_1_0::TreeAdapter::constTree
static const TreeType & constTree(TreeType &t)
Definition: Grid.h:901
openvdb::v3_1_0::GridBase::META_FILE_BBOX_MAX
static const char *const META_FILE_BBOX_MAX
Definition: Grid.h:286
openvdb::v3_1_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:1371
openvdb::v3_1_0::GridPtrSet
std::set< GridBase::Ptr > GridPtrSet
Definition: Grid.h:430
openvdb::v3_1_0::GridCPtrSetCIter
GridCPtrSet::const_iterator GridCPtrSetCIter
Definition: Grid.h:437
openvdb::v3_1_0::Grid::~Grid
virtual ~Grid()
Definition: Grid.h:551
openvdb::v3_1_0::math::Transform::createLinearTransform
static Transform::Ptr createLinearTransform(double voxelSize=1.0)
Create and return a shared pointer to a new transform.
openvdb::v3_1_0::TreeAdapter< Grid< _TreeType > >::GridType
Grid< TreeType > GridType
Definition: Grid.h:917
OPENVDB_USE_VERSION_NAMESPACE
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:71
openvdb::v3_1_0::TreeAdapter::ConstTreePtrType
TreeType::ConstPtr ConstTreePtrType
Definition: Grid.h:885
openvdb::v3_1_0::TreeAdapter::NonConstTreeType
boost::remove_const< TreeType >::type NonConstTreeType
Definition: Grid.h:883
openvdb::v3_1_0::Grid::isRegistered
static bool isRegistered()
Return true if this grid type is registered.
Definition: Grid.h:793
openvdb::v3_1_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:1014
openvdb::v3_1_0::Grid::readBuffers
virtual void readBuffers(std::istream &)
Read all data buffers for this grid.
Definition: Grid.h:1292
openvdb::v3_1_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_1_0::GridBase::registerGrid
static void registerGrid(const Name &type, GridFactory)
Register a grid type along with a factory function.
openvdb::v3_1_0::TreeAdapter::NonConstTreePtrType
NonConstTreeType::Ptr NonConstTreePtrType
Definition: Grid.h:886
openvdb::v3_1_0::GridPtrSetIter
GridPtrSet::iterator GridPtrSetIter
Definition: Grid.h:431
openvdb::v3_1_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:865
openvdb::v3_1_0::GridCPtrVecPtr
boost::shared_ptr< GridCPtrVec > GridCPtrVecPtr
Definition: Grid.h:428
openvdb::v3_1_0::TypeError
Definition: Exceptions.h:87
openvdb::v3_1_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::NonConstTreeType
boost::remove_const< TreeType >::type NonConstTreeType
Definition: Grid.h:942
openvdb::v3_1_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_1_0::Grid::evalActiveVoxelBoundingBox
virtual CoordBBox evalActiveVoxelBoundingBox() const
Return the axis-aligned bounding box of all active voxels.
Definition: Grid.h:1250
openvdb::v3_1_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::NonConstGridPtrType
NonConstGridType::Ptr NonConstGridPtrType
Definition: Grid.h:949
openvdb::v3_1_0::TreeAdapter::tree
static const TreeType & tree(const GridType &g)
Definition: Grid.h:900
openvdb::v3_1_0::Grid::registerGrid
static void registerGrid()
Register this grid type along with a factory function.
Definition: Grid.h:795
openvdb::v3_1_0::GridBase::saveFloatAsHalf
bool saveFloatAsHalf() const
Return true if this grid should be written out with floating-point voxel values (including components...
openvdb::v3_1_0::GridPtrVecIter
GridPtrVec::iterator GridPtrVecIter
Definition: Grid.h:421
openvdb::v3_1_0::Grid::beginValueOff
ValueOffCIter beginValueOff() const
Return an iterator over all of this grid&#39;s inactive values (tile and voxel).
Definition: Grid.h:627
openvdb::v3_1_0::math::Transform::ConstPtr
boost::shared_ptr< const Transform > ConstPtr
Definition: Transform.h:70
openvdb::v3_1_0::LEVEL_SET_HALF_WIDTH
static const Real LEVEL_SET_HALF_WIDTH
Definition: Types.h:212
openvdb::v3_1_0::TreeAdapter::NonConstGridPtrType
NonConstGridType::Ptr NonConstGridPtrType
Definition: Grid.h:890
openvdb::v3_1_0::TreeAdapter::ConstAccessorType
tree::ValueAccessor< const TreeType > ConstAccessorType
Definition: Grid.h:894
openvdb::v3_1_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::constTree
static const TreeType & constTree(GridType &g)
Definition: Grid.h:963
openvdb::v3_1_0::MERGE_ACTIVE_STATES
Definition: Types.h:258
openvdb::v3_1_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_1_0::CP_NEW
Definition: Types.h:411
openvdb::v3_1_0::TreeAdapter< tree::ValueAccessor< _TreeType > >::TreePtrType
TreeType::Ptr TreePtrType
Definition: Grid.h:943
Name.h
openvdb::v3_1_0::GridNamePred::operator()
bool operator()(const GridBase::ConstPtr &g) const
Definition: Grid.h:445
openvdb::v3_1_0::Grid::cbeginValueOff
ValueOffCIter cbeginValueOff() const
Return an iterator over all of this grid&#39;s inactive values (tile and voxel).
Definition: Grid.h:628
openvdb::v3_1_0::GridNamePred::GridNamePred
GridNamePred(const Name &_name)
Definition: Grid.h:444
openvdb::v3_1_0::TreeAdapter< Grid< _TreeType > >::constTree
static const TreeType & constTree(const TreeType &t)
Definition: Grid.h:933
openvdb::v3_1_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_1_0::Grid::ValueConverter::Type
Grid< typename TreeType::template ValueConverter< OtherValueType >::Type > Type
Definition: Grid.h:513