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