Skip to content

Commit 4ff1d35

Browse files
committed
Point Kernel Refactoring for Codecs
Signed-off-by: Nick Avramoussis <[email protected]>
1 parent 8b727c6 commit 4ff1d35

File tree

19 files changed

+2607
-578
lines changed

19 files changed

+2607
-578
lines changed

openvdb/openvdb/points/PointConversion.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -237,14 +237,14 @@ template <typename T> struct ConversionTraits
237237
using WriteHandle = AttributeWriteHandle<T, UnknownCodec>;
238238
static T zero() { return zeroVal<T>(); }
239239
template <typename LeafT>
240-
static typename Handle::Ptr handleFromLeaf(LeafT& leaf, Index index) {
240+
static std::unique_ptr<Handle> handleFromLeaf(const LeafT& leaf, const Index index) {
241241
const AttributeArray& array = leaf.constAttributeArray(index);
242-
return Handle::create(array);
242+
return std::make_unique<Handle>(array);
243243
}
244244
template <typename LeafT>
245-
static typename WriteHandle::Ptr writeHandleFromLeaf(LeafT& leaf, Index index) {
245+
static std::unique_ptr<WriteHandle> writeHandleFromLeaf(LeafT& leaf, const Index index) {
246246
AttributeArray& array = leaf.attributeArray(index);
247-
return WriteHandle::create(array);
247+
return std::make_unique<WriteHandle>(array);
248248
}
249249
}; // ConversionTraits
250250
template <> struct ConversionTraits<openvdb::Name>
@@ -253,16 +253,16 @@ template <> struct ConversionTraits<openvdb::Name>
253253
using WriteHandle = StringAttributeWriteHandle;
254254
static openvdb::Name zero() { return ""; }
255255
template <typename LeafT>
256-
static typename Handle::Ptr handleFromLeaf(LeafT& leaf, Index index) {
256+
static std::unique_ptr<Handle> handleFromLeaf(const LeafT& leaf, const Index index) {
257257
const AttributeArray& array = leaf.constAttributeArray(index);
258258
const AttributeSet::Descriptor& descriptor = leaf.attributeSet().descriptor();
259-
return Handle::create(array, descriptor.getMetadata());
259+
return std::make_unique<Handle>(array, descriptor.getMetadata());
260260
}
261261
template <typename LeafT>
262-
static typename WriteHandle::Ptr writeHandleFromLeaf(LeafT& leaf, Index index) {
262+
static std::unique_ptr<WriteHandle> writeHandleFromLeaf(LeafT& leaf, const Index index) {
263263
AttributeArray& array = leaf.attributeArray(index);
264264
const AttributeSet::Descriptor& descriptor = leaf.attributeSet().descriptor();
265-
return WriteHandle::create(array, descriptor.getMetadata());
265+
return std::make_unique<WriteHandle>(array, descriptor.getMetadata());
266266
}
267267
}; // ConversionTraits<openvdb::Name>
268268

@@ -298,7 +298,7 @@ struct PopulateAttributeOp {
298298

299299
if (!pointIndexLeaf) continue;
300300

301-
typename HandleT::Ptr attributeWriteHandle =
301+
auto attributeWriteHandle =
302302
ConversionTraits<ValueType>::writeHandleFromLeaf(*leaf, static_cast<Index>(mIndex));
303303

304304
Index64 index = 0;
@@ -474,7 +474,7 @@ struct ConvertPointDataGridAttributeOp {
474474

475475
if (leaf.pos() > 0) offset += mPointOffsets[leaf.pos() - 1];
476476

477-
typename SourceHandleT::Ptr handle = ConversionTraits<ValueType>::handleFromLeaf(
477+
auto handle = ConversionTraits<ValueType>::handleFromLeaf(
478478
*leaf, static_cast<Index>(mIndex));
479479

480480
if (mFilter.state() == index::ALL) {

openvdb_ax/openvdb_ax/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ set(OPENVDB_AX_LIBRARY_SOURCE_FILES
132132
ast/PrintTree.cc
133133
ast/Scanners.cc
134134
ax.cc
135+
codegen/Codecs.cc
135136
codegen/ComputeGenerator.cc
136137
codegen/FunctionRegistry.cc
137138
codegen/FunctionTypes.cc
@@ -169,6 +170,7 @@ set(OPENVDB_AX_AST_INCLUDE_FILES
169170
)
170171

171172
set(OPENVDB_AX_CODEGEN_INCLUDE_FILES
173+
codegen/Codecs.h
172174
codegen/ComputeGenerator.h
173175
codegen/ConstantFolding.h
174176
codegen/FunctionRegistry.h

0 commit comments

Comments
 (0)