ViennaLS
Loading...
Searching...
No Matches
pyWrap.hpp
Go to the documentation of this file.
1#include <pybind11/iostream.h>
2#include <pybind11/pybind11.h>
3#include <pybind11/stl.h>
4
5// all header files which define API functions
6#include <lsAdvect.hpp>
11#include <lsCheck.hpp>
12#include <lsCompareArea.hpp>
13#include <lsCompareChamfer.hpp>
17#include <lsConvexHull.hpp>
18#include <lsDetectFeatures.hpp>
19#include <lsDomain.hpp>
20#include <lsExpand.hpp>
21#include <lsExtrude.hpp>
22#include <lsFileFormats.hpp>
23#include <lsFromMesh.hpp>
24#include <lsFromSurfaceMesh.hpp>
25#include <lsFromVolumeMesh.hpp>
26#include <lsGeometricAdvect.hpp>
28#include <lsGeometries.hpp>
29#include <lsMakeGeometry.hpp>
30#include <lsMarkVoidPoints.hpp>
31#include <lsMaterialMap.hpp>
32#include <lsMesh.hpp>
33#include <lsPointData.hpp>
34#include <lsPrune.hpp>
35#include <lsReader.hpp>
36#include <lsReduce.hpp>
38#include <lsSlice.hpp>
39#include <lsToDiskMesh.hpp>
40#include <lsToMesh.hpp>
42#include <lsToSurfaceMesh.hpp>
43#include <lsToVoxelMesh.hpp>
44#include <lsTransformMesh.hpp>
45#include <lsVTKReader.hpp>
46#include <lsVTKWriter.hpp>
47#include <lsVelocityField.hpp>
48#include <lsVersion.hpp>
50#include <lsWriter.hpp>
51
52#include <vcLogger.hpp>
53#include <vcSmartPointer.hpp>
54
55using namespace viennals;
56namespace py = pybind11;
57
58// always use double for python export
59typedef double T;
60
61PYBIND11_DECLARE_HOLDER_TYPE(TemplateType, SmartPointer<TemplateType>);
62
63// GeometricAdvectDistribution
64template <int D>
66 : public GeometricAdvectDistribution<T, D> {
67 typedef std::array<viennahrle::CoordType, 3> vectorType;
68 typedef std::array<viennahrle::CoordType, 6> boundsType;
69 typedef GeometricAdvectDistribution<T, D> ClassType;
71
72public:
73 bool isInside(const vectorType &initial, const vectorType &candidate,
74 double eps = 0.) const override {
75 PYBIND11_OVERLOAD(bool, ClassType, isInside, initial, candidate, eps);
76 }
77
78 T getSignedDistance(const vectorType &initial, const vectorType &candidate,
79 unsigned long initialPointId) const override {
80 PYBIND11_OVERLOAD_PURE(T, ClassType, getSignedDistance, initial, candidate,
81 initialPointId);
82 }
83
84 boundsType getBounds() const override {
85 PYBIND11_OVERLOAD_PURE(boundsType, ClassType, getBounds);
86 }
87};
88
89template <int D> void bindApi(py::module &module) {
90 // Also wrap hrleGrid so it can be used to create new LevelSets
91 py::class_<viennahrle::Grid<D>>(module, "hrleGrid");
92
93 // Domain
94 py::class_<Domain<T, D>, SmartPointer<Domain<T, D>>>(module, "Domain")
95 // constructors
96 .def(py::init(&SmartPointer<Domain<T, D>>::template New<>))
97 .def(
98 py::init(
99 &SmartPointer<Domain<T, D>>::template New<viennahrle::CoordType>),
100 py::arg("gridDelta") = 1.0)
101 // .def(py::init(
102 // &SmartPointer<Domain<T, D>>::New<viennahrle::CoordType *,
103 // BoundaryConditionEnum *>))
104 .def(py::init([](std::array<viennahrle::CoordType, 2 * D> bounds,
105 std::array<BoundaryConditionEnum, D> bcs,
106 viennahrle::CoordType gridDelta) {
107 return SmartPointer<Domain<T, D>>::New(bounds.data(), bcs.data(),
108 gridDelta);
109 }),
110 py::arg("bounds"), py::arg("boundaryConditions"),
111 py::arg("gridDelta") = 1.0)
112 .def(py::init(&SmartPointer<Domain<T, D>>::template New<
113 std::vector<viennahrle::CoordType>, std::vector<unsigned>,
114 viennahrle::CoordType>),
115 py::arg("bounds"), py::arg("boundaryConditions"),
116 py::arg("gridDelta") = 1.0)
117 // .def(py::init(
118 // &SmartPointer<Domain<T, D>>::New<Domain<T,
119 // D>::PointValueVectorType,
120 // viennahrle::CoordType *,
121 // BoundaryConditionEnum *>))
122 // .def(py::init(&SmartPointer<Domain<T, D>>::New<
123 // Domain<T, D>::PointValueVectorType,
124 // viennahrle::CoordType
125 // *, BoundaryConditionEnum *,
126 // viennahrle::CoordType>))
127 .def(py::init(&SmartPointer<Domain<T, D>>::template New<
128 SmartPointer<Domain<T, D>> &>))
129 .def(py::init(
130 &SmartPointer<Domain<T, D>>::template New<viennahrle::Grid<D> &>))
131 // methods
132 .def("deepCopy", &Domain<T, D>::deepCopy,
133 "Copy lsDomain in this lsDomain.")
134 .def("getNumberOfSegments", &Domain<T, D>::getNumberOfSegments,
135 "Get the number of segments, the level set structure is divided "
136 "into.")
137 .def("getNumberOfPoints", &Domain<T, D>::getNumberOfPoints,
138 "Get the number of defined level set values.")
139 .def("getLevelSetWidth", &Domain<T, D>::getLevelSetWidth,
140 "Get the number of layers of level set points around the explicit "
141 "surface.")
142 .def("setLevelSetWidth", &Domain<T, D>::setLevelSetWidth,
143 "Set the number of layers of level set points which should be "
144 "stored around the explicit surface.")
145 .def("clearMetaData", &Domain<T, D>::clearMetaData,
146 "Clear all metadata stored in the level set.")
147 // allow filehandle to be passed and default to python standard output
148 .def(
149 "print",
150 [](Domain<T, D> &d, py::object fileHandle) {
151 if (!(py::hasattr(fileHandle, "write") &&
152 py::hasattr(fileHandle, "flush"))) {
153 throw py::type_error(
154 "MyClass::read_from_file_like_object(file): incompatible "
155 "function argument: `file` must be a file-like object, but "
156 "`" +
157 (std::string)(py::repr(fileHandle)) + "` provided");
158 }
159 py::detail::pythonbuf buf(fileHandle);
160 std::ostream stream(&buf);
161 d.print(stream);
162 },
163 py::arg("stream") = py::module::import("sys").attr("stdout"));
164
165 // Advect
166 py::class_<Advect<T, D>, SmartPointer<Advect<T, D>>>(module, "Advect")
167 // constructors
168 .def(py::init(&SmartPointer<Advect<T, D>>::template New<>))
169 .def(py::init(&SmartPointer<Advect<T, D>>::template New<
170 SmartPointer<Domain<T, D>> &>))
171 .def(py::init(
172 &SmartPointer<Advect<T, D>>::template New<
173 SmartPointer<Domain<T, D>> &, SmartPointer<VelocityField<T>> &>))
174 // getters and setters
175 .def("insertNextLevelSet", &Advect<T, D>::insertNextLevelSet,
176 "Insert next level set to use for advection.")
177 .def("clearLevelSets", &Advect<T, D>::clearLevelSets,
178 "Clear all level sets used for advection.")
179 .def("setVelocityField", &Advect<T, D>::setVelocityField,
180 "Set the velocity to use for advection.")
181 .def("setAdvectionTime", &Advect<T, D>::setAdvectionTime,
182 "Set the time until when the level set should be advected.")
183 .def("setTimeStepRatio", &Advect<T, D>::setTimeStepRatio,
184 "Set the maximum time step size relative to grid size. Advection is "
185 "only stable for <0.5.")
186 .def("setCalculateNormalVectors",
188 "Set whether normal vectors are needed for the supplied velocity "
189 "field.")
190 .def("setIgnoreVoids", &Advect<T, D>::setIgnoreVoids,
191 "Set whether voids in the geometry should be ignored during "
192 "advection or not.")
193 .def("getAdvectedTime", &Advect<T, D>::getAdvectedTime,
194 "Get the time passed during advection.")
195 .def("getNumberOfTimeSteps", &Advect<T, D>::getNumberOfTimeSteps,
196 "Get how many advection steps were performed after the last apply() "
197 "call.")
198 .def("getTimeStepRatio", &Advect<T, D>::getTimeStepRatio,
199 "Get the time step ratio used for advection.")
200 .def("getCurrentTimeStep", &Advect<T, D>::getCurrentTimeStep,
201 "Get the current time step.")
202 .def("getCalculateNormalVectors",
204 "Get whether normal vectors are computed during advection.")
205 .def("setIntegrationScheme", &Advect<T, D>::setIntegrationScheme,
206 "Set the integration scheme to use during advection.")
207 .def("setDissipationAlpha", &Advect<T, D>::setDissipationAlpha,
208 "Set the dissipation value to use for Lax Friedrichs integration.")
209 .def("prepareLS", &Advect<T, D>::prepareLS, "Prepare the level-set.")
210 // need scoped release since we are calling a python method from
211 // parallelised C++ code here
212 .def("apply", &Advect<T, D>::apply,
213 py::call_guard<py::gil_scoped_release>(), "Perform advection.")
214 .def("applyIntegration", &Advect<T, D>::applyIntegration,
215 py::call_guard<py::gil_scoped_release>(),
216 "Apply the integration scheme and calculate rates and maximum time "
217 "step, but it do **not** move the surface.");
218
219 py::class_<lsInternal::StencilLocalLaxFriedrichsScalar<T, D, 1>>(
220 module, "StencilLocalLaxFriedrichsScalar")
221 .def_static(
222 "setMaxDissipation",
224 1>::setMaxDissipation,
225 py::arg("maxDissipation"));
226
227 module.def("PrepareStencilLocalLaxFriedrichs",
228 &PrepareStencilLocalLaxFriedrichs<T, D>, py::arg("levelSets"),
229 py::arg("isDepo"));
230
231 module.def("FinalizeStencilLocalLaxFriedrichs",
232 &FinalizeStencilLocalLaxFriedrichs<T, D>, py::arg("levelSets"));
233
234 // BooleanOperation
235 py::class_<BooleanOperation<T, D>, SmartPointer<BooleanOperation<T, D>>>(
236 module, "BooleanOperation")
237 // constructors
238 .def(py::init(&SmartPointer<BooleanOperation<T, D>>::template New<>))
239 .def(py::init(&SmartPointer<BooleanOperation<T, D>>::template New<
240 SmartPointer<Domain<T, D>> &>))
241 .def(
242 py::init(&SmartPointer<BooleanOperation<T, D>>::template New<
243 SmartPointer<Domain<T, D>> &, SmartPointer<Domain<T, D>> &>))
244 // some constructors need lambda to work: seems to be an issue with
245 // implicit move constructor
246 .def(py::init(
247 [](SmartPointer<Domain<T, D>> &domain, BooleanOperationEnum op) {
248 return SmartPointer<BooleanOperation<T, D>>::New(domain, op);
249 }))
250 .def(py::init([](SmartPointer<Domain<T, D>> &domainA,
251 SmartPointer<Domain<T, D>> &domainB,
253 return SmartPointer<BooleanOperation<T, D>>::New(domainA, domainB, op);
254 }))
255 // methods
256 .def("setLevelset", &BooleanOperation<T, D>::setLevelSet,
257 "Set levelset on which the boolean operation should be performed.")
258 .def("setSecondLevelSet", &BooleanOperation<T, D>::setSecondLevelSet,
259 "Set second levelset for boolean operation.")
260 .def("setBooleanOperation", &BooleanOperation<T, D>::setBooleanOperation,
261 "Set which type of boolean operation should be performed.")
262 .def("apply", &BooleanOperation<T, D>::apply,
263 "Perform the boolean operation.");
264
265 py::class_<CalculateCurvatures<T, D>,
266 SmartPointer<CalculateCurvatures<T, D>>>(module,
267 "CalculateCurvatures")
268 // constructors
269 .def(py::init(&SmartPointer<CalculateCurvatures<T, D>>::template New<>))
270 .def(py::init(&SmartPointer<CalculateCurvatures<T, D>>::template New<
271 SmartPointer<Domain<T, D>> &>))
272 // some constructors need lambda to work: seems to be an issue with
273 // implicit move constructor
274 .def(py::init([](SmartPointer<Domain<T, D>> &domain, CurvatureEnum type) {
275 return SmartPointer<CalculateCurvatures<T, D>>::New(domain, type);
276 }))
277 // methods
278 .def("setLevelSet", &CalculateCurvatures<T, D>::setLevelSet,
279 "Set levelset for which to calculate the curvatures.")
280 .def("setCurvatureType", &CalculateCurvatures<T, D>::setCurvatureType,
281 "Set which method to use for calculation: Defaults to mean "
282 "curvature.")
283 .def("setMaxValue", &CalculateCurvatures<T, D>::setMaxValue,
284 "Curvatures will be calculated for all LS values < maxValue.")
286 "Perform normal vector calculation.");
287
288 // CalculateNormalVectors
289 py::class_<CalculateNormalVectors<T, D>,
290 SmartPointer<CalculateNormalVectors<T, D>>>(
291 module, "CalculateNormalVectors")
292 // constructors
293 .def(
294 py::init(&SmartPointer<CalculateNormalVectors<T, D>>::template New<>))
295 .def(py::init(&SmartPointer<CalculateNormalVectors<T, D>>::template New<
296 SmartPointer<Domain<T, D>> &>))
297 // methods
299 "Set levelset for which to calculate normal vectors.")
301 "Perform normal vector calculation.");
302
303 // CalculateVisibilities
304 py::class_<CalculateVisibilities<T, D>,
305 SmartPointer<CalculateVisibilities<T, D>>>(module,
306 "CalculateVisibilities")
307 .def(py::init(
308 &SmartPointer<CalculateVisibilities<T, D>>::template New<
309 SmartPointer<Domain<T, D>> &, const Vec3D<T> &, std::string>))
311
312 // Check
313 py::class_<Check<T, D>, SmartPointer<Check<T, D>>>(module, "Check")
314 // constructors
315 .def(py::init(&SmartPointer<Check<T, D>>::template New<>))
316 .def(py::init(&SmartPointer<Check<T, D>>::template New<
317 SmartPointer<Domain<T, D>> &>))
318 // methods
319 .def("setLevelSet", &Check<T, D>::setLevelSet,
320 "Set levelset for which to calculate normal vectors.")
321 .def("apply", &Check<T, D>::apply, "Perform check.");
322
323 // PointCloud
324 py::class_<PointCloud<T, D>, SmartPointer<PointCloud<T, D>>>(module,
325 "PointCloud")
326 // constructors
327 .def(py::init(&SmartPointer<PointCloud<T, D>>::template New<
328 const std::vector<VectorType<T, D>> &>))
329 // methods
330 .def("insertNextPoint",
331 (void(PointCloud<T, D>::*)(const VectorType<T, D> &)) &
333
334 // ConvexHull
335 py::class_<ConvexHull<T, D>, SmartPointer<ConvexHull<T, D>>>(module,
336 "ConvexHull")
337 // constructors
338 .def(py::init(&SmartPointer<ConvexHull<T, D>>::template New<>))
339 .def(py::init(&SmartPointer<ConvexHull<T, D>>::template New<
340 SmartPointer<Mesh<T>> &, SmartPointer<PointCloud<T, D>> &>))
341 // methods
342 .def("setMesh", &ConvexHull<T, D>::setMesh,
343 "Set mesh object where the generated mesh should be stored.")
344 .def("setPointCloud", &ConvexHull<T, D>::setPointCloud,
345 "Set point cloud used to generate mesh.")
346 .def("apply", &ConvexHull<T, D>::apply, "Generate Hull.");
347
348 // DetectFeatures
349 py::class_<DetectFeatures<T, D>, SmartPointer<DetectFeatures<T, D>>>(
350 module, "DetectFeatures")
351 // constructors
352 .def(py::init(&SmartPointer<DetectFeatures<T, D>>::template New<>))
353 .def(py::init(&SmartPointer<DetectFeatures<T, D>>::template New<
354 SmartPointer<Domain<T, D>> &>))
355 .def(py::init(&SmartPointer<DetectFeatures<T, D>>::template New<
356 SmartPointer<Domain<T, D>> &, T>))
357 // some constructors need lambda to work: seems to be an issue with
358 // implicit move constructor
359 .def(py::init([](SmartPointer<Domain<T, D>> &domain, T maxValue,
361 return SmartPointer<DetectFeatures<T, D>>::New(domain, maxValue, type);
362 }))
363 .def("setDetectionThreshold",
365 "Set the curvature value above which a point is considered a "
366 "feature.")
367 .def("setDetectionMethod", &DetectFeatures<T, D>::setDetectionMethod,
368 "Set which method to use to detect features. Defaults to Curvature.")
369 .def("apply", &DetectFeatures<T, D>::apply, "Detect features.");
370
371 // GeometricAdvect
372 py::class_<GeometricAdvect<T, D>, SmartPointer<GeometricAdvect<T, D>>>(
373 module, "GeometricAdvect")
374 // constructors
375 .def(py::init(&SmartPointer<GeometricAdvect<T, D>>::template New<>))
376 .def(py::init(
377 &SmartPointer<GeometricAdvect<T, D>>::template New<
378 SmartPointer<Domain<T, D>> &,
379 SmartPointer<
381 // methods
382 .def("setLevelSet", &GeometricAdvect<T, D>::setLevelSet,
383 "Set levelset to advect.")
384 .def(
385 "setAdvectionDistribution",
387 "Set advection distribution to use as kernel for the fast advection.")
388 .def("apply", &GeometricAdvect<T, D>::apply,
389 py::call_guard<py::gil_scoped_release>(), "Perform advection.");
390
391 // GeometricAdvectDistributions
392 py::class_<GeometricAdvectDistribution<T, D>,
393 SmartPointer<GeometricAdvectDistribution<T, D>>,
395 "GeometricAdvectDistribution")
396 // constructors
397 .def(py::init<>())
398 // methods
400 "Check whether passed point is inside the distribution.")
401 .def("getSignedDistance",
403 "Get the signed distance of the passed point to the surface of the "
404 "distribution.")
406 "Get the cartesian bounds of the distribution.")
408 "Prepare the distribution for use with the passed level set.")
410 "Finalize the distribution after use with the level set.");
411
412 py::class_<SphereDistribution<T, D>, SmartPointer<SphereDistribution<T, D>>,
413 GeometricAdvectDistribution<T, D>>(module, "SphereDistribution")
414 // constructors
415 .def(py::init(&SmartPointer<SphereDistribution<T, D>>::template New<T>))
416 // methods
417 .def("isInside", &SphereDistribution<T, D>::isInside,
418 "Check whether passed point is inside the distribution.")
419 .def("getSignedDistance", &SphereDistribution<T, D>::getSignedDistance,
420 "Get the signed distance of the passed point to the surface of the "
421 "distribution.")
422 .def("getBounds", &SphereDistribution<T, D>::getBounds,
423 "Get the cartesian bounds of the distribution.");
424
425 py::class_<BoxDistribution<T, D>, SmartPointer<BoxDistribution<T, D>>,
426 GeometricAdvectDistribution<T, D>>(module, "BoxDistribution")
427 // constructors
428 .def(py::init(&SmartPointer<BoxDistribution<T, D>>::template New<
429 const std::array<T, 3>>))
430 // methods
431 .def("isInside", &BoxDistribution<T, D>::isInside,
432 "Check whether passed point is inside the distribution.")
433 .def("getSignedDistance", &BoxDistribution<T, D>::getSignedDistance,
434 "Get the signed distance of the passed point to the surface of the "
435 "distribution.")
436 .def("getBounds", &BoxDistribution<T, D>::getBounds,
437 "Get the cartesian bounds of the distribution.");
438
439 py::class_<CustomSphereDistribution<T, D>,
440 SmartPointer<CustomSphereDistribution<T, D>>,
442 "CustomSphereDistribution")
443 // constructors
444 .def(py::init(&SmartPointer<CustomSphereDistribution<T, D>>::template New<
445 const std::vector<T> &>))
446 // methods
448 "Check whether passed point is inside the distribution.")
449 .def("getSignedDistance",
451 "Get the signed distance of the passed point to the surface of the "
452 "distribution.")
454 "Get the cartesian bounds of the distribution.");
455
456 // Expand
457 py::class_<Expand<T, D>, SmartPointer<Expand<T, D>>>(module, "Expand")
458 // constructors
459 .def(py::init(&SmartPointer<Expand<T, D>>::template New<>))
460 .def(py::init(&SmartPointer<Expand<T, D>>::template New<
461 SmartPointer<Domain<T, D>> &>))
462 .def(py::init(&SmartPointer<Expand<T, D>>::template New<
463 SmartPointer<Domain<T, D>> &, int>))
464 // methods
465 .def("setLevelSet", &Expand<T, D>::setLevelSet, "Set levelset to expand.")
466 .def("setWidth", &Expand<T, D>::setWidth, "Set the width to expand to.")
467 .def("apply", &Expand<T, D>::apply, "Perform expansion.");
468
469 // FromSurfaceMesh
470 py::class_<FromSurfaceMesh<T, D>, SmartPointer<FromSurfaceMesh<T, D>>>(
471 module, "FromSurfaceMesh")
472 // constructors
473 .def(py::init(&SmartPointer<FromSurfaceMesh<T, D>>::template New<>))
474 .def(py::init(&SmartPointer<FromSurfaceMesh<T, D>>::template New<
475 SmartPointer<Domain<T, D>> &, SmartPointer<Mesh<T>> &>))
476 .def(py::init(
477 &SmartPointer<FromSurfaceMesh<T, D>>::template New<
478 SmartPointer<Domain<T, D>> &, SmartPointer<Mesh<T>> &, bool>))
479 // methods
480 .def("setLevelSet", &FromSurfaceMesh<T, D>::setLevelSet,
481 "Set levelset to read into.")
482 .def("setMesh", &FromSurfaceMesh<T, D>::setMesh,
483 "Set the mesh to read from.")
484 .def("setRemoveBoundaryTriangles",
485 static_cast<void (FromSurfaceMesh<T, D>::*)(bool)>(
487 "Set whether to include mesh elements outside of the simulation "
488 "domain.")
489 .def("setRemoveBoundaryTriangles",
490 static_cast<void (FromSurfaceMesh<T, D>::*)(std::array<bool, 3>)>(
492 "Set whether to include mesh elements outside of the simulation "
493 "domain.")
494 .def("apply", &FromSurfaceMesh<T, D>::apply,
495 "Construct a levelset from a surface mesh.");
496
497 // FromVolumeMesh
498 py::class_<FromVolumeMesh<T, D>, SmartPointer<FromVolumeMesh<T, D>>>(
499 module, "FromVolumeMesh")
500 // constructors
501 .def(py::init(&SmartPointer<FromVolumeMesh<T, D>>::template New<>))
502 .def(py::init(&SmartPointer<FromVolumeMesh<T, D>>::template New<
504 SmartPointer<Mesh<T>> &>))
505 .def(py::init(&SmartPointer<FromVolumeMesh<T, D>>::template New<
507 SmartPointer<Mesh<T>> &, bool>))
508 // methods
509 .def("setGrid", &FromVolumeMesh<T, D>::setGrid,
510 "Set the grid used to read in the level sets.")
511 .def("setMesh", &FromVolumeMesh<T, D>::setMesh,
512 "Set the mesh to read from.")
513 .def("setRemoveBoundaryTriangles",
515 "Set whether to include mesh elements outside of the simulation "
516 "domain.")
517 .def("apply", &FromVolumeMesh<T, D>::apply,
518 "Construct a levelset from a volume mesh.");
519
520 // FromMesh
521 py::class_<FromMesh<T, D>, SmartPointer<FromMesh<T, D>>>(module, "FromMesh")
522 .def(py::init(&SmartPointer<FromMesh<T, D>>::template New<>))
523 .def(py::init(&SmartPointer<FromMesh<T, D>>::template New<
524 SmartPointer<Domain<T, D>> &, SmartPointer<Mesh<T>> &>))
525 .def("setMesh", &FromMesh<T, D>::setMesh, "Set the mesh to read from.")
526 .def("setSortPointList", &FromMesh<T, D>::setSortPointList)
527 .def("apply", &FromMesh<T, D>::apply);
528
529 // lsGeometries
530 // Sphere
531 py::class_<Sphere<T, D>, SmartPointer<Sphere<T, D>>>(module, "Sphere")
532 // constructors
533 .def(py::init(&SmartPointer<Sphere<T, D>>::template New<
534 const std::vector<T> & /*origin*/, T /*radius*/>),
535 py::arg("origin"), py::arg("radius"));
536 // Plane
537 py::class_<Plane<T, D>, SmartPointer<Plane<T, D>>>(module, "Plane")
538 // constructors
539 .def(py::init(&SmartPointer<Plane<T, D>>::template New<
540 const std::vector<T> & /*origin*/,
541 const std::vector<T> & /*normal*/>),
542 py::arg("origin"), py::arg("normal"));
543 // Box
544 py::class_<Box<T, D>, SmartPointer<Box<T, D>>>(module, "Box")
545 // constructors
546 .def(py::init(&SmartPointer<Box<T, D>>::template New<
547 const std::vector<T> & /*minPoint*/,
548 const std::vector<T> & /*maxPoint*/>),
549 py::arg("minPoint"), py::arg("maxPoint"));
550 // Cylinder
551 py::class_<Cylinder<T, D>, SmartPointer<Cylinder<T, D>>>(module, "Cylinder")
552 // constructors
553 .def(
554 py::init(&SmartPointer<Cylinder<T, D>>::template New<
555 const std::vector<T> & /*origin*/,
556 const std::vector<T> & /*axisDirection*/, const T /*height*/,
557 const T /*radius*/, const T /*topRadius*/>),
558 py::arg("origin"), py::arg("axisDirection"), py::arg("height"),
559 py::arg("radius"), py::arg("topRadius") = 0.);
560
561 // MakeGeometry
562 py::class_<MakeGeometry<T, D>, SmartPointer<MakeGeometry<T, D>>>(
563 module, "MakeGeometry")
564 // constructors
565 .def(py::init(&SmartPointer<MakeGeometry<T, D>>::template New<>))
566 .def(py::init(&SmartPointer<MakeGeometry<T, D>>::template New<
567 SmartPointer<Domain<T, D>> &>))
568 .def(
569 py::init(&SmartPointer<MakeGeometry<T, D>>::template New<
570 SmartPointer<Domain<T, D>> &, SmartPointer<Sphere<T, D>> &>))
571 .def(py::init(&SmartPointer<MakeGeometry<T, D>>::template New<
572 SmartPointer<Domain<T, D>> &, SmartPointer<Plane<T, D>> &>))
573 .def(py::init(&SmartPointer<MakeGeometry<T, D>>::template New<
574 SmartPointer<Domain<T, D>> &, SmartPointer<Box<T, D>> &>))
575 .def(py::init(
576 &SmartPointer<MakeGeometry<T, D>>::template New<
577 SmartPointer<Domain<T, D>> &, SmartPointer<Cylinder<T, D>> &>))
578 .def(py::init(
579 &SmartPointer<MakeGeometry<T, D>>::template New<
580 SmartPointer<Domain<T, D>> &, SmartPointer<PointCloud<T, D>> &>))
581 // methods
582 .def("setLevelSet", &MakeGeometry<T, D>::setLevelSet,
583 "Set the levelset in which to create the geometry.")
584 .def("setGeometry",
585 (void(MakeGeometry<T, D>::*)(SmartPointer<Sphere<T, D>>)) &
587 .def("setGeometry",
588 (void(MakeGeometry<T, D>::*)(SmartPointer<Plane<T, D>>)) &
590 .def("setGeometry",
591 (void(MakeGeometry<T, D>::*)(SmartPointer<Box<T, D>>)) &
593 .def("setGeometry",
594 (void(MakeGeometry<T, D>::*)(SmartPointer<Cylinder<T, D>>)) &
596 .def("setGeometry",
597 (void(MakeGeometry<T, D>::*)(SmartPointer<PointCloud<T, D>>)) &
599 .def("setIgnoreBoundaryConditions",
600 (void(MakeGeometry<T, D>::*)(bool)) &
602 .def("setIgnoreBoundaryConditions",
603 (void(MakeGeometry<T, D>::*)(std::array<bool, 3>)) &
605 .def("apply", &MakeGeometry<T, D>::apply, "Generate the geometry.");
606
607 // MarkVoidPoints
608 py::class_<MarkVoidPoints<T, D>, SmartPointer<MarkVoidPoints<T, D>>>(
609 module, "MarkVoidPoints")
610 // constructors
611 .def(py::init(&SmartPointer<MarkVoidPoints<T, D>>::template New<>))
612 .def(py::init(&SmartPointer<MarkVoidPoints<T, D>>::template New<
613 SmartPointer<Domain<T, D>> &>))
614 .def(py::init(&SmartPointer<MarkVoidPoints<T, D>>::template New<
615 SmartPointer<Domain<T, D>> &, bool &>))
616 // methods
617 .def("setLevelSet", &MarkVoidPoints<T, D>::setLevelSet,
618 "Set the levelset to mark void points in.")
619 .def("setReverseVoidDetection",
621 "Reverse the logic of detecting the top surface.")
622 .def("setDetectLargestSurface",
624 "Set that the top surface should be the one with the most connected "
625 "LS points.")
626 .def("setVoidTopSurface", &MarkVoidPoints<T, D>::setVoidTopSurface,
627 "Set the logic by which to choose the surface which is non-void. "
628 "All other connected surfaces will then be marked as void points.")
629 .def("setSaveComponentsId", &MarkVoidPoints<T, D>::setSaveComponentIds,
630 "Save the connectivity information of all LS points in the "
631 "pointData of the level set.")
632 .def("apply", &MarkVoidPoints<T, D>::apply, "Mark void points.");
633
634 // Prune
635 py::class_<Prune<T, D>, SmartPointer<Prune<T, D>>>(module, "Prune")
636 // constructors
637 .def(py::init(&SmartPointer<Prune<T, D>>::template New<>))
638 .def(py::init(&SmartPointer<Prune<T, D>>::template New<
639 SmartPointer<Domain<T, D>> &>))
640 // methods
641 .def("setLevelSet", &Prune<T, D>::setLevelSet, "Set levelset to prune.")
642 .def("apply", &Prune<T, D>::apply, "Perform pruning operation.");
643
644 // Reader
645 py::class_<Reader<T, D>, SmartPointer<Reader<T, D>>>(module, "Reader")
646 // constructors
647 .def(py::init(&SmartPointer<Reader<T, D>>::template New<>))
648 .def(py::init(&SmartPointer<Reader<T, D>>::template New<
649 SmartPointer<Domain<T, D>> &>))
650 .def(py::init(&SmartPointer<Reader<T, D>>::template New<
651 SmartPointer<Domain<T, D>> &, std::string>))
652 // methods
653 .def("setLevelSet", &Reader<T, D>::setLevelSet,
654 "Set levelset to write to file.")
655 .def("setFileName", &Reader<T, D>::setFileName,
656 "Set the filename for the output file.")
657 .def("apply", &Reader<T, D>::apply, "Write to file.");
658
659 // Reduce
660 py::class_<Reduce<T, D>, SmartPointer<Reduce<T, D>>>(module, "Reduce")
661 // constructors
662 .def(py::init(&SmartPointer<Reduce<T, D>>::template New<>))
663 .def(py::init(&SmartPointer<Reduce<T, D>>::template New<
664 SmartPointer<Domain<T, D>> &>))
665 .def(py::init(&SmartPointer<Reduce<T, D>>::template New<
666 SmartPointer<Domain<T, D>> &, int>))
667 .def(py::init(&SmartPointer<Reduce<T, D>>::template New<
668 SmartPointer<Domain<T, D>> &, int, bool>))
669 // methods
670 .def("setLevelSet", &Reduce<T, D>::setLevelSet, "Set levelset to reduce.")
671 .def("setWidth", &Reduce<T, D>::setWidth, "Set the width to reduce to.")
672 .def("setNoNewSegment", &Reduce<T, D>::setNoNewSegment,
673 "Set whether the levelset should be segmented anew (balanced across "
674 "cores) after reduction.")
675 .def("apply", &Reduce<T, D>::apply, "Perform reduction.");
676
677 // RemoveStrayPoints
678 py::class_<RemoveStrayPoints<T, D>, SmartPointer<RemoveStrayPoints<T, D>>>(
679 module, "RemoveStrayPoints")
680 // constructors
681 .def(py::init(&SmartPointer<RemoveStrayPoints<T, D>>::template New<>))
682 .def(py::init(&SmartPointer<RemoveStrayPoints<T, D>>::template New<
683 SmartPointer<Domain<T, D>> &>))
684 // methods
685 .def("setLevelSet", &RemoveStrayPoints<T, D>::setLevelSet,
686 "Set levelset for stray point removal.")
687 .def("setVoidTopSurface", &RemoveStrayPoints<T, D>::setVoidTopSurface,
688 "Set the logic by which to choose the surface which should be kept. "
689 "All other LS values will be marked as stray points and removed.")
690 .def("apply", &RemoveStrayPoints<T, D>::apply, "Remove stray points.");
691
692 // ToDiskMesh
693 py::class_<ToDiskMesh<T, D>, SmartPointer<ToDiskMesh<T, D>>>(module,
694 "ToDiskMesh")
695 // constructors
696 .def(py::init(&SmartPointer<ToDiskMesh<T, D>>::template New<>))
697 .def(py::init(&SmartPointer<ToDiskMesh<T, D>>::template New<
698 SmartPointer<Domain<T, D>> &, SmartPointer<Mesh<T>> &>))
699 // methods
700 .def("setLevelSet", &ToDiskMesh<T, D>::setLevelSet,
701 "Set levelset to mesh.")
702 .def("clearLevelSets", &ToDiskMesh<T, D>::clearLevelSets,
703 "Clear all inserted level sets.")
704 .def("insertNextLevelSet", &ToDiskMesh<T, D>::insertNextLevelSet,
705 "Insert next level set to output in the disk mesh.")
706 .def("setMesh", &ToDiskMesh<T, D>::setMesh, "Set the mesh to generate.")
707 .def("setMaterialMap", &ToDiskMesh<T, D>::setMaterialMap,
708 "Set the material map to use for the disk mesh.")
709 .def("setMaxValue", &ToDiskMesh<T, D>::setMaxValue,
710 "Set the maximum level set value to include in the disk mesh.")
711 .def("apply", &ToDiskMesh<T, D>::apply,
712 "Convert the levelset to a surface mesh.");
713
714 // ToMesh
715 py::class_<ToMesh<T, D>, SmartPointer<ToMesh<T, D>>>(module, "ToMesh")
716 // constructors
717 .def(py::init(&SmartPointer<ToMesh<T, D>>::template New<>))
718 .def(py::init(&SmartPointer<ToMesh<T, D>>::template New<
719 SmartPointer<Domain<T, D>> &, SmartPointer<Mesh<T>> &>))
720 .def(py::init(
721 &SmartPointer<ToMesh<T, D>>::template New<
722 SmartPointer<Domain<T, D>> &, SmartPointer<Mesh<T>> &, bool>))
723 .def(py::init(&SmartPointer<ToMesh<T, D>>::template New<
724 SmartPointer<Domain<T, D>> &, SmartPointer<Mesh<T>> &, bool,
725 bool>))
726 // methods
727 .def("setLevelSet", &ToMesh<T, D>::setLevelSet, "Set levelset to mesh.")
728 .def("setMesh", &ToMesh<T, D>::setMesh, "Set the mesh to generate.")
729 .def("setOnlyDefined", &ToMesh<T, D>::setOnlyDefined,
730 "Set whether only defined points should be output to the mesh.")
731 .def("setOnlyActive", &ToMesh<T, D>::setOnlyActive,
732 "Set whether only level set points <0.5 should be output.")
733 .def("apply", &ToMesh<T, D>::apply,
734 "Convert the levelset to a surface mesh.");
735
736 // ToSurfaceMesh
737 py::class_<ToSurfaceMesh<T, D>, SmartPointer<ToSurfaceMesh<T, D>>>(
738 module, "ToSurfaceMesh")
739 // constructors
740 .def(py::init(&SmartPointer<ToSurfaceMesh<T, D>>::template New<>))
741 .def(py::init(&SmartPointer<ToSurfaceMesh<T, D>>::template New<
742 SmartPointer<Domain<T, D>> &, SmartPointer<Mesh<T>> &>))
743 // methods
744 .def("setLevelSet", &ToSurfaceMesh<T, D>::setLevelSet,
745 "Set levelset to mesh.")
746 .def("setMesh", &ToSurfaceMesh<T, D>::setMesh,
747 "Set the mesh to generate.")
748 .def("apply", &ToSurfaceMesh<T, D>::apply,
749 "Convert the levelset to a surface mesh.");
750
751 // ToMultiSurfaceMesh
752 py::class_<ToMultiSurfaceMesh<T, D>, SmartPointer<ToMultiSurfaceMesh<T, D>>>(
753 module, "ToMultiSurfaceMesh")
754 // constructors
755 .def(py::init(&SmartPointer<ToMultiSurfaceMesh<T, D>>::template New<>))
756 .def(py::init(&SmartPointer<ToMultiSurfaceMesh<T, D>>::template New<
757 SmartPointer<Domain<T, D>> &, SmartPointer<Mesh<T>> &>))
758 .def(py::init(&SmartPointer<ToMultiSurfaceMesh<T, D>>::template New<
759 SmartPointer<Mesh<T>> &>))
760 // methods
761 .def("insertNextLevelSet", &ToMultiSurfaceMesh<T, D>::insertNextLevelSet,
762 "Insert next level set to output in the mesh.")
763 .def("clearLevelSets", &ToMultiSurfaceMesh<T, D>::clearLevelSets,
764 "Clear all inserted level sets.")
765 .def("setMesh", &ToMultiSurfaceMesh<T, D>::setMesh,
766 "Set the mesh to generate.")
767 .def("setMaterialMap", &ToMultiSurfaceMesh<T, D>::setMaterialMap,
768 "Set the material map to use for the multi surface mesh.")
769 .def("apply", &ToMultiSurfaceMesh<T, D>::apply,
770 "Convert the levelset to a surface mesh.");
771
772 // ToVoxelMesh
773 py::class_<ToVoxelMesh<T, D>, SmartPointer<ToVoxelMesh<T, D>>>(module,
774 "ToVoxelMesh")
775 // constructors
776 .def(py::init(&SmartPointer<ToVoxelMesh<T, D>>::template New<>))
777 .def(py::init(&SmartPointer<ToVoxelMesh<T, D>>::template New<
778 SmartPointer<Mesh<T>> &>))
779 .def(py::init(&SmartPointer<ToVoxelMesh<T, D>>::template New<
780 SmartPointer<Domain<T, D>> &, SmartPointer<Mesh<T>> &>))
781 .def(py::init(&SmartPointer<ToVoxelMesh<T, D>>::template New<
782 std::vector<SmartPointer<Domain<T, D>>> &,
783 SmartPointer<Mesh<T>> &>))
784 // methods
785 .def("insertNextLevelSet", &ToVoxelMesh<T, D>::insertNextLevelSet,
786 "Insert next level set to output in the mesh.")
787 .def("clearLevelSets", &ToVoxelMesh<T, D>::clearLevelSets,
788 "Clear all inserted level sets.")
789 .def("setMesh", &ToVoxelMesh<T, D>::setMesh, "Set the mesh to generate.")
790 .def("apply", &ToVoxelMesh<T, D>::apply,
791 "Convert the levelset to a surface mesh.");
792
793 // Writer
794 py::class_<Writer<T, D>, SmartPointer<Writer<T, D>>>(module, "Writer")
795 // constructors
796 .def(py::init(&SmartPointer<Writer<T, D>>::template New<>))
797 .def(py::init(&SmartPointer<Writer<T, D>>::template New<
798 SmartPointer<Domain<T, D>> &>))
799 .def(py::init(&SmartPointer<Writer<T, D>>::template New<
800 SmartPointer<Domain<T, D>> &, std::string>))
801 // methods
802 .def("setLevelSet", &Writer<T, D>::setLevelSet,
803 "Set levelset to write to file.")
804 .def("setFileName", &Writer<T, D>::setFileName,
805 "Set the filename for the output file.")
806 .def("apply", &Writer<T, D>::apply, "Write to file.");
807
808// WriteVisualizationMesh
809#ifdef VIENNALS_USE_VTK
810 py::class_<WriteVisualizationMesh<T, D>,
811 SmartPointer<WriteVisualizationMesh<T, D>>>(
812 module, "WriteVisualizationMesh")
813 // constructors
814 .def(
815 py::init(&SmartPointer<WriteVisualizationMesh<T, D>>::template New<>))
816 .def(py::init(&SmartPointer<WriteVisualizationMesh<T, D>>::template New<
817 SmartPointer<Domain<T, D>> &>))
818 // methods
819 .def("insertNextLevelSet",
820 &WriteVisualizationMesh<T, D>::insertNextLevelSet,
821 "Insert next level set to convert. Bigger level sets wrapping "
822 "smaller ones, should be inserted last.")
823 .def("setFileName", &WriteVisualizationMesh<T, D>::setFileName,
824 "Set Name of File to write.")
825 .def("setExtractHullMesh",
826 &WriteVisualizationMesh<T, D>::setExtractHullMesh,
827 "Whether to extract a hull mesh. Defaults to false.")
828 .def("setExtractVolumeMesh",
829 &WriteVisualizationMesh<T, D>::setExtractVolumeMesh,
830 " Whether to extract a tetra volume mesh. Defaults to true.")
831 .def("setMetaData", &WriteVisualizationMesh<T, D>::setMetaData,
832 "Set the metadata to be written to the file.")
833 .def("addMetaData",
834 py::overload_cast<const std::string &, T>(
835 &WriteVisualizationMesh<T, D>::addMetaData),
836 "Add a single metadata entry to the file.")
837 .def("addMetaData",
838 py::overload_cast<const std::string &, const std::vector<T> &>(
839 &WriteVisualizationMesh<T, D>::addMetaData),
840 "Add a single metadata entry to the file.")
841 .def("addMetaData",
842 py::overload_cast<
843 const std::unordered_map<std::string, std::vector<T>> &>(
844 &WriteVisualizationMesh<T, D>::addMetaData),
845 "Add metadata to the file.")
846 .def("apply", &WriteVisualizationMesh<T, D>::apply,
847 "Make and write mesh.");
848#endif
849
850 if constexpr (D == 2) {
851 // CompareArea
852 py::class_<CompareArea<T, D>, SmartPointer<CompareArea<T, D>>>(
853 module, "CompareArea")
854 // constructors
855 .def(py::init(&SmartPointer<CompareArea<T, D>>::template New<>))
856 .def(py::init(
857 &SmartPointer<CompareArea<T, D>>::template New<
858 SmartPointer<Domain<T, D>> &, SmartPointer<Domain<T, D>> &>))
859 // methods
860 .def("setLevelSetTarget", &CompareArea<T, D>::setLevelSetTarget,
861 "Sets the target level set.")
862 .def("setLevelSetSample", &CompareArea<T, D>::setLevelSetSample,
863 "Sets the sample level set.")
864 .def("setDefaultIncrement", &CompareArea<T, D>::setDefaultIncrement,
865 "Set default increment value")
866 .def("setXRangeAndIncrement", &CompareArea<T, D>::setXRangeAndIncrement,
867 "Sets the x-range and custom increment value")
868 .def("setYRangeAndIncrement", &CompareArea<T, D>::setYRangeAndIncrement,
869 "Sets the y-range and custom increment value")
870 .def("setOutputMesh", &CompareArea<T, D>::setOutputMesh,
871 "Set the output mesh where difference areas will be stored")
872 .def("getAreaMismatch", &CompareArea<T, D>::getAreaMismatch,
873 "Returns the computed area mismatch.")
874 .def("getCustomAreaMismatch", &CompareArea<T, D>::getCustomAreaMismatch,
875 "Returns the computed area mismatch, with custom increments "
876 "applied.")
877 .def("getCellCount", &CompareArea<T, D>::getCellCount,
878 "Returns the number of cells where the level sets differ.")
879 .def("getCustomCellCount", &CompareArea<T, D>::getCustomCellCount,
880 "Returns the number of cells where the level sets differ, with "
881 "custom increments applied.")
882 .def("apply", &CompareArea<T, D>::apply,
883 "Computes the area difference between the two level sets.");
884
885 // CompareChamfer
886 py::class_<CompareChamfer<T, D>, SmartPointer<CompareChamfer<T, D>>>(
887 module, "CompareChamfer")
888 // constructors
889 .def(py::init(&SmartPointer<CompareChamfer<T, D>>::template New<>))
890 .def(py::init(
891 &SmartPointer<CompareChamfer<T, D>>::template New<
892 SmartPointer<Domain<T, D>> &, SmartPointer<Domain<T, D>> &>))
893 // methods
894 .def("setLevelSetTarget", &CompareChamfer<T, D>::setLevelSetTarget,
895 "Set the target level set.")
896 .def("setLevelSetSample", &CompareChamfer<T, D>::setLevelSetSample,
897 "Set the sample level set.")
898 .def("setOutputMeshTarget", &CompareChamfer<T, D>::setOutputMeshTarget,
899 "Set output mesh for target surface points with distance data.")
900 .def("setOutputMeshSample", &CompareChamfer<T, D>::setOutputMeshSample,
901 "Set output mesh for sample surface points with distance data.")
902 .def("apply", &CompareChamfer<T, D>::apply,
903 "Apply the Chamfer distance calculation.")
904 .def("getForwardDistance", &CompareChamfer<T, D>::getForwardDistance,
905 "Get the forward distance (average distance from target to "
906 "sample).")
907 .def("getBackwardDistance", &CompareChamfer<T, D>::getBackwardDistance,
908 "Get the backward distance (average distance from sample to "
909 "target).")
910 .def("getChamferDistance", &CompareChamfer<T, D>::getChamferDistance,
911 "Get the Chamfer distance (average of forward and backward).")
912 .def("getRMSChamferDistance",
914 "Get the RMS Chamfer distance.")
915 .def("getMaxDistance", &CompareChamfer<T, D>::getMaxDistance,
916 "Get the maximum nearest-neighbor distance.")
917 .def("getNumTargetPoints", &CompareChamfer<T, D>::getNumTargetPoints,
918 "Get the number of target surface points.")
919 .def("getNumSamplePoints", &CompareChamfer<T, D>::getNumSamplePoints,
920 "Get the number of sample surface points.");
921
922 // CompareCriticalDimensions
923 py::class_<CompareCriticalDimensions<T, D>,
924 SmartPointer<CompareCriticalDimensions<T, D>>>(
925 module, "CompareCriticalDimensions")
926 // constructors
927 .def(py::init(
928 &SmartPointer<CompareCriticalDimensions<T, D>>::template New<>))
929 .def(py::init(
930 &SmartPointer<CompareCriticalDimensions<T, D>>::template New<
931 SmartPointer<Domain<T, D>> &, SmartPointer<Domain<T, D>> &>))
932 // methods
933 .def("setLevelSetTarget",
935 "Sets the target level set.")
936 .def("setLevelSetSample",
938 "Sets the sample level set.")
940 py::arg("minX"), py::arg("maxX"), py::arg("findMaximum") = true,
941 "Add an X range to find maximum or minimum Y position.")
943 py::arg("minY"), py::arg("maxY"), py::arg("findMaximum") = true,
944 "Add a Y range to find maximum or minimum X position.")
946 "Clear all range specifications.")
948 "Set the output mesh where critical dimension locations will be "
949 "stored.")
951 "Apply the comparison.")
952 .def("getNumCriticalDimensions",
954 "Get the number of critical dimensions compared.")
955 .def(
956 "getCriticalDimensionResult",
957 [](CompareCriticalDimensions<T, D> &self, size_t index) {
958 T posRef, posCmp, diff;
959 bool valid =
960 self.getCriticalDimensionResult(index, posRef, posCmp, diff);
961 if (valid) {
962 return py::make_tuple(true, posRef, posCmp, diff);
963 } else {
964 return py::make_tuple(false, 0.0, 0.0, 0.0);
965 }
966 },
967 py::arg("index"),
968 "Get a specific critical dimension result. Returns (valid, "
969 "positionTarget, positionSample, difference).")
970 .def("getMeanDifference",
972 "Get mean absolute difference across all valid critical "
973 "dimensions.")
974 .def("getMaxDifference",
976 "Get maximum difference across all valid critical dimensions.")
978 "Get RMSE across all valid critical dimensions.")
979 .def("getAllDifferences",
981 "Get all valid differences as a list.");
982
983 // CompareNarrowBand
984 py::class_<CompareNarrowBand<T, D>, SmartPointer<CompareNarrowBand<T, D>>>(
985 module, "CompareNarrowBand")
986 // constructors
987 .def(py::init(&SmartPointer<CompareNarrowBand<T, D>>::template New<>))
988 .def(py::init(
989 &SmartPointer<CompareNarrowBand<T, D>>::template New<
990 SmartPointer<Domain<T, D>> &, SmartPointer<Domain<T, D>> &>))
991 // methods
992 .def("setLevelSetTarget", &CompareNarrowBand<T, D>::setLevelSetTarget,
993 "Sets the target level set.")
994 .def("setLevelSetSample", &CompareNarrowBand<T, D>::setLevelSetSample,
995 "Sets the sample level set.")
996 .def("setXRange", &CompareNarrowBand<T, D>::setXRange,
997 "Set the x-coordinate range to restrict the comparison area")
998 .def("setYRange", &CompareNarrowBand<T, D>::setYRange,
999 "Set the y-coordinate range to restrict the comparison area")
1000 .def("clearXRange", &CompareNarrowBand<T, D>::clearXRange,
1001 "Clear the x-range restriction")
1002 .def("clearYRange", &CompareNarrowBand<T, D>::clearYRange,
1003 "Clear the y-range restriction")
1004 .def("setOutputMesh", &CompareNarrowBand<T, D>::setOutputMesh,
1005 "Set the output mesh where difference values will be stored")
1006 .def("setOutputMeshSquaredDifferences",
1008 "Set whether to output squared differences (true) or absolute "
1009 "differences (false)")
1010 .def("apply", &CompareNarrowBand<T, D>::apply,
1011 "Apply the comparison and calculate the sum of squared "
1012 "differences.")
1013 .def("getSumSquaredDifferences",
1015 "Return the sum of squared differences calculated by apply().")
1016 .def("getSumDifferences", &CompareNarrowBand<T, D>::getSumDifferences,
1017 "Return the sum of absolute differences calculated by apply().")
1018 .def("getNumPoints", &CompareNarrowBand<T, D>::getNumPoints,
1019 "Return the number of points used in the comparison.")
1020 .def("getRMSE", &CompareNarrowBand<T, D>::getRMSE,
1021 "Calculate the root mean square error from previously computed "
1022 "values.");
1023
1024 // CompareSparseField
1025 py::class_<CompareSparseField<T, D>,
1026 SmartPointer<CompareSparseField<T, D>>>(module,
1027 "CompareSparseField")
1028 // constructors
1029 .def(py::init(&SmartPointer<CompareSparseField<T, D>>::template New<>))
1030 .def(py::init(
1031 &SmartPointer<CompareSparseField<T, D>>::template New<
1032 SmartPointer<Domain<T, D>> &, SmartPointer<Domain<T, D>> &>))
1033 // methods
1034 .def("setLevelSetExpanded",
1036 "Sets the expanded level set for comparison.")
1037 .def("setLevelSetIterated",
1039 "Sets the iterated level set to compare against the expanded one.")
1040 .def("setXRange", &CompareSparseField<T, D>::setXRange,
1041 "Set the x-coordinate range to restrict the comparison area")
1042 .def("setYRange", &CompareSparseField<T, D>::setYRange,
1043 "Set the y-coordinate range to restrict the comparison area")
1044 .def("clearXRange", &CompareSparseField<T, D>::clearXRange,
1045 "Clear the x-range restriction")
1046 .def("clearYRange", &CompareSparseField<T, D>::clearYRange,
1047 "Clear the y-range restriction")
1048 .def("setOutputMesh", &CompareSparseField<T, D>::setOutputMesh,
1049 "Set the output mesh where difference values will be stored")
1050 .def("setFillIteratedWithDistances",
1052 "Set whether to fill the iterated level set with distance values")
1053 .def("setExpandedLevelSetWidth",
1055 "Set the expansion width for the expanded level set")
1056 .def("apply", &CompareSparseField<T, D>::apply,
1057 "Apply the comparison and calculate the sum of squared "
1058 "differences.")
1059 .def("getSumSquaredDifferences",
1061 "Return the sum of squared differences calculated by apply().")
1062 .def("getSumDifferences", &CompareSparseField<T, D>::getSumDifferences,
1063 "Return the sum of absolute differences calculated by apply().")
1064 .def("getNumPoints", &CompareSparseField<T, D>::getNumPoints,
1065 "Return the number of points used in the comparison.")
1066 .def("getNumSkippedPoints",
1068 "Return the number of points skipped during comparison.")
1069 .def("getRMSE", &CompareSparseField<T, D>::getRMSE,
1070 "Calculate the root mean square error from previously computed "
1071 "values.");
1072 }
1073}
constexpr int D
Definition Epitaxy.cpp:11
double T
Definition Epitaxy.cpp:12
Definition pyWrap.hpp:66
T getSignedDistance(const vectorType &initial, const vectorType &candidate, unsigned long initialPointId) const override
Definition pyWrap.hpp:78
bool isInside(const vectorType &initial, const vectorType &candidate, double eps=0.) const override
Definition pyWrap.hpp:73
boundsType getBounds() const override
Sets bounds to the bounding box of the distribution.
Definition pyWrap.hpp:84
Stencil Local Lax Friedrichs Integration Scheme. It uses a stencil of order around active points,...
Definition lsStencilLocalLaxFriedrichsScalar.hpp:33
This class is used to advance level sets over time. Level sets are passed to the constructor in a std...
Definition lsAdvect.hpp:64
void setVelocityField(SmartPointer< VelocityField< T > > passedVelocities)
Set the velocity field used for advection. This should be a concrete implementation of lsVelocityFiel...
Definition lsAdvect.hpp:738
void insertNextLevelSet(SmartPointer< Domain< T, D > > passedlsDomain)
Pushes the passed level set to the back of the list of level sets used for advection.
Definition lsAdvect.hpp:730
bool getCalculateNormalVectors() const
Get whether normal vectors were calculated.
Definition lsAdvect.hpp:793
void setIgnoreVoids(bool iV)
Set whether level set values, which are not part of the "top" geometrically connected part of values,...
Definition lsAdvect.hpp:773
void clearLevelSets()
Definition lsAdvect.hpp:734
void setCalculateNormalVectors(bool cnv)
Set whether normal vectors should be calculated at each level set point. Defaults to true....
Definition lsAdvect.hpp:765
void apply()
Perform the advection.
Definition lsAdvect.hpp:863
void prepareLS()
Definition lsAdvect.hpp:816
double getAdvectedTime() const
Get by how much the physical time was advanced during the last apply() call.
Definition lsAdvect.hpp:781
void setDissipationAlpha(const double &a)
Set the alpha dissipation coefficient. For lsLaxFriedrichs, this is used as the alpha value....
Definition lsAdvect.hpp:805
void setIntegrationScheme(IntegrationSchemeEnum scheme)
Set which integration scheme should be used out of the ones specified in IntegrationSchemeEnum.
Definition lsAdvect.hpp:797
double getCurrentTimeStep() const
Return the last applied time step.
Definition lsAdvect.hpp:784
void setAdvectionTime(double time)
Set the time until when the level set should be advected. If this takes more than one advection step,...
Definition lsAdvect.hpp:747
unsigned getNumberOfTimeSteps() const
Get how many advection steps were performed during the last apply() call.
Definition lsAdvect.hpp:787
void setTimeStepRatio(const double &cfl)
Set the CFL condition to use during advection. The CFL condition sets the maximum distance a surface ...
Definition lsAdvect.hpp:759
void applyIntegration(double maxTimeStep=std::numeric_limits< double >::max())
This function applies the integration scheme and calculates the rates and the maximum time step,...
Definition lsAdvect.hpp:883
double getTimeStepRatio() const
Get the value of the CFL number.
Definition lsAdvect.hpp:790
This class is used to perform boolean operations on two level sets and write the resulting level set ...
Definition lsBooleanOperation.hpp:43
void setLevelSet(SmartPointer< Domain< T, D > > passedlsDomain)
Set which level set to perform the boolean operation on.
Definition lsBooleanOperation.hpp:287
void setSecondLevelSet(SmartPointer< Domain< T, D > > passedlsDomain)
Set the level set which will be used to modify the first level set.
Definition lsBooleanOperation.hpp:293
void setBooleanOperation(BooleanOperationEnum passedOperation)
Set which of the operations of BooleanOperationEnum to perform.
Definition lsBooleanOperation.hpp:298
void apply()
Perform operation.
Definition lsBooleanOperation.hpp:316
Concrete implementation of GeometricAdvectDistribution for a rectangular box distribution.
Definition lsGeometricAdvectDistributions.hpp:129
bool isInside(const Vec3D< viennahrle::CoordType > &initial, const Vec3D< viennahrle::CoordType > &candidate, double eps) const override
Quick check whether a point relative to the distributions center is inside the distribution....
Definition lsGeometricAdvectDistributions.hpp:136
std::array< viennahrle::CoordType, 6 > getBounds() const override
Sets bounds to the bounding box of the distribution.
Definition lsGeometricAdvectDistributions.hpp:159
T getSignedDistance(const Vec3D< viennahrle::CoordType > &initial, const Vec3D< viennahrle::CoordType > &candidate, unsigned long) const override
Returns the signed distance of a point relative to the distributions center. This is the signed manha...
Definition lsGeometricAdvectDistributions.hpp:148
Class describing a square box from one coordinate to another.
Definition lsGeometries.hpp:71
Definition lsCalculateCurvatures.hpp:24
void setCurvatureType(CurvatureEnum passedType)
Definition lsCalculateCurvatures.hpp:46
void setMaxValue(const T passedMaxValue)
Definition lsCalculateCurvatures.hpp:59
void apply()
Definition lsCalculateCurvatures.hpp:61
void setLevelSet(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsCalculateCurvatures.hpp:42
This algorithm is used to compute the normal vectors for all points with level set values <= maxValue...
Definition lsCalculateNormalVectors.hpp:35
void setLevelSet(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsCalculateNormalVectors.hpp:53
void apply()
Definition lsCalculateNormalVectors.hpp:82
Definition lsCalculateVisibilities.hpp:10
void apply()
Definition lsCalculateVisibilities.hpp:25
This class is used to find errors in the underlying level set structure, like invalid neighbours of d...
Definition lsCheck.hpp:22
void apply()
Definition lsCheck.hpp:78
void setLevelSet(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsCheck.hpp:66
Computes an estimate of the area where two level sets differ. The area is calculated by iterating thr...
Definition lsCompareArea.hpp:24
unsigned long int getCustomCellCount() const
Returns the number of cells where the level sets differ, with custom increments applied.
Definition lsCompareArea.hpp:176
void setXRangeAndIncrement(hrleIndexType minXRange, hrleIndexType maxXRange, unsigned short int Xincrement)
Sets the x-range and custom increment value.
Definition lsCompareArea.hpp:135
void setLevelSetTarget(SmartPointer< Domain< T, D > > passedLevelSet)
Sets the target level set.
Definition lsCompareArea.hpp:120
unsigned long int getCellCount() const
Returns the number of cells where the level sets differ.
Definition lsCompareArea.hpp:172
double getCustomAreaMismatch() const
Returns the computed area mismatch, with custom increments applied.
Definition lsCompareArea.hpp:166
void setLevelSetSample(SmartPointer< Domain< T, D > > passedLevelSet)
Sets the sample level set.
Definition lsCompareArea.hpp:125
void apply()
Computes the area difference between the two level sets.
Definition lsCompareArea.hpp:181
void setOutputMesh(SmartPointer< Mesh< T > > passedMesh)
Set the output mesh where difference areas will be stored for visualization. Each cell in the mesh wi...
Definition lsCompareArea.hpp:156
void setDefaultIncrement(unsigned short int increment)
Set default increment value.
Definition lsCompareArea.hpp:130
void setYRangeAndIncrement(hrleIndexType minYRange, hrleIndexType maxYRange, unsigned short int Yincrement)
Sets the y-range and custom increment value.
Definition lsCompareArea.hpp:144
double getAreaMismatch() const
Returns the computed area mismatch.
Definition lsCompareArea.hpp:161
Calculate Chamfer distance between two level sets by comparing their zero-level-set surfaces....
Definition lsCompareChamfer.hpp:39
unsigned getNumSamplePoints() const
Get the number of sample surface points.
Definition lsCompareChamfer.hpp:336
void apply()
Apply the Chamfer distance calculation.
Definition lsCompareChamfer.hpp:116
T getMaxDistance() const
Get the maximum nearest-neighbor distance.
Definition lsCompareChamfer.hpp:330
T getBackwardDistance() const
Get the backward distance (average distance from sample to target).
Definition lsCompareChamfer.hpp:321
void setOutputMeshSample(SmartPointer< Mesh< T > > passedMesh)
Set output mesh for sample surface points with distance data.
Definition lsCompareChamfer.hpp:111
T getRMSChamferDistance() const
Get the RMS Chamfer distance.
Definition lsCompareChamfer.hpp:327
T getChamferDistance() const
Get the Chamfer distance (average of forward and backward).
Definition lsCompareChamfer.hpp:324
T getForwardDistance() const
Get the forward distance (average distance from target to sample).
Definition lsCompareChamfer.hpp:318
void setOutputMeshTarget(SmartPointer< Mesh< T > > passedMesh)
Set output mesh for target surface points with distance data.
Definition lsCompareChamfer.hpp:106
void setLevelSetTarget(SmartPointer< Domain< T, D > > passedLevelSet)
Set the target level set.
Definition lsCompareChamfer.hpp:96
unsigned getNumTargetPoints() const
Get the number of target surface points.
Definition lsCompareChamfer.hpp:333
void setLevelSetSample(SmartPointer< Domain< T, D > > passedLevelSet)
Set the sample level set.
Definition lsCompareChamfer.hpp:101
Compares critical dimensions (surface positions) between two level sets. Critical dimensions are defi...
Definition lsCompareCriticalDimensions.hpp:35
void apply()
Apply the comparison.
Definition lsCompareCriticalDimensions.hpp:199
std::vector< T > getAllDifferences() const
Get all valid results.
Definition lsCompareCriticalDimensions.hpp:350
void setOutputMesh(SmartPointer< Mesh< T > > passedMesh)
Set the output mesh where critical dimension locations will be stored.
Definition lsCompareCriticalDimensions.hpp:194
bool getCriticalDimensionResult(size_t index, T &positionTarget, T &positionSample, T &difference) const
Get a specific critical dimension result.
Definition lsCompareCriticalDimensions.hpp:300
size_t getNumCriticalDimensions() const
Get the number of critical dimensions compared.
Definition lsCompareCriticalDimensions.hpp:297
void addYRange(T minY, T maxY, bool findMaximum=true)
Add a Y range to find maximum or minimum X position.
Definition lsCompareCriticalDimensions.hpp:181
void clearRanges()
Clear all range specifications.
Definition lsCompareCriticalDimensions.hpp:191
void setLevelSetTarget(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsCompareCriticalDimensions.hpp:162
T getMeanDifference() const
Get mean absolute difference across all valid critical dimensions.
Definition lsCompareCriticalDimensions.hpp:312
T getMaxDifference() const
Get maximum difference across all valid critical dimensions.
Definition lsCompareCriticalDimensions.hpp:325
void addXRange(T minX, T maxX, bool findMaximum=true)
Add an X range to find maximum or minimum Y position.
Definition lsCompareCriticalDimensions.hpp:171
T getRMSE() const
Get RMSE across all valid critical dimensions.
Definition lsCompareCriticalDimensions.hpp:336
void setLevelSetSample(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsCompareCriticalDimensions.hpp:166
Calculate distance measure between two level sets by comparing their SDF values on a narrow band....
Definition lsCompareNarrowBand.hpp:19
void setYRange(T minYRange, T maxYRange)
Set the y-coordinate range to restrict the comparison area.
Definition lsCompareNarrowBand.hpp:172
void setOutputMeshSquaredDifferences(bool value)
Set whether to output squared differences (true) or absolute differences (false).
Definition lsCompareNarrowBand.hpp:201
void setXRange(T minXRange, T maxXRange)
Set the x-coordinate range to restrict the comparison area.
Definition lsCompareNarrowBand.hpp:165
void setOutputMesh(SmartPointer< Mesh< T > > passedMesh, bool outputMeshSquaredDiffs=true)
Set the output mesh where difference values will be stored.
Definition lsCompareNarrowBand.hpp:193
void setLevelSetTarget(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsCompareNarrowBand.hpp:156
T getRMSE() const
Calculate the root mean square error from previously computed values.
Definition lsCompareNarrowBand.hpp:373
void setLevelSetSample(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsCompareNarrowBand.hpp:160
unsigned getNumPoints() const
Return the number of points used in the comparison.
Definition lsCompareNarrowBand.hpp:370
void clearYRange()
Clear the y-range restriction.
Definition lsCompareNarrowBand.hpp:186
T getSumSquaredDifferences() const
Return the sum of squared differences calculated by apply().
Definition lsCompareNarrowBand.hpp:364
void apply()
Apply the comparison and calculate the sum of squared differences.
Definition lsCompareNarrowBand.hpp:206
void clearXRange()
Clear the x-range restriction.
Definition lsCompareNarrowBand.hpp:179
T getSumDifferences() const
Definition lsCompareNarrowBand.hpp:367
Calculate distance measure between two level sets by comparing their SDF values on a sparse field....
Definition lsCompareSparseField.hpp:34
unsigned getNumPoints() const
Return the number of points used in the comparison.
Definition lsCompareSparseField.hpp:386
T getRMSE() const
Calculate the root mean square error from previously computed values.
Definition lsCompareSparseField.hpp:392
void setXRange(T minXRange, T maxXRange)
Set the x-coordinate range to restrict the comparison area.
Definition lsCompareSparseField.hpp:164
void setExpandedLevelSetWidth(int width)
Set the expansion width for the expanded level set This value will be used if the expanded level set ...
Definition lsCompareSparseField.hpp:204
void setOutputMesh(SmartPointer< Mesh< T > > passedMesh)
Set the output mesh where difference values will be stored.
Definition lsCompareSparseField.hpp:192
void setLevelSetIterated(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsCompareSparseField.hpp:159
unsigned getNumSkippedPoints() const
Return the number of skipped points during the comparison.
Definition lsCompareSparseField.hpp:389
void setYRange(T minYRange, T maxYRange)
Set the y-coordinate range to restrict the comparison area.
Definition lsCompareSparseField.hpp:171
void setLevelSetExpanded(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsCompareSparseField.hpp:155
void setFillIteratedWithDistances(bool fill)
Set whether to fill the iterated level set with distances.
Definition lsCompareSparseField.hpp:197
T getSumSquaredDifferences() const
Return the sum of squared differences calculated by apply().
Definition lsCompareSparseField.hpp:380
T getSumDifferences() const
Return the sum of differences calculated by apply().
Definition lsCompareSparseField.hpp:383
void clearYRange()
Clear the y-range restriction.
Definition lsCompareSparseField.hpp:185
void apply()
Apply the comparison and calculate the sum of squared differences.
Definition lsCompareSparseField.hpp:217
void clearXRange()
Clear the x-range restriction.
Definition lsCompareSparseField.hpp:178
This algorithm creates a convex hull mesh from a point cloud. This is done using the gift wrapping ap...
Definition lsConvexHull.hpp:23
void apply()
Definition lsConvexHull.hpp:285
void setMesh(SmartPointer< Mesh< T > > passedMesh)
Definition lsConvexHull.hpp:279
void setPointCloud(SmartPointer< PointCloud< T, D > > passedPointCloud)
Definition lsConvexHull.hpp:281
Definition lsGeometricAdvectDistributions.hpp:186
T getSignedDistance(const Vec3D< viennahrle::CoordType > &initial, const Vec3D< viennahrle::CoordType > &candidate, unsigned long pointId) const override
Returns the signed distance of a point relative to the distributions center. This is the signed manha...
Definition lsGeometricAdvectDistributions.hpp:199
std::array< viennahrle::CoordType, 6 > getBounds() const override
Sets bounds to the bounding box of the distribution.
Definition lsGeometricAdvectDistributions.hpp:243
Class describing a square box from one coordinate to another.
Definition lsGeometries.hpp:100
This class detects features of the level set function. This class offers two methods to determine fea...
Definition lsDetectFeatures.hpp:26
void apply()
Execute the algorithm.
Definition lsDetectFeatures.hpp:64
void setDetectionThreshold(T threshold)
Definition lsDetectFeatures.hpp:51
void setDetectionMethod(FeatureDetectionEnum passedMethod)
Set which algorithm to use to detect features. The curvature-based algorithm should always be preferr...
Definition lsDetectFeatures.hpp:59
Class containing all information about the level set, including the dimensions of the domain,...
Definition lsDomain.hpp:27
void clearMetaData()
Definition lsDomain.hpp:163
void deepCopy(const SmartPointer< Domain< T, D > > passedDomain)
copy all values of "passedDomain" to this Domain
Definition lsDomain.hpp:124
unsigned getNumberOfSegments() const
returns the number of segments, the levelset is split into. This is useful for algorithm parallelisat...
Definition lsDomain.hpp:153
void print(std::ostream &out=std::cout)
prints basic information and all memebers of the levelset structure
Definition lsDomain.hpp:178
int getLevelSetWidth() const
Definition lsDomain.hpp:158
unsigned getNumberOfPoints() const
returns the number of defined points
Definition lsDomain.hpp:156
void setLevelSetWidth(int width)
Definition lsDomain.hpp:160
Expands the levelSet to the specified number of layers. The largest value in the levelset is thus wid...
Definition lsExpand.hpp:17
void apply()
Apply the expansion to the specified width.
Definition lsExpand.hpp:44
void setWidth(int passedWidth)
Set how far the level set should be extended. Points with value width*0.5 will be added by this algor...
Definition lsExpand.hpp:37
void setLevelSet(SmartPointer< Domain< T, D > > passedlsDomain)
Definition lsExpand.hpp:31
Import the regular grid, on which the level set values are defined, from an explicit Mesh<>....
Definition lsFromMesh.hpp:16
void setMesh(const SmartPointer< Mesh< T > > passedMesh)
Definition lsFromMesh.hpp:34
void setSortPointList(bool passedSortPointList)
Definition lsFromMesh.hpp:36
void apply()
Definition lsFromMesh.hpp:40
Construct a level set from an explicit mesh.
Definition lsFromSurfaceMesh.hpp:15
void setRemoveBoundaryTriangles(bool passedRemoveBoundaryTriangles)
Set whether all triangles outside the domain should be ignored (=true) or whether boundary conditions...
Definition lsFromSurfaceMesh.hpp:227
void setLevelSet(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsFromSurfaceMesh.hpp:218
void apply()
Definition lsFromSurfaceMesh.hpp:243
void setMesh(SmartPointer< Mesh< T > > passedMesh)
Definition lsFromSurfaceMesh.hpp:222
This class creates a level set from a tetrahedral mesh. If the mesh contains a scalar data array call...
Definition lsFromVolumeMesh.hpp:22
typename Domain< T, D >::GridType GridType
Definition lsFromVolumeMesh.hpp:26
void apply()
Definition lsFromVolumeMesh.hpp:56
void setMesh(SmartPointer< Mesh< T > > passedMesh)
Definition lsFromVolumeMesh.hpp:48
void setGrid(const GridType &passedGrid)
Definition lsFromVolumeMesh.hpp:43
void setRemoveBoundaryTriangles(bool passedRemoveBoundaryTriangles)
Definition lsFromVolumeMesh.hpp:50
Base class for distributions used by lsGeometricAdvect. All functions are pure virtual and must be im...
Definition lsGeometricAdvectDistributions.hpp:15
virtual void prepare(SmartPointer< Domain< T, D > > domain)
Definition lsGeometricAdvectDistributions.hpp:43
virtual bool isInside(const Vec3D< viennahrle::CoordType > &initial, const Vec3D< viennahrle::CoordType > &candidate, double eps) const
Quick check whether a point relative to the distributions center is inside the distribution....
Definition lsGeometricAdvectDistributions.hpp:23
virtual T getSignedDistance(const Vec3D< viennahrle::CoordType > &initial, const Vec3D< viennahrle::CoordType > &candidate, unsigned long pointId) const =0
Returns the signed distance of a point relative to the distributions center. This is the signed manha...
virtual void finalize()
Definition lsGeometricAdvectDistributions.hpp:44
virtual std::array< viennahrle::CoordType, 6 > getBounds() const =0
Sets bounds to the bounding box of the distribution.
This class advects the level set according to a given distribution. This distribution is overlayed at...
Definition lsGeometricAdvect.hpp:35
void setLevelSet(SmartPointer< Domain< T, D > > passedLevelSet)
Set the levelset which should be advected.
Definition lsGeometricAdvect.hpp:76
void apply()
Perform geometrical advection.
Definition lsGeometricAdvect.hpp:95
void setAdvectionDistribution(SmartPointer< GeometricAdvectDistribution< T, D > > passedDist)
Set which advection distribution to use. Must be derived from GeometricAdvectDistribution.
Definition lsGeometricAdvect.hpp:82
Create level sets describing basic geometric forms.
Definition lsMakeGeometry.hpp:27
void setIgnoreBoundaryConditions(bool passedIgnoreBoundaryConditions)
Ignore boundary conditions, meaning the parts of the generated geometry which are outside of the doma...
Definition lsMakeGeometry.hpp:129
void apply()
Definition lsMakeGeometry.hpp:146
void setLevelSet(SmartPointer< Domain< T, D > > passedlsDomain)
Definition lsMakeGeometry.hpp:87
void setGeometry(SmartPointer< Sphere< T, D > > passedSphere)
Set sphere as geometry to be created in the level set.
Definition lsMakeGeometry.hpp:92
This class is used to mark points of the level set which are enclosed in a void.
Definition lsMarkVoidPoints.hpp:28
void setLevelSet(SmartPointer< Domain< T, D > > passedlsDomain)
Definition lsMarkVoidPoints.hpp:94
void setReverseVoidDetection(bool passedReverseVoidDetection)
Set whether the "top" level set should be the most positive(default) connected chain of level set val...
Definition lsMarkVoidPoints.hpp:102
void apply()
Definition lsMarkVoidPoints.hpp:153
void setSaveComponentIds(bool scid)
Set whether the connected component IDs used to generate the void points should be saved....
Definition lsMarkVoidPoints.hpp:151
void setDetectLargestSurface(bool passedDetect)
Set whether the number of points of one connected surface should be used to detect void points....
Definition lsMarkVoidPoints.hpp:112
void setVoidTopSurface(VoidTopSurfaceEnum topSurface)
Set which connected component to use as the top surface and mark all other components as void points.
Definition lsMarkVoidPoints.hpp:118
This class holds an explicit mesh, which is always given in 3 dimensions. If it describes a 2D mesh,...
Definition lsMesh.hpp:22
Class describing a plane via a point in it and the plane normal.
Definition lsGeometries.hpp:42
Class describing a point cloud, which can be used to create geometries from its convex hull mesh.
Definition lsGeometries.hpp:145
void insertNextPoint(T *newPoint)
Definition lsGeometries.hpp:154
Removes all level set points, which do not have at least one oppositely signed neighbour (Meaning the...
Definition lsPrune.hpp:17
void apply()
removes all grid points, which do not have at least one opposite signed neighbour returns the number ...
Definition lsPrune.hpp:74
void setLevelSet(SmartPointer< Domain< T, D > > passedlsDomain)
Definition lsPrune.hpp:59
Definition lsReader.hpp:13
void setLevelSet(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsReader.hpp:26
void apply()
Definition lsReader.hpp:35
void setFileName(std::string passedFileName)
set file name for file to write
Definition lsReader.hpp:31
Reduce the level set size to the specified width. This means all level set points with value <= 0....
Definition lsReduce.hpp:14
void apply()
Reduces the leveleSet to the specified number of layers. The largest value in the levelset is thus wi...
Definition lsReduce.hpp:55
void setLevelSet(SmartPointer< Domain< T, D > > passedlsDomain)
Definition lsReduce.hpp:32
void setWidth(int passedWidth)
Set which level set points should be kept. All points with a level set value >0.5*width will be remov...
Definition lsReduce.hpp:39
void setNoNewSegment(bool passedNoNewSegment)
Set whether to segment the level set after algorithm is finished. This means points will be evenly di...
Definition lsReduce.hpp:44
This algorithm can be used to remove all LS values which are not part of a so-called top surface....
Definition lsRemoveStrayPoints.hpp:17
void setVoidTopSurface(VoidTopSurfaceEnum topSurface)
Set how the algorithm should pick the surface which will not be removed. Defaults to the surface with...
Definition lsRemoveStrayPoints.hpp:33
void apply()
Definition lsRemoveStrayPoints.hpp:37
void setLevelSet(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsRemoveStrayPoints.hpp:27
Concrete implementation of GeometricAdvectDistribution for a spherical advection distribution.
Definition lsGeometricAdvectDistributions.hpp:50
bool isInside(const Vec3D< viennahrle::CoordType > &initial, const Vec3D< viennahrle::CoordType > &candidate, double eps) const override
Quick check whether a point relative to the distributions center is inside the distribution....
Definition lsGeometricAdvectDistributions.hpp:60
std::array< viennahrle::CoordType, 6 > getBounds() const override
Sets bounds to the bounding box of the distribution.
Definition lsGeometricAdvectDistributions.hpp:110
T getSignedDistance(const Vec3D< viennahrle::CoordType > &initial, const Vec3D< viennahrle::CoordType > &candidate, unsigned long) const override
Returns the signed distance of a point relative to the distributions center. This is the signed manha...
Definition lsGeometricAdvectDistributions.hpp:75
Class describing a sphere via origin and radius.
Definition lsGeometries.hpp:15
This class creates a mesh from the level set with all grid points with a level set value <= 0....
Definition lsToDiskMesh.hpp:24
void clearLevelSets()
Definition lsToDiskMesh.hpp:83
void setMesh(SmartPointer< Mesh< N > > passedMesh)
Definition lsToDiskMesh.hpp:70
void setMaterialMap(SmartPointer< MaterialMap > passedMaterialMap)
Definition lsToDiskMesh.hpp:77
void apply()
Definition lsToDiskMesh.hpp:85
void insertNextLevelSet(SmartPointer< Domain< T, D > > passedLevelSet)
Pushes the passed level set to the back of the list of level sets.
Definition lsToDiskMesh.hpp:66
void setMaxValue(const T passedMaxValue)
Definition lsToDiskMesh.hpp:81
void setLevelSet(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsToDiskMesh.hpp:61
Extract the regular grid, on which the level set values are defined, to an explicit Mesh<>....
Definition lsToMesh.hpp:19
void setOnlyDefined(bool passedOnlyDefined)
Definition lsToMesh.hpp:43
void setLevelSet(SmartPointer< Domain< T, D > > passedlsDomain)
Definition lsToMesh.hpp:37
void apply()
Definition lsToMesh.hpp:49
void setOnlyActive(bool passedOnlyActive)
Definition lsToMesh.hpp:47
void setMesh(SmartPointer< Mesh< T > > passedMesh)
Definition lsToMesh.hpp:41
Definition lsToMultiSurfaceMesh.hpp:22
void setMaterialMap(SmartPointer< MaterialMap > passedMaterialMap)
Definition lsToMultiSurfaceMesh.hpp:81
void setMesh(SmartPointer< viennals::Mesh< T > > passedMesh)
Definition lsToMultiSurfaceMesh.hpp:71
void apply()
Definition lsToMultiSurfaceMesh.hpp:85
void clearLevelSets()
Definition lsToMultiSurfaceMesh.hpp:79
void insertNextLevelSet(SmartPointer< lsDomainType > passedLevelSet)
Definition lsToMultiSurfaceMesh.hpp:75
Extract an explicit Mesh<> instance from an lsDomain. The interface is then described by explicit sur...
Definition lsToSurfaceMesh.hpp:21
void setMesh(SmartPointer< Mesh< T > > passedMesh)
Definition lsToSurfaceMesh.hpp:41
void apply()
Definition lsToSurfaceMesh.hpp:45
void setLevelSet(SmartPointer< Domain< T, D > > passedlsDomain)
Definition lsToSurfaceMesh.hpp:37
Creates a mesh, which consists only of quads/hexas for completely filled grid cells in the level set....
Definition lsToVoxelMesh.hpp:20
void setMesh(SmartPointer< Mesh< T > > passedMesh)
Definition lsToVoxelMesh.hpp:76
void clearLevelSets()
Definition lsToVoxelMesh.hpp:74
void insertNextLevelSet(SmartPointer< Domain< T, D > > passedLevelSet)
Push level set to the list of level sets used for output. If more than one are specified,...
Definition lsToVoxelMesh.hpp:70
void apply()
Definition lsToVoxelMesh.hpp:82
Abstract class defining the interface for the velocity field used during advection using lsAdvect.
Definition lsVelocityField.hpp:11
Definition lsWriter.hpp:13
void setFileName(std::string passedFileName)
set file name for file to write
Definition lsWriter.hpp:31
void setLevelSet(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsWriter.hpp:26
void apply()
Definition lsWriter.hpp:35
Definition lsAdvect.hpp:36
FeatureDetectionEnum
Definition lsDetectFeatures.hpp:16
BooleanOperationEnum
Enumeration for the different types of boolean operations which are supported. When INVERT,...
Definition lsBooleanOperation.hpp:25
CurvatureEnum
Definition lsCalculateCurvatures.hpp:15
void bindApi(py::module &module)
Definition pyWrap.hpp:89
PYBIND11_DECLARE_HOLDER_TYPE(TemplateType, SmartPointer< TemplateType >)