GCC Code Coverage Report


Directory: ./
File: openvdb_ax/openvdb_ax/codegen/PointFunctions.cc
Date: 2022-07-25 17:40:05
Exec Total Coverage
Lines: 239 239 100.0%
Functions: 57 57 100.0%
Branches: 292 564 51.8%

Line Branch Exec Source
1 // Copyright Contributors to the OpenVDB Project
2 // SPDX-License-Identifier: MPL-2.0
3
4 /// @file codegen/PointFunctions.cc
5 ///
6 /// @authors Nick Avramoussis, Richard Jones
7 ///
8 /// @brief Contains the function objects that define the functions used in
9 /// point compute function generation, to be inserted into the
10 /// FunctionRegistry. These define the functions available when operating
11 /// on points. Also includes the definitions for the point attribute
12 /// retrieval and setting.
13 ///
14
15 #include "Functions.h"
16 #include "FunctionTypes.h"
17 #include "Types.h"
18 #include "Utils.h"
19 #include "PointLeafLocalData.h"
20
21 #include "openvdb_ax/ast/Tokens.h"
22 #include "openvdb_ax/compiler/CompilerOptions.h"
23 #include "openvdb_ax/Exceptions.h"
24
25 #include <openvdb/openvdb.h>
26 #include <openvdb/points/PointDataGrid.h>
27
28 #include <unordered_map>
29
30 namespace openvdb {
31 OPENVDB_USE_VERSION_NAMESPACE
32 namespace OPENVDB_VERSION_NAME {
33
34 namespace ax {
35 namespace codegen {
36
37 namespace
38 {
39
40 #define OPENVDB_AX_CHECK_MODULE_CONTEXT(B) \
41 { \
42 const llvm::Function* F = B.GetInsertBlock()->getParent(); \
43 const llvm::Module* M = F ? F->getParent() : nullptr; \
44 if (!M || M->getName() != "ax.point.module") { \
45 OPENVDB_THROW(AXCompilerError, "Function \"" << (F ? F->getName().str() : "unknown") << \
46 "\" cannot be called for the current target:\"" << (M ? M->getName().str() : "unknown") << \
47 "\". This function only runs on OpenVDB Point Grids."); \
48 } \
49 }
50
51 /// @brief Retrieve a group handle from an expected vector of handles using the offset
52 /// pointed to by the engine data. Note that HandleT should only ever be a GroupHandle
53 /// or GroupWriteHandle object
54 template <typename HandleT>
55 inline HandleT*
56 groupHandle(const std::string& name, void** groupHandles, const void* const data)
57 {
58 const openvdb::points::AttributeSet* const attributeSet =
59 static_cast<const openvdb::points::AttributeSet*>(data);
60
61
2/4
✓ Branch 1 taken 49 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 47 times.
✗ Branch 5 not taken.
96 const size_t groupIdx = attributeSet->groupOffset(name);
62
4/4
✓ Branch 0 taken 7 times.
✓ Branch 1 taken 42 times.
✓ Branch 2 taken 17 times.
✓ Branch 3 taken 30 times.
96 if (groupIdx == openvdb::points::AttributeSet::INVALID_POS) return nullptr;
63
64 24 return static_cast<HandleT*>(groupHandles[groupIdx]);
65 }
66
67 }
68
69 ///////////////////////////////////////////////////////////////////////////////
70 ///////////////////////////////////////////////////////////////////////////////
71
72 24 inline FunctionGroup::UniquePtr ax_ingroup(const FunctionOptions& op)
73 {
74 static auto ingroup =
75 59 [](const codegen::String* const name,
76 const uint64_t index,
77 void** groupHandles,
78 const void* const leafDataPtr,
79 const void* const data) -> bool
80 {
81
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 59 times.
59 assert(name);
82
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 59 times.
59 assert(index < static_cast<uint64_t>(std::numeric_limits<openvdb::Index>::max()));
83
84
1/2
✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
59 if (name->size() == 0) return false;
85
2/2
✓ Branch 0 taken 47 times.
✓ Branch 1 taken 12 times.
59 if (!groupHandles) return false;
86
87 const std::string nameStr = name->str();
88 const openvdb::points::GroupHandle* handle =
89 groupHandle<openvdb::points::GroupHandle>(nameStr, groupHandles, data);
90
2/4
✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 17 times.
✗ Branch 4 not taken.
17 if (handle) return handle->get(static_cast<openvdb::Index>(index));
91
92 // If the handle doesn't exist, check to see if any new groups have
93 // been added
94 const codegen_internal::PointLeafLocalData* const leafData =
95 static_cast<const codegen_internal::PointLeafLocalData*>(leafDataPtr);
96 30 handle = leafData->get(nameStr);
97
4/6
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 26 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 4 times.
30 return handle ? handle->get(static_cast<openvdb::Index>(index)) : false;
98 };
99
100 using InGroup = bool(const codegen::String* const,
101 const uint64_t,
102 void**,
103 const void* const,
104 const void* const);
105
106 48 return FunctionBuilder("_ingroup")
107
1/2
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
24 .addSignature<InGroup>(ingroup)
108
1/2
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
24 .addParameterAttribute(0, llvm::Attribute::ReadOnly)
109
1/2
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
24 .addParameterAttribute(2, llvm::Attribute::ReadOnly)
110
1/2
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
24 .addParameterAttribute(2, llvm::Attribute::NoAlias)
111
1/2
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
24 .addParameterAttribute(3, llvm::Attribute::ReadOnly)
112
1/2
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
24 .addParameterAttribute(3, llvm::Attribute::NoAlias)
113
1/2
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
24 .addParameterAttribute(4, llvm::Attribute::ReadOnly)
114
1/2
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
24 .addParameterAttribute(4, llvm::Attribute::NoAlias)
115
1/2
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
24 .addFunctionAttribute(llvm::Attribute::ReadOnly)
116
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
24 .addFunctionAttribute(llvm::Attribute::NoRecurse)
117 // @note handle->get can throw, so no unwind. Maybe use getUnsafe?
118 .setConstantFold(false)
119
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
24 .setPreferredImpl(op.mPrioritiseIR ? FunctionBuilder::IR : FunctionBuilder::C)
120 .setDocumentation("Internal function for querying point group data")
121
1/2
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
48 .get();
122 }
123
124 7 inline FunctionGroup::UniquePtr axingroup(const FunctionOptions& op)
125 {
126 static auto generate =
127
1/2
✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
18 [op](const std::vector<llvm::Value*>& args,
128 llvm::IRBuilder<>& B) -> llvm::Value*
129 {
130
11/26
✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 18 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 17 times.
✓ Branch 5 taken 1 times.
✓ Branch 7 taken 17 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 1 times.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✓ Branch 20 taken 1 times.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✓ Branch 26 taken 1 times.
✗ Branch 27 not taken.
✓ Branch 30 taken 1 times.
✗ Branch 31 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
25 OPENVDB_AX_CHECK_MODULE_CONTEXT(B);
131 // Pull out parent function arguments
132 llvm::Function* compute = B.GetInsertBlock()->getParent();
133
2/4
✓ Branch 1 taken 17 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 17 times.
✗ Branch 5 not taken.
17 llvm::Value* point_index = extractArgument(compute, "point_index");
134
2/4
✓ Branch 1 taken 17 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 17 times.
✗ Branch 5 not taken.
17 llvm::Value* group_handles = extractArgument(compute, "group_handles");
135
2/4
✓ Branch 1 taken 17 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 17 times.
✗ Branch 5 not taken.
17 llvm::Value* leaf_data = extractArgument(compute, "leaf_data");
136
2/4
✓ Branch 1 taken 17 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 17 times.
✗ Branch 5 not taken.
17 llvm::Value* attribute_set = extractArgument(compute, "attribute_set");
137
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
17 assert(point_index);
138
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
17 assert(group_handles);
139
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
17 assert(leaf_data);
140
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
17 assert(attribute_set);
141
142 17 std::vector<llvm::Value*> input(args);
143
1/2
✓ Branch 1 taken 17 times.
✗ Branch 2 not taken.
17 input.emplace_back(point_index);
144
1/2
✓ Branch 1 taken 17 times.
✗ Branch 2 not taken.
17 input.emplace_back(group_handles);
145
1/2
✓ Branch 1 taken 17 times.
✗ Branch 2 not taken.
17 input.emplace_back(leaf_data);
146
1/2
✓ Branch 1 taken 17 times.
✗ Branch 2 not taken.
17 input.emplace_back(attribute_set);
147
3/8
✓ Branch 1 taken 17 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 17 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 17 times.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
34 return ax_ingroup(op)->execute(input, B);
148
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 6 times.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
7 };
149
150 7 return FunctionBuilder("ingroup")
151
1/2
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
14 .addSignature<bool(const codegen::String* const)>(generate)
152
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
7 .addDependency("_ingroup")
153 .setEmbedIR(true)
154 .setConstantFold(false)
155
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
7 .setPreferredImpl(op.mPrioritiseIR ? FunctionBuilder::IR : FunctionBuilder::C)
156 .setDocumentation( "Return whether or not the current point is "
157 "a member of the given group name. This returns false if the group does "
158 "not exist.")
159
1/2
✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
14 .get();
160 }
161
162 30 inline FunctionGroup::UniquePtr axeditgroup(const FunctionOptions& op)
163 {
164 static auto editgroup =
165 54 [](const codegen::String* const name,
166 const uint64_t index,
167 void** groupHandles,
168 void* const leafDataPtr,
169 const void* const data,
170 const bool flag)
171 {
172
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 54 times.
54 assert(name);
173
1/2
✓ Branch 0 taken 54 times.
✗ Branch 1 not taken.
58 if (name->size() == 0) return;
174
175 // Get the group handle out of the pre-existing container of handles if they
176 // exist
177
178 const std::string nameStr = name->str();
179 openvdb::points::GroupWriteHandle* handle = nullptr;
180
2/2
✓ Branch 0 taken 49 times.
✓ Branch 1 taken 5 times.
54 if (groupHandles) {
181 handle = groupHandle<openvdb::points::GroupWriteHandle>(nameStr, groupHandles, data);
182 }
183
184
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
7 if (!handle) {
185 codegen_internal::PointLeafLocalData* const leafData =
186 static_cast<codegen_internal::PointLeafLocalData*>(leafDataPtr);
187
188 // If we are setting membership and the handle doesn't exist, create in in
189 // the set of new data thats being added
190
4/4
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 41 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 4 times.
53 if (!flag && !leafData->hasGroup(nameStr)) return;
191
1/2
✓ Branch 1 taken 43 times.
✗ Branch 2 not taken.
43 handle = leafData->getOrInsert(nameStr);
192
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 43 times.
43 assert(handle);
193 }
194
195 // set the group membership
196
1/2
✓ Branch 1 taken 50 times.
✗ Branch 2 not taken.
50 handle->set(static_cast<openvdb::Index>(index), flag);
197 };
198
199 static auto editgroupcstar =
200 5 [](const char* const name,
201 const uint64_t index,
202 void** groupHandles,
203 void* const leafDataPtr,
204 const void* const data,
205 const bool flag)
206 {
207 const codegen::String str(name);
208
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 editgroup(&str, index, groupHandles, leafDataPtr, data, flag);
209 5 };
210
211 using EditGroup = void(const codegen::String* const,
212 const uint64_t,
213 void**,
214 void* const,
215 const void* const,
216 const bool);
217
218 using EditGroupCstar = void(const char* const,
219 const uint64_t,
220 void**,
221 void* const,
222 const void* const,
223 const bool);
224
225 60 return FunctionBuilder("editgroup")
226
1/2
✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
30 .addSignature<EditGroup>(editgroup)
227
1/2
✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
30 .addSignature<EditGroupCstar>(editgroupcstar)
228
1/2
✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
30 .addParameterAttribute(0, llvm::Attribute::ReadOnly)
229
1/2
✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
30 .addParameterAttribute(2, llvm::Attribute::ReadOnly)
230
1/2
✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
30 .addParameterAttribute(3, llvm::Attribute::ReadOnly)
231
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 30 times.
30 .addParameterAttribute(4, llvm::Attribute::ReadOnly)
232 .setConstantFold(false)
233
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 30 times.
30 .setPreferredImpl(op.mPrioritiseIR ? FunctionBuilder::IR : FunctionBuilder::C)
234 .setDocumentation("Internal function for setting point group data")
235
1/2
✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
60 .get();
236 }
237
238 15 inline FunctionGroup::UniquePtr axaddtogroup(const FunctionOptions& op)
239 {
240 static auto generate =
241
1/2
✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
18 [op](const std::vector<llvm::Value*>& args,
242 llvm::IRBuilder<>& B) -> llvm::Value*
243 {
244
11/26
✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 18 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 16 times.
✓ Branch 5 taken 2 times.
✓ Branch 7 taken 16 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 2 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 2 times.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✓ Branch 20 taken 2 times.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✓ Branch 26 taken 2 times.
✗ Branch 27 not taken.
✓ Branch 30 taken 2 times.
✗ Branch 31 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
32 OPENVDB_AX_CHECK_MODULE_CONTEXT(B);
245 // Pull out parent function arguments
246 llvm::Function* compute = B.GetInsertBlock()->getParent();
247
2/4
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
16 llvm::Value* point_index = extractArgument(compute, "point_index");
248
2/4
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
16 llvm::Value* group_handles = extractArgument(compute, "group_handles");
249
2/4
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
16 llvm::Value* leaf_data = extractArgument(compute, "leaf_data");
250
2/4
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
16 llvm::Value* attribute_set = extractArgument(compute, "attribute_set");
251
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
16 assert(point_index);
252
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
16 assert(group_handles);
253
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
16 assert(leaf_data);
254
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
16 assert(attribute_set);
255
256 16 std::vector<llvm::Value*> input(args);
257
1/2
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
16 input.emplace_back(point_index);
258
1/2
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
16 input.emplace_back(group_handles);
259
1/2
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
16 input.emplace_back(leaf_data);
260
1/2
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
16 input.emplace_back(attribute_set);
261
2/4
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
16 input.emplace_back(llvm::ConstantInt::get(LLVMType<bool>::get(B.getContext()), true));
262
3/8
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 16 times.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
32 return axeditgroup(op)->execute(input, B);
263
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 14 times.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
15 };
264
265 15 return FunctionBuilder("addtogroup")
266
1/2
✓ Branch 2 taken 15 times.
✗ Branch 3 not taken.
30 .addSignature<void(const codegen::String* const)>(generate)
267
2/6
✓ Branch 2 taken 15 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 15 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
30 .addSignature<void(const char* const)>(generate) // to support axdeletepoint() @todo fix
268
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 15 times.
15 .addDependency("editgroup")
269 .setEmbedIR(true)
270 .setConstantFold(false)
271
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 15 times.
15 .setPreferredImpl(op.mPrioritiseIR ? FunctionBuilder::IR : FunctionBuilder::C)
272 .setDocumentation("Add the current point to the given group "
273 "name, effectively setting its membership to true. If the group does not "
274 "exist, it is implicitly created. This function has no effect if the point "
275 "already belongs to the given group.")
276
1/2
✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
30 .get();
277 }
278
279 6 inline FunctionGroup::UniquePtr axremovefromgroup(const FunctionOptions& op)
280 {
281 static auto generate =
282
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 [op](const std::vector<llvm::Value*>& args,
283 llvm::IRBuilder<>& B) -> llvm::Value*
284 {
285 // Pull out parent function arguments
286
11/26
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✓ Branch 5 taken 1 times.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 1 times.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✓ Branch 20 taken 1 times.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✓ Branch 26 taken 1 times.
✗ Branch 27 not taken.
✓ Branch 30 taken 1 times.
✗ Branch 31 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
12 OPENVDB_AX_CHECK_MODULE_CONTEXT(B);
287 llvm::Function* compute = B.GetInsertBlock()->getParent();
288
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
4 llvm::Value* point_index = extractArgument(compute, "point_index");
289
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
4 llvm::Value* group_handles = extractArgument(compute, "group_handles");
290
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
4 llvm::Value* leaf_data = extractArgument(compute, "leaf_data");
291
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
4 llvm::Value* attribute_set = extractArgument(compute, "attribute_set");
292
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert(point_index);
293
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert(group_handles);
294
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert(leaf_data);
295
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 assert(attribute_set);
296
297 4 std::vector<llvm::Value*> input(args);
298
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 input.emplace_back(point_index);
299
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 input.emplace_back(group_handles);
300
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 input.emplace_back(leaf_data);
301
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 input.emplace_back(attribute_set);
302
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
4 input.emplace_back(llvm::ConstantInt::get(LLVMType<bool>::get(B.getContext()), false));
303
3/8
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
8 return axeditgroup(op)->execute(input, B);
304
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 5 times.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
6 };
305
306 6 return FunctionBuilder("removefromgroup")
307
1/2
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
12 .addSignature<void(const codegen::String* const)>(generate)
308
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 .addDependency("editgroup")
309 .setEmbedIR(true)
310 .setConstantFold(false)
311
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 .setPreferredImpl(op.mPrioritiseIR ? FunctionBuilder::IR : FunctionBuilder::C)
312 .setDocumentation("Remove the current point from the "
313 "given group name, effectively setting its membership to false. This "
314 "function has no effect if the group does not exist.")
315
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
12 .get();
316 }
317
318 7 inline FunctionGroup::UniquePtr axdeletepoint(const FunctionOptions& op)
319 {
320 static auto generate =
321 5 [op](const std::vector<llvm::Value*>&,
322 llvm::IRBuilder<>& B) -> llvm::Value*
323 {
324 // args guaranteed to be empty
325 5 const std::string deadGroup = "__ax_dead";
326
1/2
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
10 llvm::Constant* loc = llvm::cast<llvm::Constant>(B.CreateGlobalStringPtr(deadGroup.c_str())); // char*
327
4/6
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✓ Branch 8 taken 1 times.
11 return axaddtogroup(op)->execute({loc}, B);
328
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 6 times.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
7 };
329
330 7 return FunctionBuilder("deletepoint")
331
1/2
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
14 .addSignature<void()>(generate)
332
1/2
✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
7 .addDependency("addtogroup")
333
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
7 .addFunctionAttribute(llvm::Attribute::AlwaysInline)
334 .setEmbedIR(true) // axaddtogroup needs access to parent function arguments
335 .setConstantFold(false)
336
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
7 .setPreferredImpl(op.mPrioritiseIR ? FunctionBuilder::IR : FunctionBuilder::C)
337 .setDocumentation("Delete the current point from the point set. Note that this does not "
338 "stop AX execution - any additional AX commands will be executed on the "
339 "point and it will remain accessible until the end of execution.")
340
1/2
✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
14 .get();
341 }
342
343 724 inline FunctionGroup::UniquePtr axsetattribute(const FunctionOptions& op)
344 {
345 static auto setattribptr =
346 498 [](void* attributeHandle, uint64_t index, const auto value)
347 {
348 using ValueType = typename std::remove_const
349 <typename std::remove_pointer
350 <decltype(value)>::type>::type;
351 using AttributeHandleType = openvdb::points::AttributeWriteHandle<ValueType>;
352
353
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 249 times.
498 assert(attributeHandle);
354
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 249 times.
498 assert(value);
355
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 249 times.
498 assert(index < static_cast<uint64_t>(std::numeric_limits<openvdb::Index>::max()));
356
357 AttributeHandleType* handle = static_cast<AttributeHandleType*>(attributeHandle);
358 498 handle->set(static_cast<openvdb::Index>(index), *value);
359 498 };
360
361 static auto setattribstr =
362 210 [](void* attributeHandle,
363 const uint64_t index,
364 const codegen::String* value,
365 void* const leafDataPtr)
366 {
367 using AttributeHandleType = openvdb::points::StringAttributeWriteHandle;
368
369
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 210 times.
210 assert(attributeHandle);
370
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 210 times.
210 assert(value);
371
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 210 times.
210 assert(leafDataPtr);
372
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 210 times.
210 assert(index < static_cast<uint64_t>(std::numeric_limits<openvdb::Index>::max()));
373
374 const std::string s = value->str();
375 AttributeHandleType* const handle =
376 static_cast<AttributeHandleType*>(attributeHandle);
377 codegen_internal::PointLeafLocalData* const leafData =
378 static_cast<codegen_internal::PointLeafLocalData*>(leafDataPtr);
379
380 // Check to see if the string exists in the metadata cache. If so, set the string and
381 // remove any new data associated with it, otherwise set the new data
382
383
3/4
✓ Branch 1 taken 210 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 25 times.
✓ Branch 4 taken 185 times.
210 if (handle->contains(s)) {
384
1/2
✓ Branch 1 taken 25 times.
✗ Branch 2 not taken.
25 handle->set(static_cast<openvdb::Index>(index), s);
385
1/2
✓ Branch 1 taken 25 times.
✗ Branch 2 not taken.
25 leafData->removeNewStringData(&(handle->array()), index);
386 }
387 else {
388
2/4
✓ Branch 1 taken 185 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 185 times.
✗ Branch 5 not taken.
185 leafData->setNewStringData(&(handle->array()), index, s);
389 }
390 210 };
391
392 static auto setattrib =
393 [](void* attributeHandle,
394 uint64_t index,
395 const auto value) {
396 setattribptr(attributeHandle, index, &value);
397 };
398
399 using SetAttribD = void(void*, uint64_t, const double);
400 using SetAttribF = void(void*, uint64_t, const float);
401 using SetAttribI64 = void(void*, uint64_t, const int64_t);
402 using SetAttribI32 = void(void*, uint64_t, const int32_t);
403 using SetAttribI16 = void(void*, uint64_t, const int16_t);
404 using SetAttribB = void(void*, uint64_t, const bool);
405 using SetAttribV2D = void(void*, uint64_t, const openvdb::math::Vec2<double>*);
406 using SetAttribV2F = void(void*, uint64_t, const openvdb::math::Vec2<float>*);
407 using SetAttribV2I = void(void*, uint64_t, const openvdb::math::Vec2<int32_t>*);
408 using SetAttribV3D = void(void*, uint64_t, const openvdb::math::Vec3<double>*);
409 using SetAttribV3F = void(void*, uint64_t, const openvdb::math::Vec3<float>*);
410 using SetAttribV3I = void(void*, uint64_t, const openvdb::math::Vec3<int32_t>*);
411 using SetAttribV4D = void(void*, uint64_t, const openvdb::math::Vec4<double>*);
412 using SetAttribV4F = void(void*, uint64_t, const openvdb::math::Vec4<float>*);
413 using SetAttribV4I = void(void*, uint64_t, const openvdb::math::Vec4<int32_t>*);
414 using SetAttribM3D = void(void*, uint64_t, const openvdb::math::Mat3<double>*);
415 using SetAttribM3F = void(void*, uint64_t, const openvdb::math::Mat3<float>*);
416 using SetAttribM4D = void(void*, uint64_t, const openvdb::math::Mat4<double>*);
417 using SetAttribM4F = void(void*, uint64_t, const openvdb::math::Mat4<float>*);
418 using SetAttribStr = void(void*, uint64_t, const codegen::String*, void* const);
419
420 1448 return FunctionBuilder("setattribute")
421
1/2
✓ Branch 1 taken 724 times.
✗ Branch 2 not taken.
724 .addSignature<SetAttribD>((SetAttribD*)(setattrib))
422
1/2
✓ Branch 1 taken 724 times.
✗ Branch 2 not taken.
724 .addSignature<SetAttribF>((SetAttribF*)(setattrib))
423
1/2
✓ Branch 1 taken 724 times.
✗ Branch 2 not taken.
724 .addSignature<SetAttribI64>((SetAttribI64*)(setattrib))
424
1/2
✓ Branch 1 taken 724 times.
✗ Branch 2 not taken.
724 .addSignature<SetAttribI32>((SetAttribI32*)(setattrib))
425
1/2
✓ Branch 1 taken 724 times.
✗ Branch 2 not taken.
724 .addSignature<SetAttribI16>((SetAttribI16*)(setattrib))
426
1/2
✓ Branch 1 taken 724 times.
✗ Branch 2 not taken.
724 .addSignature<SetAttribB>((SetAttribB*)(setattrib))
427
1/2
✓ Branch 1 taken 724 times.
✗ Branch 2 not taken.
724 .addParameterAttribute(0, llvm::Attribute::ReadOnly)
428
1/2
✓ Branch 1 taken 724 times.
✗ Branch 2 not taken.
724 .addFunctionAttribute(llvm::Attribute::NoRecurse)
429 .setConstantFold(false)
430
1/2
✓ Branch 1 taken 724 times.
✗ Branch 2 not taken.
724 .addSignature<SetAttribV2D>((SetAttribV2D*)(setattribptr))
431
1/2
✓ Branch 1 taken 724 times.
✗ Branch 2 not taken.
724 .addSignature<SetAttribV2F>((SetAttribV2F*)(setattribptr))
432
1/2
✓ Branch 1 taken 724 times.
✗ Branch 2 not taken.
724 .addSignature<SetAttribV2I>((SetAttribV2I*)(setattribptr))
433
1/2
✓ Branch 1 taken 724 times.
✗ Branch 2 not taken.
724 .addSignature<SetAttribV3D>((SetAttribV3D*)(setattribptr))
434
1/2
✓ Branch 1 taken 724 times.
✗ Branch 2 not taken.
724 .addSignature<SetAttribV3F>((SetAttribV3F*)(setattribptr))
435
1/2
✓ Branch 1 taken 724 times.
✗ Branch 2 not taken.
724 .addSignature<SetAttribV3I>((SetAttribV3I*)(setattribptr))
436
1/2
✓ Branch 1 taken 724 times.
✗ Branch 2 not taken.
724 .addSignature<SetAttribV4D>((SetAttribV4D*)(setattribptr))
437
1/2
✓ Branch 1 taken 724 times.
✗ Branch 2 not taken.
724 .addSignature<SetAttribV4F>((SetAttribV4F*)(setattribptr))
438
1/2
✓ Branch 1 taken 724 times.
✗ Branch 2 not taken.
724 .addSignature<SetAttribV4I>((SetAttribV4I*)(setattribptr))
439
1/2
✓ Branch 1 taken 724 times.
✗ Branch 2 not taken.
724 .addSignature<SetAttribM3D>((SetAttribM3D*)(setattribptr))
440
1/2
✓ Branch 1 taken 724 times.
✗ Branch 2 not taken.
724 .addSignature<SetAttribM3F>((SetAttribM3F*)(setattribptr))
441
1/2
✓ Branch 1 taken 724 times.
✗ Branch 2 not taken.
724 .addSignature<SetAttribM4D>((SetAttribM4D*)(setattribptr))
442
1/2
✓ Branch 1 taken 724 times.
✗ Branch 2 not taken.
724 .addSignature<SetAttribM4F>((SetAttribM4F*)(setattribptr))
443
1/2
✓ Branch 1 taken 724 times.
✗ Branch 2 not taken.
724 .addParameterAttribute(0, llvm::Attribute::ReadOnly)
444
1/2
✓ Branch 1 taken 724 times.
✗ Branch 2 not taken.
724 .addParameterAttribute(2, llvm::Attribute::ReadOnly)
445
1/2
✓ Branch 1 taken 724 times.
✗ Branch 2 not taken.
724 .addFunctionAttribute(llvm::Attribute::NoRecurse)
446 .setConstantFold(false)
447
1/2
✓ Branch 1 taken 724 times.
✗ Branch 2 not taken.
724 .addSignature<SetAttribStr>((SetAttribStr*)(setattribstr))
448
1/2
✓ Branch 1 taken 724 times.
✗ Branch 2 not taken.
724 .addParameterAttribute(0, llvm::Attribute::ReadOnly)
449
1/2
✓ Branch 1 taken 724 times.
✗ Branch 2 not taken.
724 .addParameterAttribute(2, llvm::Attribute::ReadOnly)
450
1/2
✓ Branch 1 taken 724 times.
✗ Branch 2 not taken.
724 .addParameterAttribute(3, llvm::Attribute::ReadOnly)
451
2/2
✓ Branch 0 taken 232 times.
✓ Branch 1 taken 492 times.
724 .addFunctionAttribute(llvm::Attribute::NoRecurse)
452 .setConstantFold(false)
453
2/2
✓ Branch 0 taken 232 times.
✓ Branch 1 taken 492 times.
724 .setPreferredImpl(op.mPrioritiseIR ? FunctionBuilder::IR : FunctionBuilder::C)
454 .setDocumentation("Internal function for setting the value of a point attribute.")
455
1/2
✓ Branch 1 taken 724 times.
✗ Branch 2 not taken.
1448 .get();
456 }
457
458 728 inline FunctionGroup::UniquePtr axgetattribute(const FunctionOptions& op)
459 {
460 static auto getattrib =
461 498 [](void* attributeHandle, uint64_t index, auto value)
462 {
463 using ValueType = typename std::remove_const
464 <typename std::remove_pointer
465 <decltype(value)>::type>::type;
466 // typedef is a read handle. As write handles are derived types this
467 // is okay and lets us define the handle types outside IR for attributes that are
468 // only being read!
469 using AttributeHandleType = openvdb::points::AttributeHandle<ValueType>;
470
471
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 249 times.
498 assert(value);
472
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 249 times.
498 assert(attributeHandle);
473
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 249 times.
498 assert(index < static_cast<uint64_t>(std::numeric_limits<openvdb::Index>::max()));
474
475 AttributeHandleType* handle = static_cast<AttributeHandleType*>(attributeHandle);
476 498 (*value) = handle->get(static_cast<openvdb::Index>(index));
477 498 };
478
479 static auto getattribstr =
480 225 [](void* attributeHandle,
481 uint64_t index,
482 codegen::String* value,
483 const void* const leafDataPtr)
484 {
485 using AttributeHandleType = openvdb::points::StringAttributeHandle;
486
487
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 225 times.
225 assert(value);
488
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 225 times.
225 assert(attributeHandle);
489
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 225 times.
225 assert(leafDataPtr);
490
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 225 times.
225 assert(index < static_cast<uint64_t>(std::numeric_limits<openvdb::Index>::max()));
491
492 AttributeHandleType* const handle =
493 static_cast<AttributeHandleType*>(attributeHandle);
494 const codegen_internal::PointLeafLocalData* const leafData =
495 static_cast<const codegen_internal::PointLeafLocalData*>(leafDataPtr);
496
497 std::string data;
498
3/6
✓ Branch 1 taken 225 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 225 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 225 times.
✗ Branch 7 not taken.
225 if (!leafData->getNewStringData(&(handle->array()), index, data)) {
499
1/2
✓ Branch 1 taken 225 times.
✗ Branch 2 not taken.
225 handle->get(data, static_cast<openvdb::Index>(index));
500 }
501
502 225 *value = data;
503 225 };
504
505 using GetAttribD = void(void*, uint64_t, double*);
506 using GetAttribF = void(void*, uint64_t, float*);
507 using GetAttribI64 = void(void*, uint64_t, int64_t*);
508 using GetAttribI32 = void(void*, uint64_t, int32_t*);
509 using GetAttribI16 = void(void*, uint64_t, int16_t*);
510 using GetAttribB = void(void*, uint64_t, bool*);
511 using GetAttribV2D = void(void*, uint64_t, openvdb::math::Vec2<double>*);
512 using GetAttribV2F = void(void*, uint64_t, openvdb::math::Vec2<float>*);
513 using GetAttribV2I = void(void*, uint64_t, openvdb::math::Vec2<int32_t>*);
514 using GetAttribV3D = void(void*, uint64_t, openvdb::math::Vec3<double>*);
515 using GetAttribV3F = void(void*, uint64_t, openvdb::math::Vec3<float>*);
516 using GetAttribV3I = void(void*, uint64_t, openvdb::math::Vec3<int32_t>*);
517 using GetAttribV4D = void(void*, uint64_t, openvdb::math::Vec4<double>*);
518 using GetAttribV4F = void(void*, uint64_t, openvdb::math::Vec4<float>*);
519 using GetAttribV4I = void(void*, uint64_t, openvdb::math::Vec4<int32_t>*);
520 using GetAttribM3D = void(void*, uint64_t, openvdb::math::Mat3<double>*);
521 using GetAttribM3F = void(void*, uint64_t, openvdb::math::Mat3<float>*);
522 using GetAttribM4D = void(void*, uint64_t, openvdb::math::Mat4<double>*);
523 using GetAttribM4F = void(void*, uint64_t, openvdb::math::Mat4<float>*);
524 using GetAttribStr = void(void*, uint64_t, codegen::String*, const void* const);
525
526 1456 return FunctionBuilder("getattribute")
527
1/2
✓ Branch 1 taken 728 times.
✗ Branch 2 not taken.
728 .addSignature<GetAttribD>((GetAttribD*)(getattrib))
528
1/2
✓ Branch 1 taken 728 times.
✗ Branch 2 not taken.
728 .addSignature<GetAttribF>((GetAttribF*)(getattrib))
529
1/2
✓ Branch 1 taken 728 times.
✗ Branch 2 not taken.
728 .addSignature<GetAttribI64>((GetAttribI64*)(getattrib))
530
1/2
✓ Branch 1 taken 728 times.
✗ Branch 2 not taken.
728 .addSignature<GetAttribI32>((GetAttribI32*)(getattrib))
531
1/2
✓ Branch 1 taken 728 times.
✗ Branch 2 not taken.
728 .addSignature<GetAttribI16>((GetAttribI16*)(getattrib))
532
1/2
✓ Branch 1 taken 728 times.
✗ Branch 2 not taken.
728 .addSignature<GetAttribB>((GetAttribB*)(getattrib))
533
1/2
✓ Branch 1 taken 728 times.
✗ Branch 2 not taken.
728 .addSignature<GetAttribV2D>((GetAttribV2D*)(getattrib))
534
1/2
✓ Branch 1 taken 728 times.
✗ Branch 2 not taken.
728 .addSignature<GetAttribV2F>((GetAttribV2F*)(getattrib))
535
1/2
✓ Branch 1 taken 728 times.
✗ Branch 2 not taken.
728 .addSignature<GetAttribV2I>((GetAttribV2I*)(getattrib))
536
1/2
✓ Branch 1 taken 728 times.
✗ Branch 2 not taken.
728 .addSignature<GetAttribV3D>((GetAttribV3D*)(getattrib))
537
1/2
✓ Branch 1 taken 728 times.
✗ Branch 2 not taken.
728 .addSignature<GetAttribV3F>((GetAttribV3F*)(getattrib))
538
1/2
✓ Branch 1 taken 728 times.
✗ Branch 2 not taken.
728 .addSignature<GetAttribV3I>((GetAttribV3I*)(getattrib))
539
1/2
✓ Branch 1 taken 728 times.
✗ Branch 2 not taken.
728 .addSignature<GetAttribV4D>((GetAttribV4D*)(getattrib))
540
1/2
✓ Branch 1 taken 728 times.
✗ Branch 2 not taken.
728 .addSignature<GetAttribV4F>((GetAttribV4F*)(getattrib))
541
1/2
✓ Branch 1 taken 728 times.
✗ Branch 2 not taken.
728 .addSignature<GetAttribV4I>((GetAttribV4I*)(getattrib))
542
1/2
✓ Branch 1 taken 728 times.
✗ Branch 2 not taken.
728 .addSignature<GetAttribM3D>((GetAttribM3D*)(getattrib))
543
1/2
✓ Branch 1 taken 728 times.
✗ Branch 2 not taken.
728 .addSignature<GetAttribM3F>((GetAttribM3F*)(getattrib))
544
1/2
✓ Branch 1 taken 728 times.
✗ Branch 2 not taken.
728 .addSignature<GetAttribM4D>((GetAttribM4D*)(getattrib))
545
1/2
✓ Branch 1 taken 728 times.
✗ Branch 2 not taken.
728 .addSignature<GetAttribM4F>((GetAttribM4F*)(getattrib))
546
1/2
✓ Branch 1 taken 728 times.
✗ Branch 2 not taken.
728 .addParameterAttribute(0, llvm::Attribute::ReadOnly)
547
1/2
✓ Branch 1 taken 728 times.
✗ Branch 2 not taken.
728 .addFunctionAttribute(llvm::Attribute::NoRecurse)
548 .setConstantFold(false)
549
1/2
✓ Branch 1 taken 728 times.
✗ Branch 2 not taken.
728 .addSignature<GetAttribStr>((GetAttribStr*)(getattribstr))
550
1/2
✓ Branch 1 taken 728 times.
✗ Branch 2 not taken.
728 .addParameterAttribute(0, llvm::Attribute::ReadOnly)
551
1/2
✓ Branch 1 taken 728 times.
✗ Branch 2 not taken.
728 .addParameterAttribute(3, llvm::Attribute::ReadOnly)
552
2/2
✓ Branch 0 taken 232 times.
✓ Branch 1 taken 496 times.
728 .addFunctionAttribute(llvm::Attribute::NoRecurse)
553 .setConstantFold(false)
554
2/2
✓ Branch 0 taken 232 times.
✓ Branch 1 taken 496 times.
728 .setPreferredImpl(op.mPrioritiseIR ? FunctionBuilder::IR : FunctionBuilder::C)
555 .setDocumentation("Internal function for getting the value of a point attribute.")
556
1/2
✓ Branch 1 taken 728 times.
✗ Branch 2 not taken.
1456 .get();
557 }
558
559
560 ////////////////////////////////////////////////////////////////////////
561 ////////////////////////////////////////////////////////////////////////
562
563
564 1487 void insertVDBPointFunctions(FunctionRegistry& registry,
565 const FunctionOptions* options)
566 {
567
4/4
✓ Branch 0 taken 1486 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1485 times.
✓ Branch 3 taken 1 times.
1487 const bool create = options && !options->mLazyFunctions;
568 11896 auto add = [&](const std::string& name,
569 const FunctionRegistry::ConstructorT creator,
570 const bool internal = false)
571 {
572
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 11888 times.
11896 if (create) registry.insertAndCreate(name, creator, *options, internal);
573 11888 else registry.insert(name, creator, internal);
574 13383 };
575
576 // point functions
577
578
2/4
✓ Branch 1 taken 1487 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1487 times.
✗ Branch 5 not taken.
1487 add("addtogroup", axaddtogroup);
579
2/4
✓ Branch 1 taken 1487 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1487 times.
✗ Branch 5 not taken.
1487 add("ingroup", axingroup);
580
2/4
✓ Branch 1 taken 1487 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1487 times.
✗ Branch 5 not taken.
1487 add("removefromgroup",axremovefromgroup);
581
2/4
✓ Branch 1 taken 1487 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1487 times.
✗ Branch 5 not taken.
1487 add("deletepoint", axdeletepoint);
582
2/4
✓ Branch 1 taken 1487 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1487 times.
✗ Branch 5 not taken.
1487 add("_ingroup", ax_ingroup, true);
583
2/4
✓ Branch 1 taken 1487 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1487 times.
✗ Branch 5 not taken.
1487 add("editgroup", axeditgroup, true);
584
2/4
✓ Branch 1 taken 1487 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1487 times.
✗ Branch 5 not taken.
1487 add("getattribute", axgetattribute, true);
585
2/4
✓ Branch 1 taken 1487 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1487 times.
✗ Branch 5 not taken.
1487 add("setattribute", axsetattribute, true);
586 1487 }
587
588 } // namespace codegen
589 } // namespace ax
590 } // namespace openvdb_version
591 } // namespace openvdb
592
593
594