Skip to content

Commit e3ac780

Browse files
committed
Add TreeAdapter partial specialization for AdaptiveAccessor
1 parent a87e8b9 commit e3ac780

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

openvdb/openvdb/adaptive/AdaptiveGrid.h

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,51 @@ using FloatAdaptiveGrid = AdaptiveGrid<float>;
240240
using AdaptiveGridTypes = TypeList<FloatAdaptiveGrid>;
241241

242242
} // namespace adaptive
243+
244+
245+
////////////////////////////////////////
246+
247+
/// Partial specialization for AdaptiveAccessor types
248+
template<typename _TreeType>
249+
struct TreeAdapter<adaptive::AdaptiveAccessor<_TreeType> >
250+
{
251+
using TreeType = _TreeType;
252+
using NonConstTreeType = typename std::remove_const<TreeType>::type;
253+
using TreePtrType = typename TreeType::Ptr;
254+
using ConstTreePtrType = typename TreeType::ConstPtr;
255+
using NonConstTreePtrType = typename NonConstTreeType::Ptr;
256+
using GridType = Grid<TreeType>;
257+
using NonConstGridType = Grid<NonConstTreeType>;
258+
using GridPtrType = typename GridType::Ptr;
259+
using NonConstGridPtrType = typename NonConstGridType::Ptr;
260+
using ConstGridPtrType = typename GridType::ConstPtr;
261+
using ValueType = typename TreeType::ValueType;
262+
using AccessorType = typename adaptive::AdaptiveAccessor<TreeType>;
263+
using ConstAccessorType = typename adaptive::AdaptiveAccessor<const NonConstTreeType>;
264+
using NonConstAccessorType = typename adaptive::AdaptiveAccessor<NonConstTreeType>;
265+
266+
static NonConstTreeType& tree(NonConstTreeType& t) { return t; }
267+
static NonConstTreeType& tree(NonConstGridType& g) { return g.tree(); }
268+
static NonConstTreeType& tree(NonConstAccessorType& a) { return a.tree(); }
269+
static const NonConstTreeType& tree(ConstAccessorType& a) { return a.tree(); }
270+
static const NonConstTreeType& tree(const NonConstTreeType& t) { return t; }
271+
static const NonConstTreeType& tree(const NonConstGridType& g) { return g.tree(); }
272+
static const NonConstTreeType& tree(const NonConstAccessorType& a) { return a.tree(); }
273+
static const NonConstTreeType& tree(const ConstAccessorType& a) { return a.tree(); }
274+
static const NonConstTreeType& constTree(NonConstTreeType& t) { return t; }
275+
static const NonConstTreeType& constTree(NonConstGridType& g) { return g.constTree(); }
276+
static const NonConstTreeType& constTree(NonConstAccessorType& a) { return a.tree(); }
277+
static const NonConstTreeType& constTree(ConstAccessorType& a) { return a.tree(); }
278+
static const NonConstTreeType& constTree(const NonConstTreeType& t) { return t; }
279+
static const NonConstTreeType& constTree(const NonConstGridType& g) { return g.constTree(); }
280+
static const NonConstTreeType& constTree(const NonConstAccessorType& a) { return a.tree(); }
281+
static const NonConstTreeType& constTree(const ConstAccessorType& a) { return a.tree(); }
282+
};
283+
284+
285+
////////////////////////////////////////
286+
287+
243288
} // namespace OPENVDB_VERSION_NAME
244289
} // namespace openvdb
245290

0 commit comments

Comments
 (0)