1#include <pybind11/iostream.h>
2#include <pybind11/pybind11.h>
3#include <pybind11/stl.h>
49#include <vcLogger.hpp>
50#include <vcSmartPointer.hpp>
53namespace py = pybind11;
64 typedef std::array<viennahrle::CoordType, 3> vectorType;
65 typedef std::array<viennahrle::CoordType, 6> boundsType;
70 bool isInside(
const vectorType &initial,
const vectorType &candidate,
71 double eps = 0.)
const override {
72 PYBIND11_OVERLOAD(
bool, ClassType,
isInside, initial, candidate, eps);
76 unsigned long initialPointId)
const override {
82 PYBIND11_OVERLOAD_PURE(boundsType, ClassType,
getBounds);
86template <
int D>
void bindApi(py::module &module) {
88 py::class_<viennahrle::Grid<D>>(module,
"hrleGrid");
91 py::class_<Domain<T, D>, SmartPointer<Domain<T, D>>>(module,
"Domain")
93 .def(py::init(&SmartPointer<
Domain<T, D>>::template New<>))
96 &SmartPointer<
Domain<T, D>>::template New<viennahrle::CoordType>),
97 py::arg(
"gridDelta") = 1.0)
101 .def(py::init([](std::array<viennahrle::CoordType, 2 * D> bounds,
102 std::array<BoundaryConditionEnum, D> bcs,
103 viennahrle::CoordType gridDelta) {
104 return SmartPointer<Domain<T, D>>::New(bounds.data(), bcs.data(),
107 py::arg(
"bounds"), py::arg(
"boundaryConditions"),
108 py::arg(
"gridDelta") = 1.0)
109 .def(py::init(&SmartPointer<
Domain<T, D>>::template New<
110 std::vector<viennahrle::CoordType>, std::vector<unsigned>,
111 viennahrle::CoordType>),
112 py::arg(
"bounds"), py::arg(
"boundaryConditions"),
113 py::arg(
"gridDelta") = 1.0)
124 .def(py::init(&SmartPointer<
Domain<T, D>>::template New<
127 &SmartPointer<
Domain<T, D>>::template New<viennahrle::Grid<D> &>))
130 "Copy lsDomain in this lsDomain.")
132 "Get the number of segments, the level set structure is divided "
135 "Get the number of defined level set values.")
137 "Get the number of layers of level set points around the explicit "
140 "Set the number of layers of level set points which should be "
141 "stored around the explicit surface.")
143 "Clear all metadata stored in the level set.")
148 if (!(py::hasattr(fileHandle,
"write") &&
149 py::hasattr(fileHandle,
"flush"))) {
150 throw py::type_error(
151 "MyClass::read_from_file_like_object(file): incompatible "
152 "function argument: `file` must be a file-like object, but "
154 (std::string)(py::repr(fileHandle)) +
"` provided");
156 py::detail::pythonbuf buf(fileHandle);
157 std::ostream stream(&buf);
160 py::arg(
"stream") = py::module::import(
"sys").attr(
"stdout"));
163 py::class_<Advect<T, D>, SmartPointer<Advect<T, D>>>(module,
"Advect")
165 .def(py::init(&SmartPointer<
Advect<T, D>>::template New<>))
166 .def(py::init(&SmartPointer<
Advect<T, D>>::template New<
173 "Insert next level set to use for advection.")
175 "Set the velocity to use for advection.")
177 "Set the time until when the level set should be advected.")
179 "Set the maximum time step size relative to grid size. Advection is "
180 "only stable for <0.5.")
181 .def(
"setCalculateNormalVectors",
183 "Set whether normal vectors are needed for the supplied velocity "
186 "Set whether voids in the geometry should be ignored during "
189 "Get the time passed during advection.")
191 "Get how many advection steps were performed after the last apply() "
194 "Get the time step ratio used for advection.")
196 "Get the current time step.")
197 .def(
"getCalculateNormalVectors",
199 "Get whether normal vectors are computed during advection.")
201 "Set the integration scheme to use during advection.")
203 "Set the dissipation value to use for Lax Friedrichs integration.")
208 py::call_guard<py::gil_scoped_release>(),
"Perform advection.")
210 py::call_guard<py::gil_scoped_release>(),
211 "Apply the integration scheme and calculate rates and maximum time "
212 "step, but it do **not** move the surface.");
214 py::class_<lsInternal::StencilLocalLaxFriedrichsScalar<T, D, 1>>(
215 module,
"StencilLocalLaxFriedrichsScalar")
219 1>::setMaxDissipation,
220 py::arg(
"maxDissipation"));
222 module.def("PrepareStencilLocalLaxFriedrichs",
223 &PrepareStencilLocalLaxFriedrichs<T, D>, py::arg("levelSets"),
226 module.def("FinalizeStencilLocalLaxFriedrichs",
227 &FinalizeStencilLocalLaxFriedrichs<T, D>, py::arg("levelSets"));
230 py::class_<BooleanOperation<T, D>, SmartPointer<BooleanOperation<T, D>>>(
231 module,
"BooleanOperation")
243 return SmartPointer<BooleanOperation<T, D>>::New(domain, op);
248 return SmartPointer<BooleanOperation<T, D>>::New(domainA, domainB, op);
252 "Set levelset on which the boolean operation should be performed.")
254 "Set second levelset for boolean operation.")
256 "Set which type of boolean operation should be performed.")
258 "Perform the boolean operation.");
260 py::class_<CalculateCurvatures<T, D>,
261 SmartPointer<CalculateCurvatures<T, D>>>(module,
262 "CalculateCurvatures")
270 return SmartPointer<CalculateCurvatures<T, D>>::New(domain, type);
274 "Set levelset for which to calculate the curvatures.")
276 "Set which method to use for calculation: Defaults to mean "
279 "Curvatures will be calculated for all LS values < maxValue.")
281 "Perform normal vector calculation.");
284 py::class_<CalculateNormalVectors<T, D>,
285 SmartPointer<CalculateNormalVectors<T, D>>>(
286 module,
"CalculateNormalVectors")
294 "Set levelset for which to calculate normal vectors.")
296 "Perform normal vector calculation.");
299 py::class_<CalculateVisibilities<T, D>,
300 SmartPointer<CalculateVisibilities<T, D>>>(module,
301 "CalculateVisibilities")
304 SmartPointer<
Domain<T, D>> &,
const Vec3D<T> &, std::string>))
308 py::class_<Check<T, D>, SmartPointer<Check<T, D>>>(module,
"Check")
310 .def(py::init(&SmartPointer<
Check<T, D>>::template New<>))
311 .def(py::init(&SmartPointer<
Check<T, D>>::template New<
315 "Set levelset for which to calculate normal vectors.")
319 py::class_<PointCloud<T, D>, SmartPointer<PointCloud<T, D>>>(module,
323 const std::vector<VectorType<T, D>> &>))
325 .def(
"insertNextPoint",
330 py::class_<ConvexHull<T, D>, SmartPointer<ConvexHull<T, D>>>(module,
338 "Set mesh object where the generated mesh should be stored.")
340 "Set point cloud used to generate mesh.")
344 py::class_<DetectFeatures<T, D>, SmartPointer<DetectFeatures<T, D>>>(
345 module,
"DetectFeatures")
354 .def(py::init([](SmartPointer<
Domain<T, D>> &domain,
T maxValue,
356 return SmartPointer<DetectFeatures<T, D>>::New(domain, maxValue, type);
358 .def(
"setDetectionThreshold",
360 "Set the curvature value above which a point is considered a "
363 "Set which method to use to detect features. Defaults to Curvature.")
367 py::class_<GeometricAdvect<T, D>, SmartPointer<GeometricAdvect<T, D>>>(
368 module,
"GeometricAdvect")
378 "Set levelset to advect.")
380 "setAdvectionDistribution",
383 "Set advection distribution to use as kernel for the fast advection.")
385 py::call_guard<py::gil_scoped_release>(),
"Perform advection.");
388 py::class_<GeometricAdvectDistribution<T, D>,
389 SmartPointer<GeometricAdvectDistribution<T, D>>,
391 "GeometricAdvectDistribution")
396 "Check whether passed point is inside the distribution.")
397 .def(
"getSignedDistance",
399 "Get the signed distance of the passed point to the surface of the "
402 "Get the cartesian bounds of the distribution.");
404 py::class_<SphereDistribution<T, D>, SmartPointer<SphereDistribution<T, D>>,
411 "Check whether passed point is inside the distribution.")
413 "Get the signed distance of the passed point to the surface of the "
416 "Get the cartesian bounds of the distribution.");
418 py::class_<BoxDistribution<T, D>, SmartPointer<BoxDistribution<T, D>>,
422 const std::array<T, 3>,
T>))
425 "Check whether passed point is inside the distribution.")
427 "Get the signed distance of the passed point to the surface of the "
430 "Get the cartesian bounds of the distribution.");
433 py::class_<Expand<T, D>, SmartPointer<Expand<T, D>>>(module,
"Expand")
435 .def(py::init(&SmartPointer<
Expand<T, D>>::template New<>))
436 .def(py::init(&SmartPointer<
Expand<T, D>>::template New<
438 .def(py::init(&SmartPointer<
Expand<T, D>>::template New<
446 py::class_<FromSurfaceMesh<T, D>, SmartPointer<FromSurfaceMesh<T, D>>>(
447 module,
"FromSurfaceMesh")
457 "Set levelset to read into.")
459 "Set the mesh to read from.")
460 .def(
"setRemoveBoundaryTriangles",
463 "Set whether to include mesh elements outside of the simulation "
465 .def(
"setRemoveBoundaryTriangles",
468 "Set whether to include mesh elements outside of the simulation "
471 "Construct a levelset from a surface mesh.");
474 py::class_<FromVolumeMesh<T, D>, SmartPointer<FromVolumeMesh<T, D>>>(
475 module,
"FromVolumeMesh")
483 SmartPointer<
Mesh<T>> &,
bool>))
486 "Set the grid used to read in the level sets.")
488 "Set the mesh to read from.")
489 .def(
"setRemoveBoundaryTriangles",
491 "Set whether to include mesh elements outside of the simulation "
494 "Construct a levelset from a volume mesh.");
497 py::class_<FromMesh<T, D>, SmartPointer<FromMesh<T, D>>>(module,
"FromMesh")
507 py::class_<Sphere<T, D>, SmartPointer<Sphere<T, D>>>(module,
"Sphere")
509 .def(py::init(&SmartPointer<
Sphere<T, D>>::template New<
510 const std::vector<T> & ,
T >),
511 py::arg(
"origin"), py::arg(
"radius"));
513 py::class_<Plane<T, D>, SmartPointer<Plane<T, D>>>(module,
"Plane")
515 .def(py::init(&SmartPointer<
Plane<T, D>>::template New<
516 const std::vector<T> & ,
517 const std::vector<T> & >),
518 py::arg(
"origin"), py::arg(
"normal"));
520 py::class_<Box<T, D>, SmartPointer<Box<T, D>>>(module,
"Box")
522 .def(py::init(&SmartPointer<
Box<T, D>>::template New<
523 const std::vector<T> & ,
524 const std::vector<T> & >),
525 py::arg(
"minPoint"), py::arg(
"maxPoint"));
527 py::class_<Cylinder<T, D>, SmartPointer<Cylinder<T, D>>>(module,
"Cylinder")
531 const std::vector<T> & ,
532 const std::vector<T> & ,
const T ,
533 const T ,
const T >),
534 py::arg(
"origin"), py::arg(
"axisDirection"), py::arg(
"height"),
535 py::arg(
"radius"), py::arg(
"topRadius") = 0.);
538 py::class_<MakeGeometry<T, D>, SmartPointer<MakeGeometry<T, D>>>(
539 module,
"MakeGeometry")
559 "Set the levelset in which to create the geometry.")
575 .def(
"setIgnoreBoundaryConditions",
578 .def(
"setIgnoreBoundaryConditions",
584 py::class_<MarkVoidPoints<T, D>, SmartPointer<MarkVoidPoints<T, D>>>(
585 module,
"MarkVoidPoints")
594 "Set the levelset to mark void points in.")
595 .def(
"setReverseVoidDetection",
597 "Reverse the logic of detecting the top surface.")
598 .def(
"setDetectLargestSurface",
600 "Set that the top surface should be the one with the most connected "
603 "Set the logic by which to choose the surface which is non-void. "
604 "All other connected surfaces will then be marked as void points.")
606 "Save the connectivity information of all LS points in the "
607 "pointData of the level set.")
611 py::class_<Prune<T, D>, SmartPointer<Prune<T, D>>>(module,
"Prune")
613 .def(py::init(&SmartPointer<
Prune<T, D>>::template New<>))
614 .def(py::init(&SmartPointer<
Prune<T, D>>::template New<
621 py::class_<Reader<T, D>, SmartPointer<Reader<T, D>>>(module,
"Reader")
623 .def(py::init(&SmartPointer<
Reader<T, D>>::template New<>))
624 .def(py::init(&SmartPointer<
Reader<T, D>>::template New<
626 .def(py::init(&SmartPointer<
Reader<T, D>>::template New<
630 "Set levelset to write to file.")
632 "Set the filename for the output file.")
636 py::class_<Reduce<T, D>, SmartPointer<Reduce<T, D>>>(module,
"Reduce")
638 .def(py::init(&SmartPointer<
Reduce<T, D>>::template New<>))
639 .def(py::init(&SmartPointer<
Reduce<T, D>>::template New<
641 .def(py::init(&SmartPointer<
Reduce<T, D>>::template New<
643 .def(py::init(&SmartPointer<
Reduce<T, D>>::template New<
649 "Set whether the levelset should be segmented anew (balanced across "
650 "cores) after reduction.")
654 py::class_<RemoveStrayPoints<T, D>, SmartPointer<RemoveStrayPoints<T, D>>>(
655 module,
"RemoveStrayPoints")
662 "Set levelset for stray point removal.")
664 "Set the logic by which to choose the surface which should be kept. "
665 "All other LS values will be marked as stray points and removed.")
669 py::class_<ToDiskMesh<T, D>, SmartPointer<ToDiskMesh<T, D>>>(module,
677 "Set levelset to mesh.")
680 "Convert the levelset to a surface mesh.");
683 py::class_<ToMesh<T, D>, SmartPointer<ToMesh<T, D>>>(module,
"ToMesh")
685 .def(py::init(&SmartPointer<
ToMesh<T, D>>::template New<>))
686 .def(py::init(&SmartPointer<
ToMesh<T, D>>::template New<
691 .def(py::init(&SmartPointer<
ToMesh<T, D>>::template New<
698 "Set whether only defined points should be output to the mesh.")
700 "Set whether only level set points <0.5 should be output.")
702 "Convert the levelset to a surface mesh.");
705 py::class_<ToSurfaceMesh<T, D>, SmartPointer<ToSurfaceMesh<T, D>>>(
706 module,
"ToSurfaceMesh")
713 "Set levelset to mesh.")
715 "Set the mesh to generate.")
717 "Convert the levelset to a surface mesh.");
720 py::class_<ToVoxelMesh<T, D>, SmartPointer<ToVoxelMesh<T, D>>>(module,
733 "Insert next level set to output in the mesh.")
736 "Convert the levelset to a surface mesh.");
739 py::class_<Writer<T, D>, SmartPointer<Writer<T, D>>>(module,
"Writer")
741 .def(py::init(&SmartPointer<
Writer<T, D>>::template New<>))
742 .def(py::init(&SmartPointer<
Writer<T, D>>::template New<
744 .def(py::init(&SmartPointer<
Writer<T, D>>::template New<
748 "Set levelset to write to file.")
750 "Set the filename for the output file.")
754#ifdef VIENNALS_USE_VTK
755 py::class_<WriteVisualizationMesh<T, D>,
756 SmartPointer<WriteVisualizationMesh<T, D>>>(
757 module,
"WriteVisualizationMesh")
760 py::init(&SmartPointer<WriteVisualizationMesh<T, D>>::template New<>))
761 .def(py::init(&SmartPointer<WriteVisualizationMesh<T, D>>::template New<
764 .def(
"insertNextLevelSet",
765 &WriteVisualizationMesh<T, D>::insertNextLevelSet,
766 "Insert next level set to convert. Bigger level sets wrapping "
767 "smaller ones, should be inserted last.")
768 .def(
"setFileName", &WriteVisualizationMesh<T, D>::setFileName,
769 "Set Name of File to write.")
770 .def(
"setExtractHullMesh",
771 &WriteVisualizationMesh<T, D>::setExtractHullMesh,
772 "Whether to extract a hull mesh. Defaults to false.")
773 .def(
"setExtractVolumeMesh",
774 &WriteVisualizationMesh<T, D>::setExtractVolumeMesh,
775 " Whether to extract a tetra volume mesh. Defaults to true.")
776 .def(
"setMetaData", &WriteVisualizationMesh<T, D>::setMetaData,
777 "Set the metadata to be written to the file.")
779 py::overload_cast<const std::string &, T>(
780 &WriteVisualizationMesh<T, D>::addMetaData),
781 "Add a single metadata entry to the file.")
783 py::overload_cast<
const std::string &,
const std::vector<T> &>(
784 &WriteVisualizationMesh<T, D>::addMetaData),
785 "Add a single metadata entry to the file.")
788 const std::unordered_map<std::string, std::vector<T>> &>(
789 &WriteVisualizationMesh<T, D>::addMetaData),
790 "Add metadata to the file.")
791 .def(
"apply", &WriteVisualizationMesh<T, D>::apply,
792 "Make and write mesh.");
795 if constexpr (
D == 2) {
797 py::class_<CompareArea<T, D>, SmartPointer<CompareArea<T, D>>>(
798 module,
"CompareArea")
806 "Sets the target level set.")
808 "Sets the sample level set.")
810 "Set default increment value")
812 "Sets the x-range and custom increment value")
814 "Sets the y-range and custom increment value")
816 "Set the output mesh where difference areas will be stored")
818 "Returns the computed area mismatch.")
820 "Returns the computed area mismatch, with custom increments "
823 "Returns the number of cells where the level sets differ.")
825 "Returns the number of cells where the level sets differ, with "
826 "custom increments applied.")
828 "Computes the area difference between the two level sets.");
831 py::class_<CompareNarrowBand<T, D>, SmartPointer<CompareNarrowBand<T, D>>>(
832 module,
"CompareNarrowBand")
840 "Sets the target level set.")
842 "Sets the sample level set.")
844 "Set the x-coordinate range to restrict the comparison area")
846 "Set the y-coordinate range to restrict the comparison area")
848 "Clear the x-range restriction")
850 "Clear the y-range restriction")
852 "Set the output mesh where difference values will be stored")
853 .def(
"setOutputMeshSquaredDifferences",
855 "Set whether to output squared differences (true) or absolute "
856 "differences (false)")
858 "Apply the comparison and calculate the sum of squared "
860 .def(
"getSumSquaredDifferences",
862 "Return the sum of squared differences calculated by apply().")
864 "Return the sum of absolute differences calculated by apply().")
866 "Return the number of points used in the comparison.")
868 "Calculate the root mean square error from previously computed "
872 py::class_<CompareSparseField<T, D>,
873 SmartPointer<CompareSparseField<T, D>>>(module,
874 "CompareSparseField")
881 .def(
"setLevelSetExpanded",
883 "Sets the expanded level set for comparison.")
884 .def(
"setLevelSetIterated",
886 "Sets the iterated level set to compare against the expanded one.")
888 "Set the x-coordinate range to restrict the comparison area")
890 "Set the y-coordinate range to restrict the comparison area")
892 "Clear the x-range restriction")
894 "Clear the y-range restriction")
896 "Set the output mesh where difference values will be stored")
897 .def(
"setFillIteratedWithDistances",
899 "Set whether to fill the iterated level set with distance values")
901 "Apply the comparison and calculate the sum of squared "
903 .def(
"getSumSquaredDifferences",
905 "Return the sum of squared differences calculated by apply().")
907 "Return the sum of absolute differences calculated by apply().")
909 "Return the number of points used in the comparison.")
910 .def(
"getNumSkippedPoints",
912 "Return the number of points skipped during comparison.")
914 "Calculate the root mean square error from previously computed "
constexpr int D
Definition Epitaxy.cpp:11
double T
Definition Epitaxy.cpp:12
T getSignedDistance(const vectorType &initial, const vectorType &candidate, unsigned long initialPointId) const override
Definition pyWrap.hpp:75
bool isInside(const vectorType &initial, const vectorType &candidate, double eps=0.) const override
Definition pyWrap.hpp:70
boundsType getBounds() const override
Sets bounds to the bounding box of the distribution.
Definition pyWrap.hpp:81
Stencil Local Lax Friedrichs Integration Scheme. It uses a stencil of order around active points,...
Definition lsStencilLocalLaxFriedrichsScalar.hpp:33
This class is used to advance level sets over time. Level sets are passed to the constructor in a std...
Definition lsAdvect.hpp:64
void setVelocityField(SmartPointer< VelocityField< T > > passedVelocities)
Set the velocity field used for advection. This should be a concrete implementation of lsVelocityFiel...
Definition lsAdvect.hpp:736
void insertNextLevelSet(SmartPointer< Domain< T, D > > passedlsDomain)
Pushes the passed level set to the back of the list of level sets used for advection.
Definition lsAdvect.hpp:730
bool getCalculateNormalVectors() const
Get whether normal vectors were calculated.
Definition lsAdvect.hpp:791
void setIgnoreVoids(bool iV)
Set whether level set values, which are not part of the "top" geometrically connected part of values,...
Definition lsAdvect.hpp:771
void setCalculateNormalVectors(bool cnv)
Set whether normal vectors should be calculated at each level set point. Defaults to true....
Definition lsAdvect.hpp:763
void apply()
Perform the advection.
Definition lsAdvect.hpp:861
void prepareLS()
Definition lsAdvect.hpp:814
double getAdvectedTime() const
Get by how much the physical time was advanced during the last apply() call.
Definition lsAdvect.hpp:779
void setDissipationAlpha(const double &a)
Set the alpha dissipation coefficient. For lsLaxFriedrichs, this is used as the alpha value....
Definition lsAdvect.hpp:803
void setIntegrationScheme(IntegrationSchemeEnum scheme)
Set which integration scheme should be used out of the ones specified in IntegrationSchemeEnum.
Definition lsAdvect.hpp:795
double getCurrentTimeStep() const
Return the last applied time step.
Definition lsAdvect.hpp:782
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:745
unsigned getNumberOfTimeSteps() const
Get how many advection steps were performed during the last apply() call.
Definition lsAdvect.hpp:785
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:757
void applyIntegration(double maxTimeStep=std::numeric_limits< double >::max())
This function applies the integration scheme and calculates the rates and the maximum time step,...
Definition lsAdvect.hpp:881
double getTimeStepRatio() const
Get the value of the CFL number.
Definition lsAdvect.hpp:788
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:117
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:135
std::array< viennahrle::CoordType, 6 > getBounds() const override
Sets bounds to the bounding box of the distribution.
Definition lsGeometricAdvectDistributions.hpp:158
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:147
Class describing a square box from one coordinate to another.
Definition lsGeometries.hpp:71
Definition lsCalculateCurvatures.hpp:24
void setCurvatureType(CurvatureEnum passedType)
Definition lsCalculateCurvatures.hpp:46
void setMaxValue(const T passedMaxValue)
Definition lsCalculateCurvatures.hpp:59
void apply()
Definition lsCalculateCurvatures.hpp:61
void setLevelSet(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsCalculateCurvatures.hpp:42
This algorithm is used to compute the normal vectors for all points with level set values <= maxValue...
Definition lsCalculateNormalVectors.hpp:35
void setLevelSet(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsCalculateNormalVectors.hpp:53
void apply()
Definition lsCalculateNormalVectors.hpp:82
Definition lsCalculateVisibilities.hpp:10
void apply()
Definition lsCalculateVisibilities.hpp:25
This class is used to find errors in the underlying level set structure, like invalid neighbours of d...
Definition lsCheck.hpp:22
void apply()
Definition lsCheck.hpp:78
void setLevelSet(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsCheck.hpp:66
Computes an estimate of the area where two level sets differ. The area is calculated by iterating thr...
Definition lsCompareArea.hpp:23
unsigned long int getCustomCellCount() const
Returns the number of cells where the level sets differ, with custom increments applied.
Definition lsCompareArea.hpp:175
void setXRangeAndIncrement(hrleIndexType minXRange, hrleIndexType maxXRange, unsigned short int Xincrement)
Sets the x-range and custom increment value.
Definition lsCompareArea.hpp:134
void setLevelSetTarget(SmartPointer< Domain< T, D > > passedLevelSet)
Sets the target level set.
Definition lsCompareArea.hpp:119
unsigned long int getCellCount() const
Returns the number of cells where the level sets differ.
Definition lsCompareArea.hpp:171
double getCustomAreaMismatch() const
Returns the computed area mismatch, with custom increments applied.
Definition lsCompareArea.hpp:165
void setLevelSetSample(SmartPointer< Domain< T, D > > passedLevelSet)
Sets the sample level set.
Definition lsCompareArea.hpp:124
void apply()
Computes the area difference between the two level sets.
Definition lsCompareArea.hpp:180
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:155
void setDefaultIncrement(unsigned short int increment)
Set default increment value.
Definition lsCompareArea.hpp:129
void setYRangeAndIncrement(hrleIndexType minYRange, hrleIndexType maxYRange, unsigned short int Yincrement)
Sets the y-range and custom increment value.
Definition lsCompareArea.hpp:143
double getAreaMismatch() const
Returns the computed area mismatch.
Definition lsCompareArea.hpp:160
Calculate distance measure between two level sets by comparing their SDF values on a narrow band....
Definition lsCompareNarrowBand.hpp:19
void setYRange(T minYRange, T maxYRange)
Set the y-coordinate range to restrict the comparison area.
Definition lsCompareNarrowBand.hpp:172
void setOutputMeshSquaredDifferences(bool value)
Set whether to output squared differences (true) or absolute differences (false)
Definition lsCompareNarrowBand.hpp:201
void setXRange(T minXRange, T maxXRange)
Set the x-coordinate range to restrict the comparison area.
Definition lsCompareNarrowBand.hpp:165
void setOutputMesh(SmartPointer< Mesh< T > > passedMesh, bool outputMeshSquaredDiffs=true)
Set the output mesh where difference values will be stored.
Definition lsCompareNarrowBand.hpp:193
void setLevelSetTarget(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsCompareNarrowBand.hpp:156
T getRMSE() const
Calculate the root mean square error from previously computed values.
Definition lsCompareNarrowBand.hpp:373
void setLevelSetSample(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsCompareNarrowBand.hpp:160
unsigned getNumPoints() const
Return the number of points used in the comparison.
Definition lsCompareNarrowBand.hpp:370
void clearYRange()
Clear the y-range restriction.
Definition lsCompareNarrowBand.hpp:186
T getSumSquaredDifferences() const
Return the sum of squared differences calculated by apply().
Definition lsCompareNarrowBand.hpp:364
void apply()
Apply the comparison and calculate the sum of squared differences.
Definition lsCompareNarrowBand.hpp:206
void clearXRange()
Clear the x-range restriction.
Definition lsCompareNarrowBand.hpp:179
T getSumDifferences() const
Definition lsCompareNarrowBand.hpp:367
Calculate distance measure between two level sets by comparing their SDF values on a sparse field....
Definition lsCompareSparseField.hpp:34
unsigned getNumPoints() const
Return the number of points used in the comparison.
Definition lsCompareSparseField.hpp:368
T getRMSE() const
Calculate the root mean square error from previously computed values.
Definition lsCompareSparseField.hpp:374
void setXRange(T minXRange, T maxXRange)
Set the x-coordinate range to restrict the comparison area.
Definition lsCompareSparseField.hpp:161
void setOutputMesh(SmartPointer< Mesh< T > > passedMesh)
Set the output mesh where difference values will be stored.
Definition lsCompareSparseField.hpp:189
void setLevelSetIterated(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsCompareSparseField.hpp:156
unsigned getNumSkippedPoints() const
Return the number of skipped points during the comparison.
Definition lsCompareSparseField.hpp:371
void setYRange(T minYRange, T maxYRange)
Set the y-coordinate range to restrict the comparison area.
Definition lsCompareSparseField.hpp:168
void setLevelSetExpanded(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsCompareSparseField.hpp:152
void setFillIteratedWithDistances(bool fill)
Set whether to fill the iterated level set with distances.
Definition lsCompareSparseField.hpp:194
T getSumSquaredDifferences() const
Return the sum of squared differences calculated by apply().
Definition lsCompareSparseField.hpp:362
T getSumDifferences() const
Return the sum of differences calculated by apply().
Definition lsCompareSparseField.hpp:365
void clearYRange()
Clear the y-range restriction.
Definition lsCompareSparseField.hpp:182
void apply()
Apply the comparison and calculate the sum of squared differences.
Definition lsCompareSparseField.hpp:199
void clearXRange()
Clear the x-range restriction.
Definition lsCompareSparseField.hpp:175
This algorithm creates a convex hull mesh from a point cloud. This is done using the gift wrapping ap...
Definition lsConvexHull.hpp:23
void apply()
Definition lsConvexHull.hpp:285
void setMesh(SmartPointer< Mesh< T > > passedMesh)
Definition lsConvexHull.hpp:279
void setPointCloud(SmartPointer< PointCloud< T, D > > passedPointCloud)
Definition lsConvexHull.hpp:281
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 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 initialPointId) const =0
Returns the signed distance of a point relative to the distributions center. This is the signed manha...
virtual std::array< viennahrle::CoordType, 6 > getBounds() const =0
Sets bounds to the bounding box of the distribution.
GeometricAdvectDistribution()=default
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:82
void apply()
Perform geometrical advection.
Definition lsGeometricAdvect.hpp:104
Create level sets describing basic geometric forms.
Definition lsMakeGeometry.hpp:27
void setIgnoreBoundaryConditions(bool passedIgnoreBoundaryConditions)
Ignore boundary conditions, meaning the parts of the generated geometry which are outside of the doma...
Definition lsMakeGeometry.hpp:129
void apply()
Definition lsMakeGeometry.hpp:146
void setLevelSet(SmartPointer< Domain< T, D > > passedlsDomain)
Definition lsMakeGeometry.hpp:87
void setGeometry(SmartPointer< Sphere< T, D > > passedSphere)
Set sphere as geometry to be created in the level set.
Definition lsMakeGeometry.hpp:92
This class is used to mark points of the level set which are enclosed in a void.
Definition lsMarkVoidPoints.hpp:28
void setLevelSet(SmartPointer< Domain< T, D > > passedlsDomain)
Definition lsMarkVoidPoints.hpp:94
void setReverseVoidDetection(bool passedReverseVoidDetection)
Set whether the "top" level set should be the most positive(default) connected chain of level set val...
Definition lsMarkVoidPoints.hpp:102
void apply()
Definition lsMarkVoidPoints.hpp:153
void setSaveComponentIds(bool scid)
Set whether the connected component IDs used to generate the void points should be saved....
Definition lsMarkVoidPoints.hpp:151
void setDetectLargestSurface(bool passedDetect)
Set whether the number of points of one connected surface should be used to detect void points....
Definition lsMarkVoidPoints.hpp:112
void setVoidTopSurface(VoidTopSurfaceEnum topSurface)
Set which connected component to use as the top surface and mark all other components as void points.
Definition lsMarkVoidPoints.hpp:118
This class holds an explicit mesh, which is always given in 3 dimensions. If it describes a 2D mesh,...
Definition lsMesh.hpp:22
Class describing a plane via a point in it and the plane normal.
Definition lsGeometries.hpp:42
Class describing a point cloud, which can be used to create geometries from its convex hull mesh.
Definition lsGeometries.hpp:145
void insertNextPoint(T *newPoint)
Definition lsGeometries.hpp:154
Removes all level set points, which do not have at least one oppositely signed neighbour (Meaning the...
Definition lsPrune.hpp:17
void apply()
removes all grid points, which do not have at least one opposite signed neighbour returns the number ...
Definition lsPrune.hpp:74
void setLevelSet(SmartPointer< Domain< T, D > > passedlsDomain)
Definition lsPrune.hpp:59
Definition lsReader.hpp:13
void setLevelSet(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsReader.hpp:26
void apply()
Definition lsReader.hpp:35
void setFileName(std::string passedFileName)
set file name for file to write
Definition lsReader.hpp:31
Reduce the level set size to the specified width. This means all level set points with value <= 0....
Definition lsReduce.hpp:14
void apply()
Reduces the leveleSet to the specified number of layers. The largest value in the levelset is thus wi...
Definition lsReduce.hpp:55
void setLevelSet(SmartPointer< Domain< T, D > > passedlsDomain)
Definition lsReduce.hpp:32
void setWidth(int passedWidth)
Set which level set points should be kept. All points with a level set value >0.5*width will be remov...
Definition lsReduce.hpp:39
void setNoNewSegment(bool passedNoNewSegment)
Set whether to segment the level set after algorithm is finished. This means points will be evenly di...
Definition lsReduce.hpp:44
This algorithm can be used to remove all LS values which are not part of a so-called top surface....
Definition lsRemoveStrayPoints.hpp:17
void setVoidTopSurface(VoidTopSurfaceEnum topSurface)
Set how the algorithm should pick the surface which will not be removed. Defaults to the surface with...
Definition lsRemoveStrayPoints.hpp:33
void apply()
Definition lsRemoveStrayPoints.hpp:37
void setLevelSet(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsRemoveStrayPoints.hpp:27
Concrete implementation of GeometricAdvectDistribution for a spherical advection distribution.
Definition lsGeometricAdvectDistributions.hpp:45
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:54
std::array< viennahrle::CoordType, 6 > getBounds() const override
Sets bounds to the bounding box of the distribution.
Definition lsGeometricAdvectDistributions.hpp:104
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:69
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 setMesh(SmartPointer< Mesh< N > > passedMesh)
Definition lsToDiskMesh.hpp:70
void apply()
Definition lsToDiskMesh.hpp:83
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
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: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:80
Abstract class defining the interface for the velocity field used during advection using lsAdvect.
Definition lsVelocityField.hpp:11
Definition lsWriter.hpp:13
void setFileName(std::string passedFileName)
set file name for file to write
Definition lsWriter.hpp:31
void setLevelSet(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsWriter.hpp:26
void apply()
Definition lsWriter.hpp:35
Definition lsAdvect.hpp:36
FeatureDetectionEnum
Definition lsDetectFeatures.hpp:16
BooleanOperationEnum
Enumeration for the different types of boolean operations which are supported. When INVERT,...
Definition lsBooleanOperation.hpp:25
CurvatureEnum
Definition lsCalculateCurvatures.hpp:15
void bindApi(py::module &module)
Definition pyWrap.hpp:86
PYBIND11_DECLARE_HOLDER_TYPE(TemplateType, SmartPointer< TemplateType >)