OpenVDB  8.1.0
PointExecutable.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_POINT_EXECUTABLE_HAS_BEEN_INCLUDED
13 #define OPENVDB_AX_COMPILER_POINT_EXECUTABLE_HAS_BEEN_INCLUDED
14 
15 #include "CustomData.h"
16 #include "AttributeRegistry.h"
17 
18 #include <openvdb/openvdb.h>
19 #include <openvdb/version.h>
21 
22 #include <unordered_map>
23 
24 class TestPointExecutable;
25 
26 namespace llvm {
27 class ExecutionEngine;
28 class LLVMContext;
29 }
30 
31 namespace openvdb {
33 namespace OPENVDB_VERSION_NAME {
34 namespace ax {
35 
36 class Compiler;
37 
70 {
71 public:
72  using Ptr = std::shared_ptr<PointExecutable>;
73  ~PointExecutable();
74 
78  PointExecutable(const PointExecutable& other);
79 
81 
93  void execute(points::PointDataGrid& grid) const;
94 
96 
103  void setGroupExecution(const std::string& name);
106  const std::string& getGroupExecution() const;
107 
113  void setCreateMissing(const bool flag);
115  bool getCreateMissing() const;
116 
120  void setGrainSize(const size_t grain);
122  size_t getGrainSize() const;
123 
125 
126  // foward declaration of settings for this executable
127  struct Settings;
128 
129 private:
130  friend class Compiler;
131  friend class ::TestPointExecutable;
132 
147  PointExecutable(const std::shared_ptr<const llvm::LLVMContext>& context,
148  const std::shared_ptr<const llvm::ExecutionEngine>& engine,
149  const AttributeRegistry::ConstPtr& attributeRegistry,
150  const CustomData::ConstPtr& customData,
151  const std::unordered_map<std::string, uint64_t>& functions,
152  const ast::Tree& tree);
153 
154 private:
155  // The Context and ExecutionEngine must exist _only_ for object lifetime
156  // management. The ExecutionEngine must be destroyed before the Context
157  const std::shared_ptr<const llvm::LLVMContext> mContext;
158  const std::shared_ptr<const llvm::ExecutionEngine> mExecutionEngine;
159  const AttributeRegistry::ConstPtr mAttributeRegistry;
160  const CustomData::ConstPtr mCustomData;
161  const std::unordered_map<std::string, uint64_t> mFunctionAddresses;
162  std::unique_ptr<Settings> mSettings;
163 };
164 
165 } // namespace ax
166 } // namespace OPENVDB_VERSION_NAME
167 } // namespace openvdb
168 
169 #endif // OPENVDB_AX_COMPILER_POINT_EXECUTABLE_HAS_BEEN_INCLUDED
170 
llvm
Definition: Compiler.h:31
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
openvdb::v8_1::ax::ast::Tree
A Tree is the highest concrete (non-abstract) node in the entire AX AST hierarchy....
Definition: AST.h:561
CustomData.h
Access to the CustomData class which can provide custom user user data to the OpenVDB AX Compiler.
openvdb::v8_1::ax::CustomData::ConstPtr
std::shared_ptr< const CustomData > ConstPtr
Definition: CustomData.h:38
PointDataGrid.h
Attribute-owned data structure for points. Point attributes are stored in leaf nodes and ordered by v...
openvdb::v8_1::ax::AttributeRegistry::ConstPtr
std::shared_ptr< const AttributeRegistry > ConstPtr
Definition: AttributeRegistry.h:42
openvdb::v8_1::ax::PointExecutable
Object that encapsulates compiled AX code which can be executed on a collection of VDB Point Data gri...
Definition: PointExecutable.h:69
openvdb::v8_1::ax::Compiler
The compiler class. This holds an llvm context and set of compiler options, and constructs executable...
Definition: Compiler.h:49
AttributeRegistry.h
These classes contain lists of expected attributes and volumes which are populated by compiler during...
openvdb
Definition: openvdb/Exceptions.h:13
openvdb::v8_1::ax::PointExecutable::Ptr
std::shared_ptr< PointExecutable > Ptr
Definition: PointExecutable.h:72
openvdb::v8_1::Grid
Container class that associates a tree with a transform and metadata.
Definition: Grid.h:28
openvdb.h