OpenVDB: VolumeExecutable.h Source File

OpenVDB 8.1.0

VolumeExecutable.h
Go to the documentation of this file.
1 // Copyright Contributors to the OpenVDB Project
2 // SPDX-License-Identifier: MPL-2.0
3
11
12 #ifndef OPENVDB_AX_COMPILER_VOLUME_EXECUTABLE_HAS_BEEN_INCLUDED
13 #define OPENVDB_AX_COMPILER_VOLUME_EXECUTABLE_HAS_BEEN_INCLUDED
14
15 #include "CustomData.h"
16 #include "AttributeRegistry.h"
17
18 #include <openvdb/version.h>
19 #include <openvdb/Grid.h>
20
21 #include <unordered_map>
22
23 class TestVolumeExecutable;
24
25 namespace llvm {
26 class ExecutionEngine;
27 class LLVMContext;
28 }
29
30 namespace openvdb {
31 OPENVDB_USE_VERSION_NAMESPACE
32 namespace OPENVDB_VERSION_NAME {
33 namespace ax {
34
35 class Compiler;
36
75 class VolumeExecutable
76 {
77 public:
78 using Ptr = std::shared_ptr<VolumeExecutable>;
79 ~VolumeExecutable();
80
84 VolumeExecutable(const VolumeExecutable& other);
85
87
99 void execute(openvdb::GridPtrVec& grids) const;
100 void execute(openvdb::GridBase& grids) const;
102
104
109 void setCreateMissing(const bool flag);
111 bool getCreateMissing() const;
112
125 void setTreeExecutionLevel(const Index min, const Index max);
128 void setTreeExecutionLevel(const Index level);
132 void getTreeExecutionLevel(Index& min, Index& max) const;
133
193 enum class Streaming { ON, OFF, AUTO };
196 void setActiveTileStreaming(const Streaming& s);
198 Streaming getActiveTileStreaming() const;
203 Streaming getActiveTileStreaming(const std::string& name,
204 const ast::tokens::CoreType& type) const;
205
206 enum class IterType { ON, OFF, ALL };
210 void setValueIterator(const IterType& iter);
212 IterType getValueIterator() const;
213
231 void setGrainSize(const size_t g1);
232 void setActiveTileStreamingGrainSize(const size_t g2);
235 size_t getGrainSize() const;
238 size_t getActiveTileStreamingGrainSize() const;
240
241
242
244
246 [[deprecated]] Index getTreeExecutionLevel() const;
247
249
250 // foward declaration of settings for this executable
251 struct Settings;
252
253 private:
254 friend class Compiler;
255 friend class ::TestVolumeExecutable;
256
271 VolumeExecutable(const std::shared_ptr<const llvm::LLVMContext>& context,
272 const std::shared_ptr<const llvm::ExecutionEngine>& engine,
273 const AttributeRegistry::ConstPtr& accessRegistry,
274 const CustomData::ConstPtr& customData,
275 const std::unordered_map<std::string, uint64_t>& functions,
276 const ast::Tree& tree);
277
278 private:
279 // The Context and ExecutionEngine must exist _only_ for object lifetime
280 // management. The ExecutionEngine must be destroyed before the Context
281 const std::shared_ptr<const llvm::LLVMContext> mContext;
282 const std::shared_ptr<const llvm::ExecutionEngine> mExecutionEngine;
283 const AttributeRegistry::ConstPtr mAttributeRegistry;
284 const CustomData::ConstPtr mCustomData;
285 const std::unordered_map<std::string, uint64_t> mFunctionAddresses;
286 std::unique_ptr<Settings> mSettings;
287 };
288
289 } // namespace ax
290 } // namespace OPENVDB_VERSION_NAME
291 } // namespace openvdb
292
293 #endif // OPENVDB_AX_COMPILER_VOLUME_EXECUTABLE_HAS_BEEN_INCLUDED
294
AttributeRegistry.h
These classes contain lists of expected attributes and volumes which are populated by compiler during...
CustomData.h
Access to the CustomData class which can provide custom user user data to the OpenVDB AX Compiler.
Grid.h
openvdb::v8_1::GridBase
Abstract base class for typed grids.
Definition: Grid.h:78
openvdb::v8_1::ax::AttributeRegistry::ConstPtr
std::shared_ptr< const AttributeRegistry > ConstPtr
Definition: AttributeRegistry.h:42
openvdb::v8_1::ax::Compiler
The compiler class. This holds an llvm context and set of compiler options, and constructs executable...
Definition: Compiler.h:50
openvdb::v8_1::ax::CustomData::ConstPtr
std::shared_ptr< const CustomData > ConstPtr
Definition: CustomData.h:38
openvdb::v8_1::ax::VolumeExecutable
Object that encapsulates compiled AX code which can be executed on a collection of VDB volume grids....
Definition: VolumeExecutable.h:76
openvdb::v8_1::ax::VolumeExecutable::setActiveTileStreamingGrainSize
void setActiveTileStreamingGrainSize(const size_t g2)
Set the threading grain sizes used when iterating over nodes in a VDB.
openvdb::v8_1::ax::VolumeExecutable::setCreateMissing
void setCreateMissing(const bool flag)
Set the behaviour when missing grids are accessed. Default behaviour is true, which creates them with...
openvdb::v8_1::ax::VolumeExecutable::getTreeExecutionLevel
Index getTreeExecutionLevel() const
openvdb::v8_1::ax::VolumeExecutable::execute
void execute(openvdb::GridBase &grids) const
Run this volume executable binary on target volumes.
openvdb::v8_1::ax::VolumeExecutable::getTreeExecutionLevel
void getTreeExecutionLevel(Index &min, Index &max) const
Get the tree execution levels.
openvdb::v8_1::ax::VolumeExecutable::getActiveTileStreaming
Streaming getActiveTileStreaming() const
openvdb::v8_1::ax::VolumeExecutable::getValueIterator
IterType getValueIterator() const
openvdb::v8_1::ax::VolumeExecutable::Ptr
std::shared_ptr< VolumeExecutable > Ptr
Definition: VolumeExecutable.h:78
openvdb::v8_1::ax::VolumeExecutable::setValueIterator
void setValueIterator(const IterType &iter)
Set the value iterator type to use with this executable. Options are ON, OFF, ALL....
openvdb::v8_1::ax::VolumeExecutable::setActiveTileStreaming
void setActiveTileStreaming(const Streaming &s)
Controls the behaviour of expansion of active tiles.
openvdb::v8_1::ax::VolumeExecutable::setGrainSize
void setGrainSize(const size_t g1)
Set the threading grain sizes used when iterating over nodes in a VDB.
openvdb::v8_1::ax::VolumeExecutable::getActiveTileStreaming
Streaming getActiveTileStreaming(const std::string &name, const ast::tokens::CoreType &type) const
openvdb::v8_1::ax::VolumeExecutable::getGrainSize
size_t getGrainSize() const
openvdb::v8_1::ax::VolumeExecutable::setTreeExecutionLevel
void setTreeExecutionLevel(const Index min, const Index max)
Set the execution level for this executable. This controls what nodes are processed when execute is c...
openvdb::v8_1::ax::VolumeExecutable::~VolumeExecutable
~VolumeExecutable()
openvdb::v8_1::ax::VolumeExecutable::Streaming
Streaming
The streaming type of active tiles during execution.
Definition: VolumeExecutable.h:193
openvdb::v8_1::ax::VolumeExecutable::getCreateMissing
bool getCreateMissing() const
openvdb::v8_1::ax::VolumeExecutable::setTreeExecutionLevel
void setTreeExecutionLevel(const Index level)
openvdb::v8_1::ax::VolumeExecutable::IterType
IterType
Definition: VolumeExecutable.h:206
openvdb::v8_1::ax::VolumeExecutable::execute
void execute(openvdb::GridPtrVec &grids) const
Run this volume executable binary on target volumes.
openvdb::v8_1::ax::VolumeExecutable::getActiveTileStreamingGrainSize
size_t getActiveTileStreamingGrainSize() const
openvdb::v8_1::ax::VolumeExecutable::VolumeExecutable
VolumeExecutable(const VolumeExecutable &other)
Copy constructor. Shares the LLVM constructs but deep copies the settings. Multiple copies of an exec...
llvm
Definition: Compiler.h:31
openvdb::v8_1::ax::ast::tokens::CoreType
CoreType
Definition: Tokens.h:32
openvdb::v8_1::points::index::ALL
@ ALL
Definition: IndexIterator.h:43
openvdb::v8_1::tools::composite::max
const std::enable_if<!VecTraits< T >::IsVec, T >::type & max(const T &a, const T &b)
Definition: Composite.h:107
openvdb::v8_1::tools::composite::min
const std::enable_if<!VecTraits< T >::IsVec, T >::type & min(const T &a, const T &b)
Definition: Composite.h:103
openvdb::v8_1::GridPtrVec
std::vector< GridBase::Ptr > GridPtrVec
Definition: Grid.h:514
openvdb::v8_1::Index
Index32 Index
Definition: openvdb/Types.h:50
openvdb
Definition: openvdb/Exceptions.h:13
openvdb::v8_1::ax::ast::Tree
A Tree is the highest concrete (non-abstract) node in the entire AX AST hierarchy....
Definition: AST.h:562
OPENVDB_VERSION_NAME
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h.in:116
OPENVDB_USE_VERSION_NAMESPACE
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h.in:178