ViennaLS
Loading...
Searching...
No Matches
pyWrap.hpp
Go to the documentation of this file.
1#include <pybind11/functional.h>
2#include <pybind11/iostream.h>
3#include <pybind11/pybind11.h>
4#include <pybind11/stl.h>
5
6// all header files which define API functions
7#include <lsAdvect.hpp>
12#include <lsCheck.hpp>
13#include <lsCompareChamfer.hpp>
17#include <lsCompareVolume.hpp>
18#include <lsConvexHull.hpp>
19#include <lsDetectFeatures.hpp>
20#include <lsDomain.hpp>
21#include <lsExpand.hpp>
22#include <lsExtrude.hpp>
23#include <lsFileFormats.hpp>
24#include <lsFromMesh.hpp>
25#include <lsFromSurfaceMesh.hpp>
26#include <lsFromVolumeMesh.hpp>
27#include <lsGeometricAdvect.hpp>
29#include <lsGeometries.hpp>
30#include <lsMakeGeometry.hpp>
31#include <lsMarkVoidPoints.hpp>
32#include <lsMaterialMap.hpp>
33#include <lsMesh.hpp>
34#include <lsPointData.hpp>
35#include <lsPrune.hpp>
36#include <lsReader.hpp>
37#include <lsReduce.hpp>
39#include <lsSlice.hpp>
40#include <lsToDiskMesh.hpp>
41#include <lsToMesh.hpp>
43#include <lsToSurfaceMesh.hpp>
44#include <lsToVoxelMesh.hpp>
45#include <lsTransformMesh.hpp>
46#include <lsVTKReader.hpp>
47#include <lsVTKRenderWindow.hpp>
48#include <lsVTKWriter.hpp>
49#include <lsVelocityField.hpp>
50#include <lsVersion.hpp>
52#include <lsWriter.hpp>
53
54#include <vcLogger.hpp>
55#include <vcSmartPointer.hpp>
56
57using namespace viennals;
58namespace py = pybind11;
59
60// always use double for python export
61typedef double T;
62
63PYBIND11_DECLARE_HOLDER_TYPE(TemplateType, SmartPointer<TemplateType>);
64
65// GeometricAdvectDistribution
66template <int D>
68 : public GeometricAdvectDistribution<T, D> {
69 typedef std::array<viennahrle::CoordType, 3> vectorType;
70 typedef std::array<viennahrle::CoordType, 6> boundsType;
71 typedef GeometricAdvectDistribution<T, D> ClassType;
73
74public:
75 bool isInside(const vectorType &initial, const vectorType &candidate,
76 double eps = 0.) const override {
77 PYBIND11_OVERLOAD(bool, ClassType, isInside, initial, candidate, eps);
78 }
79
80 T getSignedDistance(const vectorType &initial, const vectorType &candidate,
81 unsigned long initialPointId) const override {
82 PYBIND11_OVERLOAD_PURE(T, ClassType, getSignedDistance, initial, candidate,
83 initialPointId);
84 }
85
86 boundsType getBounds() const override {
87 PYBIND11_OVERLOAD_PURE(boundsType, ClassType, getBounds);
88 }
89};
90
91template <int D> void bindApi(py::module &module) {
92 // Also wrap hrleGrid so it can be used to create new LevelSets
93 py::class_<viennahrle::Grid<D>>(module, "hrleGrid");
94
95 // Domain
96 py::class_<Domain<T, D>, SmartPointer<Domain<T, D>>>(module, "Domain")
97 // constructors
98 .def(py::init(&SmartPointer<Domain<T, D>>::template New<>))
99 .def(
100 py::init(
101 &SmartPointer<Domain<T, D>>::template New<viennahrle::CoordType>),
102 py::arg("gridDelta") = 1.0)
103 // .def(py::init(
104 // &SmartPointer<Domain<T, D>>::New<viennahrle::CoordType *,
105 // BoundaryConditionEnum *>))
106 .def(py::init([](std::array<viennahrle::CoordType, 2 * D> bounds,
107 std::array<BoundaryConditionEnum, D> bcs,
108 viennahrle::CoordType gridDelta) {
109 return SmartPointer<Domain<T, D>>::New(bounds.data(), bcs.data(),
110 gridDelta);
111 }),
112 py::arg("bounds"), py::arg("boundaryConditions"),
113 py::arg("gridDelta") = 1.0)
114 .def(py::init(&SmartPointer<Domain<T, D>>::template New<
115 std::vector<viennahrle::CoordType>, std::vector<unsigned>,
116 viennahrle::CoordType>),
117 py::arg("bounds"), py::arg("boundaryConditions"),
118 py::arg("gridDelta") = 1.0)
119 // .def(py::init(
120 // &SmartPointer<Domain<T, D>>::New<Domain<T,
121 // D>::PointValueVectorType,
122 // viennahrle::CoordType *,
123 // BoundaryConditionEnum *>))
124 // .def(py::init(&SmartPointer<Domain<T, D>>::New<
125 // Domain<T, D>::PointValueVectorType,
126 // viennahrle::CoordType
127 // *, BoundaryConditionEnum *,
128 // viennahrle::CoordType>))
129 .def(py::init(&SmartPointer<Domain<T, D>>::template New<
130 SmartPointer<Domain<T, D>> &>))
131 .def(py::init(
132 &SmartPointer<Domain<T, D>>::template New<viennahrle::Grid<D> &>))
133 // methods
134 .def("deepCopy", &Domain<T, D>::deepCopy,
135 "Copy lsDomain in this lsDomain.")
136 .def("getNumberOfSegments", &Domain<T, D>::getNumberOfSegments,
137 "Get the number of segments, the level set structure is divided "
138 "into.")
139 .def("getNumberOfPoints", &Domain<T, D>::getNumberOfPoints,
140 "Get the number of defined level set values.")
141 .def("getLevelSetWidth", &Domain<T, D>::getLevelSetWidth,
142 "Get the number of layers of level set points around the explicit "
143 "surface.")
144 .def("setLevelSetWidth", &Domain<T, D>::setLevelSetWidth,
145 "Set the number of layers of level set points which should be "
146 "stored around the explicit surface.")
147 .def("clearMetaData", &Domain<T, D>::clearMetaData,
148 "Clear all metadata stored in the level set.")
149 // allow filehandle to be passed and default to python standard output
150 .def(
151 "print",
152 [](Domain<T, D> &d, py::object fileHandle) {
153 if (!(py::hasattr(fileHandle, "write") &&
154 py::hasattr(fileHandle, "flush"))) {
155 throw py::type_error(
156 "MyClass::read_from_file_like_object(file): incompatible "
157 "function argument: `file` must be a file-like object, but "
158 "`" +
159 (std::string)(py::repr(fileHandle)) + "` provided");
160 }
161 py::detail::pythonbuf buf(fileHandle);
162 std::ostream stream(&buf);
163 d.print(stream);
164 },
165 py::arg("stream") = py::module::import("sys").attr("stdout"));
166
167 // Advect
168 py::class_<Advect<T, D>, SmartPointer<Advect<T, D>>>(module, "Advect")
169 // constructors
170 .def(py::init(&SmartPointer<Advect<T, D>>::template New<>))
171 .def(py::init(&SmartPointer<Advect<T, D>>::template New<
172 SmartPointer<Domain<T, D>> &>))
173 .def(py::init(
174 &SmartPointer<Advect<T, D>>::template New<
175 SmartPointer<Domain<T, D>> &, SmartPointer<VelocityField<T>> &>))
176 // getters and setters
177 .def("insertNextLevelSet", &Advect<T, D>::insertNextLevelSet,
178 "Insert next level set to use for advection.")
179 .def("clearLevelSets", &Advect<T, D>::clearLevelSets,
180 "Clear all level sets used for advection.")
181 .def("setVelocityField", &Advect<T, D>::setVelocityField,
182 "Set the velocity to use for advection.")
183 .def("setAdvectionTime", &Advect<T, D>::setAdvectionTime,
184 "Set the time until when the level set should be advected.")
185 .def("setSingleStep", &Advect<T, D>::setSingleStep, py::arg("singleStep"),
186 "Set whether only a single advection step should be performed.")
187 .def("setTimeStepRatio", &Advect<T, D>::setTimeStepRatio,
188 "Set the maximum time step size relative to grid size. Advection is "
189 "only stable for <0.5.")
190 .def("setCalculateNormalVectors",
192 "Set whether normal vectors are needed for the supplied velocity "
193 "field.")
194 .def("setIgnoreVoids", &Advect<T, D>::setIgnoreVoids,
195 "Set whether voids in the geometry should be ignored during "
196 "advection or not.")
197 .def("setAdaptiveTimeStepping", &Advect<T, D>::setAdaptiveTimeStepping,
198 py::arg("enabled") = true, py::arg("subdivisions") = 20,
199 "Enable/disable adaptive time stepping and set the number of "
200 "subdivisions.")
201 .def(
202 "setSaveAdvectionVelocities",
204 "Set whether the velocities applied to each point should be saved in "
205 "the level set for debug purposes.")
206 .def("setCheckDissipation", &Advect<T, D>::setCheckDissipation,
207 py::arg("check"), "Enable/disable dissipation checking.")
208 .def("setUpdatePointData", &Advect<T, D>::setUpdatePointData,
209 py::arg("update"),
210 "Enable/disable updating point data after advection.")
211 .def("getAdvectedTime", &Advect<T, D>::getAdvectedTime,
212 "Get the time passed during advection.")
213 .def("getNumberOfTimeSteps", &Advect<T, D>::getNumberOfTimeSteps,
214 "Get how many advection steps were performed after the last apply() "
215 "call.")
216 .def("getTimeStepRatio", &Advect<T, D>::getTimeStepRatio,
217 "Get the time step ratio used for advection.")
218 .def("getCurrentTimeStep", &Advect<T, D>::getCurrentTimeStep,
219 "Get the current time step.")
220 .def("getCalculateNormalVectors",
222 "Get whether normal vectors are computed during advection.")
223 .def("setSpatialScheme", &Advect<T, D>::setSpatialScheme,
224 "Set the spatial discretization scheme to use during advection.")
225 .def("setTemporalScheme", &Advect<T, D>::setTemporalScheme,
226 "Set the time integration scheme to use during advection.")
227 .def("setIntegrationScheme", &Advect<T, D>::setIntegrationScheme,
228 "(DEPRECATED, use setSpatialScheme instead) Set the spatial "
229 "discretization scheme to use during advection.")
230 .def("setDissipationAlpha", &Advect<T, D>::setDissipationAlpha,
231 "Set the dissipation value to use for Lax Friedrichs spatial "
232 "discretization.")
233 .def("setUpdatePointData", &Advect<T, D>::setUpdatePointData,
234 "Set whether the point data in the old LS should be translated to "
235 "the advected LS. Defaults to true.")
236 .def(
237 "setVelocityUpdateCallback", &Advect<T, D>::setVelocityUpdateCallback,
238 "Set a callback function that is called after the level set has been "
239 "updated during intermediate time integration steps (e.g. RK2, RK3).")
240 .def("prepareLS", &Advect<T, D>::prepareLS, "Prepare the level-set.")
241 // need scoped release since we are calling a python method from
242 // parallelised C++ code here
243 .def("apply", &Advect<T, D>::apply,
244 py::call_guard<py::gil_scoped_release>(), "Perform advection.");
245
246 py::class_<lsInternal::StencilLocalLaxFriedrichsScalar<T, D, 1>>(
247 module, "StencilLocalLaxFriedrichsScalar")
248 .def_static(
249 "setMaxDissipation",
251 1>::setMaxDissipation,
252 py::arg("maxDissipation"));
253
254 module.def("PrepareStencilLocalLaxFriedrichs",
255 &PrepareStencilLocalLaxFriedrichs<T, D>, py::arg("levelSets"),
256 py::arg("isDepo"));
257
258 module.def("FinalizeStencilLocalLaxFriedrichs",
259 &FinalizeStencilLocalLaxFriedrichs<T, D>, py::arg("levelSets"));
260
261 // BooleanOperation
262 py::class_<BooleanOperation<T, D>, SmartPointer<BooleanOperation<T, D>>>(
263 module, "BooleanOperation")
264 // constructors
265 .def(py::init(&SmartPointer<BooleanOperation<T, D>>::template New<>))
266 .def(py::init(&SmartPointer<BooleanOperation<T, D>>::template New<
267 SmartPointer<Domain<T, D>> &>))
268 .def(
269 py::init(&SmartPointer<BooleanOperation<T, D>>::template New<
270 SmartPointer<Domain<T, D>> &, SmartPointer<Domain<T, D>> &>))
271 // some constructors need lambda to work: seems to be an issue with
272 // implicit move constructor
273 .def(py::init(
274 [](SmartPointer<Domain<T, D>> &domain, BooleanOperationEnum op) {
275 return SmartPointer<BooleanOperation<T, D>>::New(domain, op);
276 }))
277 .def(py::init([](SmartPointer<Domain<T, D>> &domainA,
278 SmartPointer<Domain<T, D>> &domainB,
280 return SmartPointer<BooleanOperation<T, D>>::New(domainA, domainB, op);
281 }))
282 // methods
283 .def("setLevelset", &BooleanOperation<T, D>::setLevelSet,
284 "Set levelset on which the boolean operation should be performed.")
285 .def("setSecondLevelSet", &BooleanOperation<T, D>::setSecondLevelSet,
286 "Set second levelset for boolean operation.")
287 .def("setBooleanOperation", &BooleanOperation<T, D>::setBooleanOperation,
288 "Set which type of boolean operation should be performed.")
289 .def("apply", &BooleanOperation<T, D>::apply,
290 "Perform the boolean operation.");
291
292 py::class_<CalculateCurvatures<T, D>,
293 SmartPointer<CalculateCurvatures<T, D>>>(module,
294 "CalculateCurvatures")
295 // constructors
296 .def(py::init(&SmartPointer<CalculateCurvatures<T, D>>::template New<>))
297 .def(py::init(&SmartPointer<CalculateCurvatures<T, D>>::template New<
298 SmartPointer<Domain<T, D>> &>))
299 // some constructors need lambda to work: seems to be an issue with
300 // implicit move constructor
301 .def(py::init([](SmartPointer<Domain<T, D>> &domain, CurvatureEnum type) {
302 return SmartPointer<CalculateCurvatures<T, D>>::New(domain, type);
303 }))
304 // methods
305 .def("setLevelSet", &CalculateCurvatures<T, D>::setLevelSet,
306 "Set levelset for which to calculate the curvatures.")
307 .def("setCurvatureType", &CalculateCurvatures<T, D>::setCurvatureType,
308 "Set which method to use for calculation: Defaults to mean "
309 "curvature.")
310 .def("setMaxValue", &CalculateCurvatures<T, D>::setMaxValue,
311 "Curvatures will be calculated for all LS values < maxValue.")
313 "Perform normal vector calculation.");
314
315 // CalculateNormalVectors
316 py::class_<CalculateNormalVectors<T, D>,
317 SmartPointer<CalculateNormalVectors<T, D>>>(
318 module, "CalculateNormalVectors")
319 // constructors
320 .def(
321 py::init(&SmartPointer<CalculateNormalVectors<T, D>>::template New<>))
322 .def(py::init(&SmartPointer<CalculateNormalVectors<T, D>>::template New<
323 SmartPointer<Domain<T, D>> &>))
324 // methods
326 "Set levelset for which to calculate normal vectors.")
328 "Perform normal vector calculation.");
329
330 // CalculateVisibilities
331 py::class_<CalculateVisibilities<T, D>,
332 SmartPointer<CalculateVisibilities<T, D>>>(module,
333 "CalculateVisibilities")
334 .def(py::init(
335 &SmartPointer<CalculateVisibilities<T, D>>::template New<
336 SmartPointer<Domain<T, D>> &, const Vec3D<T> &, std::string>))
338
339 // Check
340 py::class_<Check<T, D>, SmartPointer<Check<T, D>>>(module, "Check")
341 // constructors
342 .def(py::init(&SmartPointer<Check<T, D>>::template New<>))
343 .def(py::init(&SmartPointer<Check<T, D>>::template New<
344 SmartPointer<Domain<T, D>> &>))
345 // methods
346 .def("setLevelSet", &Check<T, D>::setLevelSet,
347 "Set levelset for which to calculate normal vectors.")
348 .def("apply", &Check<T, D>::apply, "Perform check.");
349
350 // PointCloud
351 py::class_<PointCloud<T, D>, SmartPointer<PointCloud<T, D>>>(module,
352 "PointCloud")
353 // constructors
354 .def(py::init(&SmartPointer<PointCloud<T, D>>::template New<
355 const std::vector<VectorType<T, D>> &>))
356 // methods
357 .def("insertNextPoint",
358 (void(PointCloud<T, D>::*)(const VectorType<T, D> &)) &
360
361 // ConvexHull
362 py::class_<ConvexHull<T, D>, SmartPointer<ConvexHull<T, D>>>(module,
363 "ConvexHull")
364 // constructors
365 .def(py::init(&SmartPointer<ConvexHull<T, D>>::template New<>))
366 .def(py::init(&SmartPointer<ConvexHull<T, D>>::template New<
367 SmartPointer<Mesh<T>> &, SmartPointer<PointCloud<T, D>> &>))
368 // methods
369 .def("setMesh", &ConvexHull<T, D>::setMesh,
370 "Set mesh object where the generated mesh should be stored.")
371 .def("setPointCloud", &ConvexHull<T, D>::setPointCloud,
372 "Set point cloud used to generate mesh.")
373 .def("apply", &ConvexHull<T, D>::apply, "Generate Hull.");
374
375 // DetectFeatures
376 py::class_<DetectFeatures<T, D>, SmartPointer<DetectFeatures<T, D>>>(
377 module, "DetectFeatures")
378 // constructors
379 .def(py::init(&SmartPointer<DetectFeatures<T, D>>::template New<>))
380 .def(py::init(&SmartPointer<DetectFeatures<T, D>>::template New<
381 SmartPointer<Domain<T, D>> &>))
382 .def(py::init(&SmartPointer<DetectFeatures<T, D>>::template New<
383 SmartPointer<Domain<T, D>> &, T>))
384 // some constructors need lambda to work: seems to be an issue with
385 // implicit move constructor
386 .def(py::init([](SmartPointer<Domain<T, D>> &domain, T maxValue,
388 return SmartPointer<DetectFeatures<T, D>>::New(domain, maxValue, type);
389 }))
390 .def("setDetectionThreshold",
392 "Set the curvature value above which a point is considered a "
393 "feature.")
394 .def("setDetectionMethod", &DetectFeatures<T, D>::setDetectionMethod,
395 "Set which method to use to detect features. Defaults to Curvature.")
396 .def("apply", &DetectFeatures<T, D>::apply, "Detect features.");
397
398 // GeometricAdvect
399 py::class_<GeometricAdvect<T, D>, SmartPointer<GeometricAdvect<T, D>>>(
400 module, "GeometricAdvect")
401 // constructors
402 .def(py::init(&SmartPointer<GeometricAdvect<T, D>>::template New<>))
403 .def(py::init(
404 &SmartPointer<GeometricAdvect<T, D>>::template New<
405 SmartPointer<Domain<T, D>> &,
406 SmartPointer<
408 // methods
409 .def("setLevelSet", &GeometricAdvect<T, D>::setLevelSet,
410 "Set levelset to advect.")
411 .def(
412 "setAdvectionDistribution",
414 "Set advection distribution to use as kernel for the fast advection.")
415 .def("apply", &GeometricAdvect<T, D>::apply,
416 py::call_guard<py::gil_scoped_release>(), "Perform advection.");
417
418 // GeometricAdvectDistributions
419 py::class_<GeometricAdvectDistribution<T, D>,
420 SmartPointer<GeometricAdvectDistribution<T, D>>,
422 "GeometricAdvectDistribution")
423 // constructors
424 .def(py::init<>())
425 // methods
427 "Check whether passed point is inside the distribution.")
428 .def("getSignedDistance",
430 "Get the signed distance of the passed point to the surface of the "
431 "distribution.")
433 "Get the cartesian bounds of the distribution.")
435 "Prepare the distribution for use with the passed level set.")
437 "Finalize the distribution after use with the level set.");
438
439 py::class_<SphereDistribution<T, D>, SmartPointer<SphereDistribution<T, D>>,
440 GeometricAdvectDistribution<T, D>>(module, "SphereDistribution")
441 // constructors
442 .def(py::init(&SmartPointer<SphereDistribution<T, D>>::template New<T>))
443 // methods
444 .def("isInside", &SphereDistribution<T, D>::isInside,
445 "Check whether passed point is inside the distribution.")
446 .def("getSignedDistance", &SphereDistribution<T, D>::getSignedDistance,
447 "Get the signed distance of the passed point to the surface of the "
448 "distribution.")
449 .def("getBounds", &SphereDistribution<T, D>::getBounds,
450 "Get the cartesian bounds of the distribution.");
451
452 py::class_<BoxDistribution<T, D>, SmartPointer<BoxDistribution<T, D>>,
453 GeometricAdvectDistribution<T, D>>(module, "BoxDistribution")
454 // constructors
455 .def(py::init(&SmartPointer<BoxDistribution<T, D>>::template New<
456 const std::array<T, 3>>))
457 // methods
458 .def("isInside", &BoxDistribution<T, D>::isInside,
459 "Check whether passed point is inside the distribution.")
460 .def("getSignedDistance", &BoxDistribution<T, D>::getSignedDistance,
461 "Get the signed distance of the passed point to the surface of the "
462 "distribution.")
463 .def("getBounds", &BoxDistribution<T, D>::getBounds,
464 "Get the cartesian bounds of the distribution.");
465
466 py::class_<CustomSphereDistribution<T, D>,
467 SmartPointer<CustomSphereDistribution<T, D>>,
469 "CustomSphereDistribution")
470 // constructors
471 .def(py::init(&SmartPointer<CustomSphereDistribution<T, D>>::template New<
472 const std::vector<T> &>))
473 // methods
475 "Check whether passed point is inside the distribution.")
476 .def("getSignedDistance",
478 "Get the signed distance of the passed point to the surface of the "
479 "distribution.")
481 "Get the cartesian bounds of the distribution.");
482
483 // Expand
484 py::class_<Expand<T, D>, SmartPointer<Expand<T, D>>>(module, "Expand")
485 // constructors
486 .def(py::init(&SmartPointer<Expand<T, D>>::template New<>))
487 .def(py::init(&SmartPointer<Expand<T, D>>::template New<
488 SmartPointer<Domain<T, D>> &>))
489 .def(py::init(&SmartPointer<Expand<T, D>>::template New<
490 SmartPointer<Domain<T, D>> &, int>))
491 // methods
492 .def("setLevelSet", &Expand<T, D>::setLevelSet, "Set levelset to expand.")
493 .def("setWidth", &Expand<T, D>::setWidth, "Set the width to expand to.")
494 .def("apply", &Expand<T, D>::apply, "Perform expansion.");
495
496 // FromSurfaceMesh
497 py::class_<FromSurfaceMesh<T, D>, SmartPointer<FromSurfaceMesh<T, D>>>(
498 module, "FromSurfaceMesh")
499 // constructors
500 .def(py::init(&SmartPointer<FromSurfaceMesh<T, D>>::template New<>))
501 .def(py::init(&SmartPointer<FromSurfaceMesh<T, D>>::template New<
502 SmartPointer<Domain<T, D>> &, SmartPointer<Mesh<T>> &>))
503 .def(py::init(
504 &SmartPointer<FromSurfaceMesh<T, D>>::template New<
505 SmartPointer<Domain<T, D>> &, SmartPointer<Mesh<T>> &, bool>))
506 // methods
507 .def("setLevelSet", &FromSurfaceMesh<T, D>::setLevelSet,
508 "Set levelset to read into.")
509 .def("setMesh", &FromSurfaceMesh<T, D>::setMesh,
510 "Set the mesh to read from.")
511 .def("setRemoveBoundaryTriangles",
512 static_cast<void (FromSurfaceMesh<T, D>::*)(bool)>(
514 "Set whether to include mesh elements outside of the simulation "
515 "domain.")
516 .def("setRemoveBoundaryTriangles",
517 static_cast<void (FromSurfaceMesh<T, D>::*)(std::array<bool, 3>)>(
519 "Set whether to include mesh elements outside of the simulation "
520 "domain.")
521 .def("apply", &FromSurfaceMesh<T, D>::apply,
522 "Construct a levelset from a surface mesh.");
523
524 // FromVolumeMesh
525 py::class_<FromVolumeMesh<T, D>, SmartPointer<FromVolumeMesh<T, D>>>(
526 module, "FromVolumeMesh")
527 // constructors
528 .def(py::init(&SmartPointer<FromVolumeMesh<T, D>>::template New<>))
529 .def(py::init(&SmartPointer<FromVolumeMesh<T, D>>::template New<
531 SmartPointer<Mesh<T>> &>))
532 .def(py::init(&SmartPointer<FromVolumeMesh<T, D>>::template New<
534 SmartPointer<Mesh<T>> &, bool>))
535 // methods
536 .def("setGrid", &FromVolumeMesh<T, D>::setGrid,
537 "Set the grid used to read in the level sets.")
538 .def("setMesh", &FromVolumeMesh<T, D>::setMesh,
539 "Set the mesh to read from.")
540 .def("setRemoveBoundaryTriangles",
542 "Set whether to include mesh elements outside of the simulation "
543 "domain.")
544 .def("apply", &FromVolumeMesh<T, D>::apply,
545 "Construct a levelset from a volume mesh.");
546
547 // FromMesh
548 py::class_<FromMesh<T, D>, SmartPointer<FromMesh<T, D>>>(module, "FromMesh")
549 .def(py::init(&SmartPointer<FromMesh<T, D>>::template New<>))
550 .def(py::init(&SmartPointer<FromMesh<T, D>>::template New<
551 SmartPointer<Domain<T, D>> &, SmartPointer<Mesh<T>> &>))
552 .def("setMesh", &FromMesh<T, D>::setMesh, "Set the mesh to read from.")
553 .def("setSortPointList", &FromMesh<T, D>::setSortPointList)
554 .def("apply", &FromMesh<T, D>::apply);
555
556 // lsGeometries
557 // Sphere
558 py::class_<Sphere<T, D>, SmartPointer<Sphere<T, D>>>(module, "Sphere")
559 // constructors
560 .def(py::init(&SmartPointer<Sphere<T, D>>::template New<
561 const std::vector<T> & /*origin*/, T /*radius*/>),
562 py::arg("origin"), py::arg("radius"));
563 // Plane
564 py::class_<Plane<T, D>, SmartPointer<Plane<T, D>>>(module, "Plane")
565 // constructors
566 .def(py::init(&SmartPointer<Plane<T, D>>::template New<
567 const std::vector<T> & /*origin*/,
568 const std::vector<T> & /*normal*/>),
569 py::arg("origin"), py::arg("normal"));
570 // Box
571 py::class_<Box<T, D>, SmartPointer<Box<T, D>>>(module, "Box")
572 // constructors
573 .def(py::init(&SmartPointer<Box<T, D>>::template New<
574 const std::vector<T> & /*minPoint*/,
575 const std::vector<T> & /*maxPoint*/>),
576 py::arg("minPoint"), py::arg("maxPoint"));
577 // Cylinder
578 py::class_<Cylinder<T, D>, SmartPointer<Cylinder<T, D>>>(module, "Cylinder")
579 // constructors
580 .def(
581 py::init(&SmartPointer<Cylinder<T, D>>::template New<
582 const std::vector<T> & /*origin*/,
583 const std::vector<T> & /*axisDirection*/, const T /*height*/,
584 const T /*radius*/, const T /*topRadius*/>),
585 py::arg("origin"), py::arg("axisDirection"), py::arg("height"),
586 py::arg("radius"), py::arg("topRadius") = 0.);
587
588 // MakeGeometry
589 py::class_<MakeGeometry<T, D>, SmartPointer<MakeGeometry<T, D>>>(
590 module, "MakeGeometry")
591 // constructors
592 .def(py::init(&SmartPointer<MakeGeometry<T, D>>::template New<>))
593 .def(py::init(&SmartPointer<MakeGeometry<T, D>>::template New<
594 SmartPointer<Domain<T, D>> &>))
595 .def(
596 py::init(&SmartPointer<MakeGeometry<T, D>>::template New<
597 SmartPointer<Domain<T, D>> &, SmartPointer<Sphere<T, D>> &>))
598 .def(py::init(&SmartPointer<MakeGeometry<T, D>>::template New<
599 SmartPointer<Domain<T, D>> &, SmartPointer<Plane<T, D>> &>))
600 .def(py::init(&SmartPointer<MakeGeometry<T, D>>::template New<
601 SmartPointer<Domain<T, D>> &, SmartPointer<Box<T, D>> &>))
602 .def(py::init(
603 &SmartPointer<MakeGeometry<T, D>>::template New<
604 SmartPointer<Domain<T, D>> &, SmartPointer<Cylinder<T, D>> &>))
605 .def(py::init(
606 &SmartPointer<MakeGeometry<T, D>>::template New<
607 SmartPointer<Domain<T, D>> &, SmartPointer<PointCloud<T, D>> &>))
608 // methods
609 .def("setLevelSet", &MakeGeometry<T, D>::setLevelSet,
610 "Set the levelset in which to create the geometry.")
611 .def("setGeometry",
612 (void(MakeGeometry<T, D>::*)(SmartPointer<Sphere<T, D>>)) &
614 .def("setGeometry",
615 (void(MakeGeometry<T, D>::*)(SmartPointer<Plane<T, D>>)) &
617 .def("setGeometry",
618 (void(MakeGeometry<T, D>::*)(SmartPointer<Box<T, D>>)) &
620 .def("setGeometry",
621 (void(MakeGeometry<T, D>::*)(SmartPointer<Cylinder<T, D>>)) &
623 .def("setGeometry",
624 (void(MakeGeometry<T, D>::*)(SmartPointer<PointCloud<T, D>>)) &
626 .def("setIgnoreBoundaryConditions",
627 (void(MakeGeometry<T, D>::*)(bool)) &
629 .def("setIgnoreBoundaryConditions",
630 (void(MakeGeometry<T, D>::*)(std::array<bool, 3>)) &
632 .def("apply", &MakeGeometry<T, D>::apply, "Generate the geometry.");
633
634 // MarkVoidPoints
635 py::class_<MarkVoidPoints<T, D>, SmartPointer<MarkVoidPoints<T, D>>>(
636 module, "MarkVoidPoints")
637 // constructors
638 .def(py::init(&SmartPointer<MarkVoidPoints<T, D>>::template New<>))
639 .def(py::init(&SmartPointer<MarkVoidPoints<T, D>>::template New<
640 SmartPointer<Domain<T, D>> &>))
641 .def(py::init(&SmartPointer<MarkVoidPoints<T, D>>::template New<
642 SmartPointer<Domain<T, D>> &, bool &>))
643 // methods
644 .def("setLevelSet", &MarkVoidPoints<T, D>::setLevelSet,
645 "Set the levelset to mark void points in.")
646 .def("setReverseVoidDetection",
648 "Reverse the logic of detecting the top surface.")
649 .def("setDetectLargestSurface",
651 "Set that the top surface should be the one with the most connected "
652 "LS points.")
653 .def("setVoidTopSurface", &MarkVoidPoints<T, D>::setVoidTopSurface,
654 "Set the logic by which to choose the surface which is non-void. "
655 "All other connected surfaces will then be marked as void points.")
656 .def("setSaveComponentIds", &MarkVoidPoints<T, D>::setSaveComponentIds,
657 "Save the connectivity information of all LS points in the "
658 "pointData of the level set.")
659 .def("getNumberOfComponents",
661 "Get the number of connected components found in the level set.")
662 .def("apply", &MarkVoidPoints<T, D>::apply, "Mark void points.");
663
664 // Prune
665 py::class_<Prune<T, D>, SmartPointer<Prune<T, D>>>(module, "Prune")
666 // constructors
667 .def(py::init(&SmartPointer<Prune<T, D>>::template New<>))
668 .def(py::init(&SmartPointer<Prune<T, D>>::template New<
669 SmartPointer<Domain<T, D>> &>))
670 // methods
671 .def("setLevelSet", &Prune<T, D>::setLevelSet, "Set levelset to prune.")
672 .def("apply", &Prune<T, D>::apply, "Perform pruning operation.");
673
674 // Reader
675 py::class_<Reader<T, D>, SmartPointer<Reader<T, D>>>(module, "Reader")
676 // constructors
677 .def(py::init(&SmartPointer<Reader<T, D>>::template New<>))
678 .def(py::init(&SmartPointer<Reader<T, D>>::template New<
679 SmartPointer<Domain<T, D>> &>))
680 .def(py::init(&SmartPointer<Reader<T, D>>::template New<
681 SmartPointer<Domain<T, D>> &, std::string>))
682 // methods
683 .def("setLevelSet", &Reader<T, D>::setLevelSet,
684 "Set levelset to write to file.")
685 .def("setFileName", &Reader<T, D>::setFileName,
686 "Set the filename for the output file.")
687 .def("apply", &Reader<T, D>::apply, "Write to file.");
688
689 // Reduce
690 py::class_<Reduce<T, D>, SmartPointer<Reduce<T, D>>>(module, "Reduce")
691 // constructors
692 .def(py::init(&SmartPointer<Reduce<T, D>>::template New<>))
693 .def(py::init(&SmartPointer<Reduce<T, D>>::template New<
694 SmartPointer<Domain<T, D>> &>))
695 .def(py::init(&SmartPointer<Reduce<T, D>>::template New<
696 SmartPointer<Domain<T, D>> &, int>))
697 .def(py::init(&SmartPointer<Reduce<T, D>>::template New<
698 SmartPointer<Domain<T, D>> &, int, bool>))
699 // methods
700 .def("setLevelSet", &Reduce<T, D>::setLevelSet, "Set levelset to reduce.")
701 .def("setWidth", &Reduce<T, D>::setWidth, "Set the width to reduce to.")
702 .def("setNoNewSegment", &Reduce<T, D>::setNoNewSegment,
703 "Set whether the levelset should be segmented anew (balanced across "
704 "cores) after reduction.")
705 .def("apply", &Reduce<T, D>::apply, "Perform reduction.");
706
707 // RemoveStrayPoints
708 py::class_<RemoveStrayPoints<T, D>, SmartPointer<RemoveStrayPoints<T, D>>>(
709 module, "RemoveStrayPoints")
710 // constructors
711 .def(py::init(&SmartPointer<RemoveStrayPoints<T, D>>::template New<>))
712 .def(py::init(&SmartPointer<RemoveStrayPoints<T, D>>::template New<
713 SmartPointer<Domain<T, D>> &>))
714 // methods
715 .def("setLevelSet", &RemoveStrayPoints<T, D>::setLevelSet,
716 "Set levelset for stray point removal.")
717 .def("setVoidTopSurface", &RemoveStrayPoints<T, D>::setVoidTopSurface,
718 "Set the logic by which to choose the surface which should be kept. "
719 "All other LS values will be marked as stray points and removed.")
720 .def("apply", &RemoveStrayPoints<T, D>::apply, "Remove stray points.");
721
722 // ToDiskMesh
723 py::class_<ToDiskMesh<T, D>, SmartPointer<ToDiskMesh<T, D>>>(module,
724 "ToDiskMesh")
725 // constructors
726 .def(py::init(&SmartPointer<ToDiskMesh<T, D>>::template New<>))
727 .def(py::init(&SmartPointer<ToDiskMesh<T, D>>::template New<
728 SmartPointer<Domain<T, D>> &, SmartPointer<Mesh<T>> &>))
729 // methods
730 .def("setLevelSet", &ToDiskMesh<T, D>::setLevelSet,
731 "Set levelset to mesh.")
732 .def("clearLevelSets", &ToDiskMesh<T, D>::clearLevelSets,
733 "Clear all inserted level sets.")
734 .def("insertNextLevelSet", &ToDiskMesh<T, D>::insertNextLevelSet,
735 "Insert next level set to output in the disk mesh.")
736 .def("setMesh", &ToDiskMesh<T, D>::setMesh, "Set the mesh to generate.")
737 .def("setMaterialMap", &ToDiskMesh<T, D>::setMaterialMap,
738 "Set the material map to use for the disk mesh.")
739 .def("setMaxValue", &ToDiskMesh<T, D>::setMaxValue,
740 "Set the maximum level set value to include in the disk mesh.")
741 .def("apply", &ToDiskMesh<T, D>::apply,
742 "Convert the levelset to a surface mesh.");
743
744 // ToMesh
745 py::class_<ToMesh<T, D>, SmartPointer<ToMesh<T, D>>>(module, "ToMesh")
746 // constructors
747 .def(py::init(&SmartPointer<ToMesh<T, D>>::template New<>))
748 .def(py::init(&SmartPointer<ToMesh<T, D>>::template New<
749 SmartPointer<Domain<T, D>> &, SmartPointer<Mesh<T>> &>))
750 .def(py::init(
751 &SmartPointer<ToMesh<T, D>>::template New<
752 SmartPointer<Domain<T, D>> &, SmartPointer<Mesh<T>> &, bool>))
753 .def(py::init(&SmartPointer<ToMesh<T, D>>::template New<
754 SmartPointer<Domain<T, D>> &, SmartPointer<Mesh<T>> &, bool,
755 bool>))
756 // methods
757 .def("setLevelSet", &ToMesh<T, D>::setLevelSet, "Set levelset to mesh.")
758 .def("setMesh", &ToMesh<T, D>::setMesh, "Set the mesh to generate.")
759 .def("setOnlyDefined", &ToMesh<T, D>::setOnlyDefined,
760 "Set whether only defined points should be output to the mesh.")
761 .def("setOnlyActive", &ToMesh<T, D>::setOnlyActive,
762 "Set whether only level set points <0.5 should be output.")
763 .def("apply", &ToMesh<T, D>::apply,
764 "Convert the levelset to a surface mesh.");
765
766 // ToSurfaceMesh
767 py::class_<ToSurfaceMesh<T, D>, SmartPointer<ToSurfaceMesh<T, D>>>(
768 module, "ToSurfaceMesh")
769 // constructors
770 .def(py::init(&SmartPointer<ToSurfaceMesh<T, D>>::template New<>))
771 .def(py::init(&SmartPointer<ToSurfaceMesh<T, D>>::template New<
772 SmartPointer<Domain<T, D>> &, SmartPointer<Mesh<T>> &>))
773 // methods
774 .def("setLevelSet", &ToSurfaceMesh<T, D>::setLevelSet,
775 "Set levelset to mesh.")
776 .def("setMesh", &ToSurfaceMesh<T, D>::setMesh,
777 "Set the mesh to generate.")
778 .def("apply", &ToSurfaceMesh<T, D>::apply,
779 "Convert the levelset to a surface mesh.");
780
781 // ToMultiSurfaceMesh
782 py::class_<ToMultiSurfaceMesh<T, D>, SmartPointer<ToMultiSurfaceMesh<T, D>>>(
783 module, "ToMultiSurfaceMesh")
784 // constructors
785 .def(py::init(
786 &SmartPointer<ToMultiSurfaceMesh<T, D>>::template New<double,
787 double>),
788 py::arg("eps") = 1e-12, py::arg("minNodeDistFactor") = 0.05)
789 .def(py::init(&SmartPointer<ToMultiSurfaceMesh<T, D>>::template New<
790 SmartPointer<Domain<T, D>> &, SmartPointer<Mesh<T>> &,
791 double, double>),
792 py::arg("domain"), py::arg("mesh"), py::arg("eps") = 1e-12,
793 py::arg("minNodeDistFactor") = 0.05)
794 .def(py::init(&SmartPointer<ToMultiSurfaceMesh<T, D>>::template New<
795 std::vector<SmartPointer<Domain<T, D>>> &,
796 SmartPointer<Mesh<T>> &, double, double>),
797 py::arg("domains"), py::arg("mesh"), py::arg("eps") = 1e-12,
798 py::arg("minNodeDistFactor") = 0.05)
799 .def(py::init(&SmartPointer<ToMultiSurfaceMesh<T, D>>::template New<
800 SmartPointer<Mesh<T>> &, double, double>),
801 py::arg("mesh"), py::arg("eps") = 1e-12,
802 py::arg("minNodeDistFactor") = 0.05)
803 // methods
804 .def("insertNextLevelSet", &ToMultiSurfaceMesh<T, D>::insertNextLevelSet,
805 "Insert next level set to output in the mesh.")
806 .def("clearLevelSets", &ToMultiSurfaceMesh<T, D>::clearLevelSets,
807 "Clear all inserted level sets.")
808 .def("setMesh", &ToMultiSurfaceMesh<T, D>::setMesh,
809 "Set the mesh to generate.")
810 .def("setMaterialMap", &ToMultiSurfaceMesh<T, D>::setMaterialMap,
811 "Set the material map to use for the multi surface mesh.")
812 .def("apply", &ToMultiSurfaceMesh<T, D>::apply,
813 "Convert the levelset to a surface mesh.");
814
815 // ToVoxelMesh
816 py::class_<ToVoxelMesh<T, D>, SmartPointer<ToVoxelMesh<T, D>>>(module,
817 "ToVoxelMesh")
818 // constructors
819 .def(py::init(&SmartPointer<ToVoxelMesh<T, D>>::template New<>))
820 .def(py::init(&SmartPointer<ToVoxelMesh<T, D>>::template New<
821 SmartPointer<Mesh<T>> &>))
822 .def(py::init(&SmartPointer<ToVoxelMesh<T, D>>::template New<
823 SmartPointer<Domain<T, D>> &, SmartPointer<Mesh<T>> &>))
824 .def(py::init(&SmartPointer<ToVoxelMesh<T, D>>::template New<
825 std::vector<SmartPointer<Domain<T, D>>> &,
826 SmartPointer<Mesh<T>> &>))
827 // methods
828 .def("insertNextLevelSet", &ToVoxelMesh<T, D>::insertNextLevelSet,
829 "Insert next level set to output in the mesh.")
830 .def("clearLevelSets", &ToVoxelMesh<T, D>::clearLevelSets,
831 "Clear all inserted level sets.")
832 .def("setMesh", &ToVoxelMesh<T, D>::setMesh, "Set the mesh to generate.")
833 .def("apply", &ToVoxelMesh<T, D>::apply,
834 "Convert the levelset to a surface mesh.");
835
836 // Writer
837 py::class_<Writer<T, D>, SmartPointer<Writer<T, D>>>(module, "Writer")
838 // constructors
839 .def(py::init(&SmartPointer<Writer<T, D>>::template New<>))
840 .def(py::init(&SmartPointer<Writer<T, D>>::template New<
841 SmartPointer<Domain<T, D>> &>))
842 .def(py::init(&SmartPointer<Writer<T, D>>::template New<
843 SmartPointer<Domain<T, D>> &, std::string>))
844 // methods
845 .def("setLevelSet", &Writer<T, D>::setLevelSet,
846 "Set levelset to write to file.")
847 .def("setFileName", &Writer<T, D>::setFileName,
848 "Set the filename for the output file.")
849 .def("apply", &Writer<T, D>::apply, "Write to file.");
850
851 // CompareSparseField
852 py::class_<CompareSparseField<T, D>, SmartPointer<CompareSparseField<T, D>>>(
853 module, "CompareSparseField")
854 // constructors
855 .def(py::init(&SmartPointer<CompareSparseField<T, D>>::template New<>))
856 .def(
857 py::init(&SmartPointer<CompareSparseField<T, D>>::template New<
858 SmartPointer<Domain<T, D>> &, SmartPointer<Domain<T, D>> &>))
859 // methods
860 .def("setLevelSetExpanded",
862 "Sets the expanded level set for comparison.")
863 .def("setLevelSetIterated",
865 "Sets the iterated level set to compare against the expanded one.")
866 .def("setXRange", &CompareSparseField<T, D>::setXRange,
867 "Set the x-coordinate range to restrict the comparison area")
868 .def("setYRange", &CompareSparseField<T, D>::setYRange,
869 "Set the y-coordinate range to restrict the comparison area")
870 .def("clearXRange", &CompareSparseField<T, D>::clearXRange,
871 "Clear the x-range restriction")
872 .def("clearYRange", &CompareSparseField<T, D>::clearYRange,
873 "Clear the y-range restriction")
874 .def("setZRange", &CompareSparseField<T, D>::setZRange,
875 "Set the z-coordinate range to restrict the comparison area")
876 .def("clearZRange", &CompareSparseField<T, D>::clearZRange,
877 "Clear the z-range restriction")
878 .def("setOutputMesh", &CompareSparseField<T, D>::setOutputMesh,
879 "Set the output mesh where difference values will be stored")
880 .def("setFillIteratedWithDistances",
882 "Set whether to fill the iterated level set with distance values")
883 .def("setExpandedLevelSetWidth",
885 "Set the expansion width for the expanded level set")
886 .def("apply", &CompareSparseField<T, D>::apply,
887 "Apply the comparison and calculate the sum of squared "
888 "differences.")
889 .def("getSumSquaredDifferences",
891 "Return the sum of squared differences calculated by apply().")
892 .def("getSumDifferences", &CompareSparseField<T, D>::getSumDifferences,
893 "Return the sum of absolute differences calculated by apply().")
894 .def("getNumPoints", &CompareSparseField<T, D>::getNumPoints,
895 "Return the number of points used in the comparison.")
896 .def("getNumSkippedPoints",
898 "Return the number of points skipped during comparison.")
899 .def("getRMSE", &CompareSparseField<T, D>::getRMSE,
900 "Calculate the root mean square error from previously computed "
901 "values.");
902
903// WriteVisualizationMesh
904#ifdef VIENNALS_USE_VTK
905 py::class_<WriteVisualizationMesh<T, D>,
906 SmartPointer<WriteVisualizationMesh<T, D>>>(
907 module, "WriteVisualizationMesh")
908 // constructors
909 .def(
910 py::init(&SmartPointer<WriteVisualizationMesh<T, D>>::template New<>))
911 .def(py::init(&SmartPointer<WriteVisualizationMesh<T, D>>::template New<
912 SmartPointer<Domain<T, D>> &>))
913 // methods
914 .def("insertNextLevelSet",
915 &WriteVisualizationMesh<T, D>::insertNextLevelSet,
916 "Insert next level set to convert. Bigger level sets wrapping "
917 "smaller ones, should be inserted last.")
918 .def("setFileName", &WriteVisualizationMesh<T, D>::setFileName,
919 "Set Name of File to write.")
920 .def("setExtractHullMesh",
921 &WriteVisualizationMesh<T, D>::setExtractHullMesh,
922 "Whether to extract a hull mesh. Defaults to false.")
923 .def("setExtractVolumeMesh",
924 &WriteVisualizationMesh<T, D>::setExtractVolumeMesh,
925 " Whether to extract a tetra volume mesh. Defaults to true.")
926 .def("setMetaData", &WriteVisualizationMesh<T, D>::setMetaData,
927 "Set the metadata to be written to the file.")
928 .def("addMetaData",
929 py::overload_cast<const std::string &, T>(
930 &WriteVisualizationMesh<T, D>::addMetaData),
931 "Add a single metadata entry to the file.")
932 .def("addMetaData",
933 py::overload_cast<const std::string &, const std::vector<T> &>(
934 &WriteVisualizationMesh<T, D>::addMetaData),
935 "Add a single metadata entry to the file.")
936 .def("addMetaData",
937 py::overload_cast<
938 const std::unordered_map<std::string, std::vector<T>> &>(
939 &WriteVisualizationMesh<T, D>::addMetaData),
940 "Add metadata to the file.")
941 .def("apply", &WriteVisualizationMesh<T, D>::apply,
942 "Make and write mesh.");
943#endif
944
945 // CompareVolume
946 py::class_<CompareVolume<T, D>, SmartPointer<CompareVolume<T, D>>>(
947 module, "CompareVolume")
948 // constructors
949 .def(py::init(&SmartPointer<CompareVolume<T, D>>::template New<>))
950 .def(
951 py::init(&SmartPointer<CompareVolume<T, D>>::template New<
952 SmartPointer<Domain<T, D>> &, SmartPointer<Domain<T, D>> &>))
953 // methods
954 .def("setLevelSetTarget", &CompareVolume<T, D>::setLevelSetTarget,
955 "Sets the target level set.")
956 .def("setLevelSetSample", &CompareVolume<T, D>::setLevelSetSample,
957 "Sets the sample level set.")
958 .def("setDefaultIncrement", &CompareVolume<T, D>::setDefaultIncrement,
959 "Set default increment value")
960 .def("setXRangeAndIncrement", &CompareVolume<T, D>::setXRangeAndIncrement,
961 "Sets the x-range and custom increment value")
962 .def("setYRangeAndIncrement", &CompareVolume<T, D>::setYRangeAndIncrement,
963 "Sets the y-range and custom increment value")
964 .def("setZRangeAndIncrement", &CompareVolume<T, D>::setZRangeAndIncrement,
965 "Sets the z-range and custom increment value")
966 .def("setOutputMesh", &CompareVolume<T, D>::setOutputMesh,
967 "Set the output mesh where difference areas will be stored")
968 .def("getVolumeMismatch", &CompareVolume<T, D>::getVolumeMismatch,
969 "Returns the computed volume mismatch.")
970 .def("getAreaMismatch", &CompareVolume<T, D>::getAreaMismatch,
971 "Returns the computed area mismatch.")
972 .def("getCustomVolumeMismatch",
974 "Returns the computed volume mismatch, with custom increments "
975 "applied.")
976 .def("getCustomAreaMismatch", &CompareVolume<T, D>::getCustomAreaMismatch,
977 "Returns the computed area mismatch, with custom increments "
978 "applied.")
979 .def("getCellCount", &CompareVolume<T, D>::getCellCount,
980 "Returns the number of cells where the level sets differ.")
981 .def("getCustomCellCount", &CompareVolume<T, D>::getCustomCellCount,
982 "Returns the number of cells where the level sets differ, with "
983 "custom increments applied.")
984 .def("apply", &CompareVolume<T, D>::apply,
985 "Computes the volume difference between the two level sets.");
986
987 if constexpr (D == 2) {
988 module.attr("CompareArea") = module.attr("CompareVolume");
989 }
990
991 // CompareChamfer
992 py::class_<CompareChamfer<T, D>, SmartPointer<CompareChamfer<T, D>>>(
993 module, "CompareChamfer")
994 // constructors
995 .def(py::init(&SmartPointer<CompareChamfer<T, D>>::template New<>))
996 .def(
997 py::init(&SmartPointer<CompareChamfer<T, D>>::template New<
998 SmartPointer<Domain<T, D>> &, SmartPointer<Domain<T, D>> &>))
999 // methods
1000 .def("setLevelSetTarget", &CompareChamfer<T, D>::setLevelSetTarget,
1001 "Set the target level set.")
1002 .def("setLevelSetSample", &CompareChamfer<T, D>::setLevelSetSample,
1003 "Set the sample level set.")
1004 .def("setOutputMeshTarget", &CompareChamfer<T, D>::setOutputMeshTarget,
1005 "Set output mesh for target surface points with distance data.")
1006 .def("setOutputMeshSample", &CompareChamfer<T, D>::setOutputMeshSample,
1007 "Set output mesh for sample surface points with distance data.")
1008 .def("apply", &CompareChamfer<T, D>::apply,
1009 "Apply the Chamfer distance calculation.")
1010 .def("getForwardDistance", &CompareChamfer<T, D>::getForwardDistance,
1011 "Get the forward distance (average distance from target to "
1012 "sample).")
1013 .def("getBackwardDistance", &CompareChamfer<T, D>::getBackwardDistance,
1014 "Get the backward distance (average distance from sample to "
1015 "target).")
1016 .def("getChamferDistance", &CompareChamfer<T, D>::getChamferDistance,
1017 "Get the Chamfer distance (average of forward and backward).")
1018 .def("getRMSChamferDistance",
1020 "Get the RMS Chamfer distance.")
1021 .def("getMaxDistance", &CompareChamfer<T, D>::getMaxDistance,
1022 "Get the maximum nearest-neighbor distance.")
1023 .def("getNumTargetPoints", &CompareChamfer<T, D>::getNumTargetPoints,
1024 "Get the number of target surface points.")
1025 .def("getNumSamplePoints", &CompareChamfer<T, D>::getNumSamplePoints,
1026 "Get the number of sample surface points.");
1027
1028 // CompareCriticalDimensions
1029 py::class_<CompareCriticalDimensions<T, D>,
1030 SmartPointer<CompareCriticalDimensions<T, D>>>(
1031 module, "CompareCriticalDimensions")
1032 // constructors
1033 .def(py::init(
1034 &SmartPointer<CompareCriticalDimensions<T, D>>::template New<>))
1035 .def(
1036 py::init(&SmartPointer<CompareCriticalDimensions<T, D>>::template New<
1037 SmartPointer<Domain<T, D>> &, SmartPointer<Domain<T, D>> &>))
1038 // methods
1039 .def("setLevelSetTarget",
1041 "Sets the target level set.")
1042 .def("setLevelSetSample",
1044 "Sets the sample level set.")
1046 py::arg("measureDimension"), py::arg("minBounds"),
1047 py::arg("maxBounds"), py::arg("findMaximum") = true,
1048 "Add a generic range specification.")
1050 py::arg("minX"), py::arg("maxX"), py::arg("findMaximum") = true,
1051 "Add an X range to find maximum or minimum Y position.")
1053 py::arg("minY"), py::arg("maxY"), py::arg("findMaximum") = true,
1054 "Add a Y range to find maximum or minimum X position.")
1056 "Clear all range specifications.")
1058 "Set the output mesh where critical dimension locations will be "
1059 "stored.")
1061 "Apply the comparison.")
1062 .def("getNumCriticalDimensions",
1064 "Get the number of critical dimensions compared.")
1065 .def(
1066 "getCriticalDimensionResult",
1067 [](CompareCriticalDimensions<T, D> &self, size_t index) {
1068 T posRef, posCmp, diff;
1069 bool valid =
1070 self.getCriticalDimensionResult(index, posRef, posCmp, diff);
1071 if (valid) {
1072 return py::make_tuple(true, posRef, posCmp, diff);
1073 } else {
1074 return py::make_tuple(false, 0.0, 0.0, 0.0);
1075 }
1076 },
1077 py::arg("index"),
1078 "Get a specific critical dimension result. Returns (valid, "
1079 "positionTarget, positionSample, difference).")
1080 .def("getMeanDifference",
1082 "Get mean absolute difference across all valid critical "
1083 "dimensions.")
1084 .def("getMaxDifference",
1086 "Get maximum difference across all valid critical dimensions.")
1088 "Get RMSE across all valid critical dimensions.")
1089 .def("getAllDifferences",
1091 "Get all valid differences as a list.");
1092
1093 // CompareNarrowBand
1094 py::class_<CompareNarrowBand<T, D>, SmartPointer<CompareNarrowBand<T, D>>>(
1095 module, "CompareNarrowBand")
1096 // constructors
1097 .def(py::init(&SmartPointer<CompareNarrowBand<T, D>>::template New<>))
1098 .def(
1099 py::init(&SmartPointer<CompareNarrowBand<T, D>>::template New<
1100 SmartPointer<Domain<T, D>> &, SmartPointer<Domain<T, D>> &>))
1101 // methods
1102 .def("setLevelSetTarget", &CompareNarrowBand<T, D>::setLevelSetTarget,
1103 "Sets the target level set.")
1104 .def("setLevelSetSample", &CompareNarrowBand<T, D>::setLevelSetSample,
1105 "Sets the sample level set.")
1106 .def("setXRange", &CompareNarrowBand<T, D>::setXRange,
1107 "Set the x-coordinate range to restrict the comparison area")
1108 .def("setYRange", &CompareNarrowBand<T, D>::setYRange,
1109 "Set the y-coordinate range to restrict the comparison area")
1110 .def("clearXRange", &CompareNarrowBand<T, D>::clearXRange,
1111 "Clear the x-range restriction")
1112 .def("clearYRange", &CompareNarrowBand<T, D>::clearYRange,
1113 "Clear the y-range restriction")
1114 .def("setZRange", &CompareNarrowBand<T, D>::setZRange,
1115 "Set the z-coordinate range to restrict the comparison area")
1116 .def("clearZRange", &CompareNarrowBand<T, D>::clearZRange,
1117 "Clear the z-range restriction")
1118 .def("setOutputMesh", &CompareNarrowBand<T, D>::setOutputMesh,
1119 "Set the output mesh where difference values will be stored")
1120 .def("setOutputMeshSquaredDifferences",
1122 "Set whether to output squared differences (true) or absolute "
1123 "differences (false)")
1124 .def("apply", &CompareNarrowBand<T, D>::apply,
1125 "Apply the comparison and calculate the sum of squared "
1126 "differences.")
1127 .def("getSumSquaredDifferences",
1129 "Return the sum of squared differences calculated by apply().")
1130 .def("getSumDifferences", &CompareNarrowBand<T, D>::getSumDifferences,
1131 "Return the sum of absolute differences calculated by apply().")
1132 .def("getNumPoints", &CompareNarrowBand<T, D>::getNumPoints,
1133 "Return the number of points used in the comparison.")
1134 .def("getRMSE", &CompareNarrowBand<T, D>::getRMSE,
1135 "Calculate the root mean square error from previously computed "
1136 "values.");
1137}
constexpr int D
Definition Epitaxy.cpp:11
double T
Definition Epitaxy.cpp:12
Definition pyWrap.hpp:68
T getSignedDistance(const vectorType &initial, const vectorType &candidate, unsigned long initialPointId) const override
Definition pyWrap.hpp:80
bool isInside(const vectorType &initial, const vectorType &candidate, double eps=0.) const override
Definition pyWrap.hpp:75
boundsType getBounds() const override
Sets bounds to the bounding box of the distribution.
Definition pyWrap.hpp:86
Stencil Local Lax Friedrichs Discretization 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:54
void setVelocityField(SmartPointer< VelocityField< T > > passedVelocities)
Set the velocity field used for advection. This should be a concrete implementation of lsVelocityFiel...
Definition lsAdvect.hpp:862
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:854
void setVelocityUpdateCallback(std::function< bool(SmartPointer< Domain< T, D > >)> callback)
Set a callback function that is called after the level set has been updated during intermediate time ...
Definition lsAdvect.hpp:964
void setUpdatePointData(bool update)
Set whether the point data in the old LS should be translated to the advected LS. Defaults to true.
Definition lsAdvect.hpp:960
void setSpatialScheme(SpatialSchemeEnum scheme)
Set which spatial discretization scheme should be used out of the ones specified in SpatialSchemeEnum...
Definition lsAdvect.hpp:934
bool getCalculateNormalVectors() const
Get whether normal vectors were calculated.
Definition lsAdvect.hpp:930
void setIgnoreVoids(bool iV)
Set whether level set values, which are not part of the "top" geometrically connected part of values,...
Definition lsAdvect.hpp:897
void clearLevelSets()
Definition lsAdvect.hpp:858
void setCalculateNormalVectors(bool cnv)
Set whether normal vectors should be calculated at each level set point. Defaults to true....
Definition lsAdvect.hpp:889
void apply()
Definition lsAdvect.hpp:1015
void setSingleStep(bool singleStep)
If set to true, only a single advection step will be performed, even if the advection time set with s...
Definition lsAdvect.hpp:877
void prepareLS()
Definition lsAdvect.hpp:971
double getAdvectedTime() const
Get by how much the physical time was advanced during the last apply() call.
Definition lsAdvect.hpp:918
void setTemporalScheme(TemporalSchemeEnum scheme)
Set which time integration scheme should be used.
Definition lsAdvect.hpp:947
void setDissipationAlpha(const double &a)
Set the alpha dissipation coefficient. For lsLaxFriedrichs, this is used as the alpha value....
Definition lsAdvect.hpp:953
void setCheckDissipation(bool check)
Definition lsAdvect.hpp:956
void setIntegrationScheme(IntegrationSchemeEnum scheme)
Definition lsAdvect.hpp:939
double getCurrentTimeStep() const
Return the last applied time step.
Definition lsAdvect.hpp:921
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:871
unsigned getNumberOfTimeSteps() const
Get how many advection steps were performed during the last apply() call.
Definition lsAdvect.hpp:924
void setAdaptiveTimeStepping(bool aTS=true, unsigned subdivisions=20)
Set whether adaptive time stepping should be used when approaching material boundaries during etching...
Definition lsAdvect.hpp:902
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:883
double getTimeStepRatio() const
Get the value of the CFL number.
Definition lsAdvect.hpp:927
void setSaveAdvectionVelocities(bool sAV)
Set whether the velocities applied to each point should be saved in the level set for debug purposes.
Definition lsAdvect.hpp:914
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:81
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
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:329
void apply()
Apply the Chamfer distance calculation.
Definition lsCompareChamfer.hpp:104
T getMaxDistance() const
Get the maximum nearest-neighbor distance.
Definition lsCompareChamfer.hpp:323
T getBackwardDistance() const
Get the backward distance (average distance from sample to target).
Definition lsCompareChamfer.hpp:314
void setOutputMeshSample(SmartPointer< Mesh< T > > passedMesh)
Set output mesh for sample surface points with distance data.
Definition lsCompareChamfer.hpp:99
T getRMSChamferDistance() const
Get the RMS Chamfer distance.
Definition lsCompareChamfer.hpp:320
T getChamferDistance() const
Get the Chamfer distance (average of forward and backward).
Definition lsCompareChamfer.hpp:317
T getForwardDistance() const
Get the forward distance (average distance from target to sample).
Definition lsCompareChamfer.hpp:311
void setOutputMeshTarget(SmartPointer< Mesh< T > > passedMesh)
Set output mesh for target surface points with distance data.
Definition lsCompareChamfer.hpp:94
void setLevelSetTarget(SmartPointer< Domain< T, D > > passedLevelSet)
Set the target level set.
Definition lsCompareChamfer.hpp:84
unsigned getNumTargetPoints() const
Get the number of target surface points.
Definition lsCompareChamfer.hpp:326
void setLevelSetSample(SmartPointer< Domain< T, D > > passedLevelSet)
Set the sample level set.
Definition lsCompareChamfer.hpp:89
Compares critical dimensions (surface positions) between two level sets. Critical dimensions are defi...
Definition lsCompareCriticalDimensions.hpp:33
void apply()
Apply the comparison.
Definition lsCompareCriticalDimensions.hpp:197
std::vector< T > getAllDifferences() const
Get all valid results.
Definition lsCompareCriticalDimensions.hpp:309
void setOutputMesh(SmartPointer< Mesh< T > > passedMesh)
Set the output mesh where critical dimension locations will be stored.
Definition lsCompareCriticalDimensions.hpp:192
bool getCriticalDimensionResult(size_t index, T &positionTarget, T &positionSample, T &difference) const
Get a specific critical dimension result.
Definition lsCompareCriticalDimensions.hpp:259
size_t getNumCriticalDimensions() const
Get the number of critical dimensions compared.
Definition lsCompareCriticalDimensions.hpp:256
void addRange(int measureDimension, const std::array< T, D > &minBounds, const std::array< T, D > &maxBounds, bool findMaximum=true)
Add a generic range specification.
Definition lsCompareCriticalDimensions.hpp:154
void addYRange(T minY, T maxY, bool findMaximum=true)
Add a Y range to find maximum or minimum X position.
Definition lsCompareCriticalDimensions.hpp:177
void clearRanges()
Clear all range specifications.
Definition lsCompareCriticalDimensions.hpp:189
void setLevelSetTarget(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsCompareCriticalDimensions.hpp:145
T getMeanDifference() const
Get mean absolute difference across all valid critical dimensions.
Definition lsCompareCriticalDimensions.hpp:271
T getMaxDifference() const
Get maximum difference across all valid critical dimensions.
Definition lsCompareCriticalDimensions.hpp:284
void addXRange(T minX, T maxX, bool findMaximum=true)
Add an X range to find maximum or minimum Y position.
Definition lsCompareCriticalDimensions.hpp:165
T getRMSE() const
Get RMSE across all valid critical dimensions.
Definition lsCompareCriticalDimensions.hpp:295
void setLevelSetSample(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsCompareCriticalDimensions.hpp:149
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:164
void setOutputMeshSquaredDifferences(bool value)
Set whether to output squared differences (true) or absolute differences (false).
Definition lsCompareNarrowBand.hpp:207
void setXRange(T minXRange, T maxXRange)
Set the x-coordinate range to restrict the comparison area.
Definition lsCompareNarrowBand.hpp:157
void setOutputMesh(SmartPointer< Mesh< T > > passedMesh, bool outputMeshSquaredDiffs=true)
Set the output mesh where difference values will be stored.
Definition lsCompareNarrowBand.hpp:199
void clearZRange()
Clear the z-range restriction.
Definition lsCompareNarrowBand.hpp:192
void setLevelSetTarget(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsCompareNarrowBand.hpp:148
T getRMSE() const
Calculate the root mean square error from previously computed values.
Definition lsCompareNarrowBand.hpp:387
void setLevelSetSample(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsCompareNarrowBand.hpp:152
unsigned getNumPoints() const
Return the number of points used in the comparison.
Definition lsCompareNarrowBand.hpp:384
void clearYRange()
Clear the y-range restriction.
Definition lsCompareNarrowBand.hpp:178
T getSumSquaredDifferences() const
Return the sum of squared differences calculated by apply().
Definition lsCompareNarrowBand.hpp:378
void apply()
Apply the comparison and calculate the sum of squared differences.
Definition lsCompareNarrowBand.hpp:212
void clearXRange()
Clear the x-range restriction.
Definition lsCompareNarrowBand.hpp:171
T getSumDifferences() const
Definition lsCompareNarrowBand.hpp:381
void setZRange(T minZRange, T maxZRange)
Set the z-coordinate range to restrict the comparison area.
Definition lsCompareNarrowBand.hpp:185
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:398
T getRMSE() const
Calculate the root mean square error from previously computed values.
Definition lsCompareSparseField.hpp:404
void setXRange(T minXRange, T maxXRange)
Set the x-coordinate range to restrict the comparison area.
Definition lsCompareSparseField.hpp:155
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:209
void setOutputMesh(SmartPointer< Mesh< T > > passedMesh)
Set the output mesh where difference values will be stored.
Definition lsCompareSparseField.hpp:197
void setLevelSetIterated(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsCompareSparseField.hpp:150
unsigned getNumSkippedPoints() const
Return the number of skipped points during the comparison.
Definition lsCompareSparseField.hpp:401
void setYRange(T minYRange, T maxYRange)
Set the y-coordinate range to restrict the comparison area.
Definition lsCompareSparseField.hpp:162
void setLevelSetExpanded(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsCompareSparseField.hpp:146
void setFillIteratedWithDistances(bool fill)
Set whether to fill the iterated level set with distances.
Definition lsCompareSparseField.hpp:202
T getSumSquaredDifferences() const
Return the sum of squared differences calculated by apply().
Definition lsCompareSparseField.hpp:392
T getSumDifferences() const
Return the sum of differences calculated by apply().
Definition lsCompareSparseField.hpp:395
void clearZRange()
Clear the z-range restriction.
Definition lsCompareSparseField.hpp:190
void clearYRange()
Clear the y-range restriction.
Definition lsCompareSparseField.hpp:176
void apply()
Apply the comparison and calculate the sum of squared differences.
Definition lsCompareSparseField.hpp:220
void clearXRange()
Clear the x-range restriction.
Definition lsCompareSparseField.hpp:169
void setZRange(T minZRange, T maxZRange)
Set the z-coordinate range to restrict the comparison area.
Definition lsCompareSparseField.hpp:183
Computes an estimate of the volume/area where two level sets differ. The volume is calculated by iter...
Definition lsCompareVolume.hpp:25
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 lsCompareVolume.hpp:171
unsigned long int getCellCount() const
Returns the number of cells where the level sets differ.
Definition lsCompareVolume.hpp:193
void setXRangeAndIncrement(hrleIndexType minXRange, hrleIndexType maxXRange, unsigned short int Xincrement)
Sets the x-range and custom increment value.
Definition lsCompareVolume.hpp:141
void setLevelSetTarget(SmartPointer< Domain< T, D > > passedLevelSet)
Sets the target level set.
Definition lsCompareVolume.hpp:126
void apply()
Computes the volume/area difference between the two level sets.
Definition lsCompareVolume.hpp:202
double getAreaMismatch() const
Alias for getVolumeMismatch for 2D compatibility.
Definition lsCompareVolume.hpp:181
void setYRangeAndIncrement(hrleIndexType minYRange, hrleIndexType maxYRange, unsigned short int Yincrement)
Sets the y-range and custom increment value.
Definition lsCompareVolume.hpp:150
void setZRangeAndIncrement(hrleIndexType minZRange, hrleIndexType maxZRange, unsigned short int Zincrement)
Sets the z-range and custom increment value.
Definition lsCompareVolume.hpp:159
void setDefaultIncrement(unsigned short int increment)
Set default increment value.
Definition lsCompareVolume.hpp:136
double getCustomVolumeMismatch() const
Returns the computed volume/area mismatch, with custom increments applied.
Definition lsCompareVolume.hpp:184
unsigned long int getCustomCellCount() const
Returns the number of cells where the level sets differ, with custom increments applied.
Definition lsCompareVolume.hpp:197
double getVolumeMismatch() const
Returns the computed volume/area mismatch.
Definition lsCompareVolume.hpp:176
void setLevelSetSample(SmartPointer< Domain< T, D > > passedLevelSet)
Sets the sample level set.
Definition lsCompareVolume.hpp:131
double getCustomAreaMismatch() const
Alias for getCustomVolumeMismatch for 2D compatibility.
Definition lsCompareVolume.hpp:190
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:332
void setMesh(SmartPointer< Mesh< T > > passedMesh)
Definition lsConvexHull.hpp:326
void setPointCloud(SmartPointer< PointCloud< T, D > > passedPointCloud)
Definition lsConvexHull.hpp:328
Definition lsGeometricAdvectDistributions.hpp:185
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:198
std::array< viennahrle::CoordType, 6 > getBounds() const override
Sets bounds to the bounding box of the distribution.
Definition lsGeometricAdvectDistributions.hpp:242
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:28
void clearMetaData()
Definition lsDomain.hpp:164
void deepCopy(const SmartPointer< Domain< T, D > > passedDomain)
copy all values of "passedDomain" to this Domain
Definition lsDomain.hpp:125
unsigned getNumberOfSegments() const
returns the number of segments, the levelset is split into. This is useful for algorithm parallelisat...
Definition lsDomain.hpp:154
void print(std::ostream &out=std::cout)
prints basic information and all memebers of the levelset structure
Definition lsDomain.hpp:179
int getLevelSetWidth() const
Definition lsDomain.hpp:159
unsigned getNumberOfPoints() const
returns the number of defined points
Definition lsDomain.hpp:157
void setLevelSetWidth(int width)
Definition lsDomain.hpp:161
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:127
void apply()
Definition lsMakeGeometry.hpp:144
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:95
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:103
void apply()
Definition lsMarkVoidPoints.hpp:154
void setSaveComponentIds(bool scid)
Set whether the connected component IDs used to generate the void points should be saved....
Definition lsMarkVoidPoints.hpp:150
void setDetectLargestSurface(bool passedDetect)
Set whether the number of points of one connected surface should be used to detect void points....
Definition lsMarkVoidPoints.hpp:113
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:119
std::size_t getNumberOfComponents() const
Definition lsMarkVoidPoints.hpp:152
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:88
void setMesh(SmartPointer< viennals::Mesh< T > > passedMesh)
Definition lsToMultiSurfaceMesh.hpp:78
void apply()
Definition lsToMultiSurfaceMesh.hpp:92
void clearLevelSets()
Definition lsToMultiSurfaceMesh.hpp:86
void insertNextLevelSet(SmartPointer< lsDomainType > passedLevelSet)
Definition lsToMultiSurfaceMesh.hpp:82
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:41
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:91
PYBIND11_DECLARE_HOLDER_TYPE(TemplateType, SmartPointer< TemplateType >)