1#include <pybind11/iostream.h>
2#include <pybind11/pybind11.h>
3#include <pybind11/stl.h>
50#include <vcLogger.hpp>
51#include <vcSmartPointer.hpp>
54namespace py = pybind11;
65 typedef std::array<viennahrle::CoordType, 3> vectorType;
66 typedef std::array<viennahrle::CoordType, 6> boundsType;
71 bool isInside(
const vectorType &initial,
const vectorType &candidate,
72 double eps = 0.)
const override {
73 PYBIND11_OVERLOAD(
bool, ClassType,
isInside, initial, candidate, eps);
77 unsigned long initialPointId)
const override {
83 PYBIND11_OVERLOAD_PURE(boundsType, ClassType,
getBounds);
87template <
int D>
void bindApi(py::module &module) {
89 py::class_<viennahrle::Grid<D>>(module,
"hrleGrid");
92 py::class_<Domain<T, D>, SmartPointer<Domain<T, D>>>(module,
"Domain")
94 .def(py::init(&SmartPointer<
Domain<T, D>>::template New<>))
97 &SmartPointer<
Domain<T, D>>::template New<viennahrle::CoordType>),
98 py::arg(
"gridDelta") = 1.0)
102 .def(py::init([](std::array<viennahrle::CoordType, 2 * D> bounds,
103 std::array<BoundaryConditionEnum, D> bcs,
104 viennahrle::CoordType gridDelta) {
105 return SmartPointer<Domain<T, D>>::New(bounds.data(), bcs.data(),
108 py::arg(
"bounds"), py::arg(
"boundaryConditions"),
109 py::arg(
"gridDelta") = 1.0)
110 .def(py::init(&SmartPointer<
Domain<T, D>>::template New<
111 std::vector<viennahrle::CoordType>, std::vector<unsigned>,
112 viennahrle::CoordType>),
113 py::arg(
"bounds"), py::arg(
"boundaryConditions"),
114 py::arg(
"gridDelta") = 1.0)
125 .def(py::init(&SmartPointer<
Domain<T, D>>::template New<
128 &SmartPointer<
Domain<T, D>>::template New<viennahrle::Grid<D> &>))
131 "Copy lsDomain in this lsDomain.")
133 "Get the number of segments, the level set structure is divided "
136 "Get the number of defined level set values.")
138 "Get the number of layers of level set points around the explicit "
141 "Set the number of layers of level set points which should be "
142 "stored around the explicit surface.")
144 "Clear all metadata stored in the level set.")
149 if (!(py::hasattr(fileHandle,
"write") &&
150 py::hasattr(fileHandle,
"flush"))) {
151 throw py::type_error(
152 "MyClass::read_from_file_like_object(file): incompatible "
153 "function argument: `file` must be a file-like object, but "
155 (std::string)(py::repr(fileHandle)) +
"` provided");
157 py::detail::pythonbuf buf(fileHandle);
158 std::ostream stream(&buf);
161 py::arg(
"stream") = py::module::import(
"sys").attr(
"stdout"));
164 py::class_<Advect<T, D>, SmartPointer<Advect<T, D>>>(module,
"Advect")
166 .def(py::init(&SmartPointer<
Advect<T, D>>::template New<>))
167 .def(py::init(&SmartPointer<
Advect<T, D>>::template New<
174 "Insert next level set to use for advection.")
176 "Set the velocity to use for advection.")
178 "Set the time until when the level set should be advected.")
180 "Set the maximum time step size relative to grid size. Advection is "
181 "only stable for <0.5.")
182 .def(
"setCalculateNormalVectors",
184 "Set whether normal vectors are needed for the supplied velocity "
187 "Set whether voids in the geometry should be ignored during "
190 "Get the time passed during advection.")
192 "Get how many advection steps were performed after the last apply() "
195 "Get the time step ratio used for advection.")
197 "Get the current time step.")
198 .def(
"getCalculateNormalVectors",
200 "Get whether normal vectors are computed during advection.")
202 "Set the integration scheme to use during advection.")
204 "Set the dissipation value to use for Lax Friedrichs integration.")
209 py::call_guard<py::gil_scoped_release>(),
"Perform advection.")
211 py::call_guard<py::gil_scoped_release>(),
212 "Apply the integration scheme and calculate rates and maximum time "
213 "step, but it do **not** move the surface.");
215 py::class_<lsInternal::StencilLocalLaxFriedrichsScalar<T, D, 1>>(
216 module,
"StencilLocalLaxFriedrichsScalar")
220 1>::setMaxDissipation,
221 py::arg(
"maxDissipation"));
223 module.def("PrepareStencilLocalLaxFriedrichs",
224 &PrepareStencilLocalLaxFriedrichs<T, D>, py::arg("levelSets"),
227 module.def("FinalizeStencilLocalLaxFriedrichs",
228 &FinalizeStencilLocalLaxFriedrichs<T, D>, py::arg("levelSets"));
231 py::class_<BooleanOperation<T, D>, SmartPointer<BooleanOperation<T, D>>>(
232 module,
"BooleanOperation")
244 return SmartPointer<BooleanOperation<T, D>>::New(domain, op);
249 return SmartPointer<BooleanOperation<T, D>>::New(domainA, domainB, op);
253 "Set levelset on which the boolean operation should be performed.")
255 "Set second levelset for boolean operation.")
257 "Set which type of boolean operation should be performed.")
259 "Perform the boolean operation.");
261 py::class_<CalculateCurvatures<T, D>,
262 SmartPointer<CalculateCurvatures<T, D>>>(module,
263 "CalculateCurvatures")
271 return SmartPointer<CalculateCurvatures<T, D>>::New(domain, type);
275 "Set levelset for which to calculate the curvatures.")
277 "Set which method to use for calculation: Defaults to mean "
280 "Curvatures will be calculated for all LS values < maxValue.")
282 "Perform normal vector calculation.");
285 py::class_<CalculateNormalVectors<T, D>,
286 SmartPointer<CalculateNormalVectors<T, D>>>(
287 module,
"CalculateNormalVectors")
295 "Set levelset for which to calculate normal vectors.")
297 "Perform normal vector calculation.");
300 py::class_<CalculateVisibilities<T, D>,
301 SmartPointer<CalculateVisibilities<T, D>>>(module,
302 "CalculateVisibilities")
305 SmartPointer<
Domain<T, D>> &,
const Vec3D<T> &, std::string>))
309 py::class_<Check<T, D>, SmartPointer<Check<T, D>>>(module,
"Check")
311 .def(py::init(&SmartPointer<
Check<T, D>>::template New<>))
312 .def(py::init(&SmartPointer<
Check<T, D>>::template New<
316 "Set levelset for which to calculate normal vectors.")
320 py::class_<PointCloud<T, D>, SmartPointer<PointCloud<T, D>>>(module,
324 const std::vector<VectorType<T, D>> &>))
326 .def(
"insertNextPoint",
331 py::class_<ConvexHull<T, D>, SmartPointer<ConvexHull<T, D>>>(module,
339 "Set mesh object where the generated mesh should be stored.")
341 "Set point cloud used to generate mesh.")
345 py::class_<DetectFeatures<T, D>, SmartPointer<DetectFeatures<T, D>>>(
346 module,
"DetectFeatures")
355 .def(py::init([](SmartPointer<
Domain<T, D>> &domain,
T maxValue,
357 return SmartPointer<DetectFeatures<T, D>>::New(domain, maxValue, type);
359 .def(
"setDetectionThreshold",
361 "Set the curvature value above which a point is considered a "
364 "Set which method to use to detect features. Defaults to Curvature.")
368 py::class_<GeometricAdvect<T, D>, SmartPointer<GeometricAdvect<T, D>>>(
369 module,
"GeometricAdvect")
379 "Set levelset to advect.")
381 "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 "Prepare the distribution for use with the passed level set.")
406 "Finalize the distribution after use with the level set.");
408 py::class_<SphereDistribution<T, D>, SmartPointer<SphereDistribution<T, D>>,
414 "Check whether passed point is inside the distribution.")
416 "Get the signed distance of the passed point to the surface of the "
419 "Get the cartesian bounds of the distribution.");
421 py::class_<BoxDistribution<T, D>, SmartPointer<BoxDistribution<T, D>>,
425 const std::array<T, 3>>))
428 "Check whether passed point is inside the distribution.")
430 "Get the signed distance of the passed point to the surface of the "
433 "Get the cartesian bounds of the distribution.");
435 py::class_<CustomSphereDistribution<T, D>,
436 SmartPointer<CustomSphereDistribution<T, D>>,
438 "CustomSphereDistribution")
441 const std::vector<T> &>))
444 "Check whether passed point is inside the distribution.")
445 .def(
"getSignedDistance",
447 "Get the signed distance of the passed point to the surface of the "
450 "Get the cartesian bounds of the distribution.");
453 py::class_<Expand<T, D>, SmartPointer<Expand<T, D>>>(module,
"Expand")
455 .def(py::init(&SmartPointer<
Expand<T, D>>::template New<>))
456 .def(py::init(&SmartPointer<
Expand<T, D>>::template New<
458 .def(py::init(&SmartPointer<
Expand<T, D>>::template New<
466 py::class_<FromSurfaceMesh<T, D>, SmartPointer<FromSurfaceMesh<T, D>>>(
467 module,
"FromSurfaceMesh")
477 "Set levelset to read into.")
479 "Set the mesh to read from.")
480 .def(
"setRemoveBoundaryTriangles",
483 "Set whether to include mesh elements outside of the simulation "
485 .def(
"setRemoveBoundaryTriangles",
488 "Set whether to include mesh elements outside of the simulation "
491 "Construct a levelset from a surface mesh.");
494 py::class_<FromVolumeMesh<T, D>, SmartPointer<FromVolumeMesh<T, D>>>(
495 module,
"FromVolumeMesh")
503 SmartPointer<
Mesh<T>> &,
bool>))
506 "Set the grid used to read in the level sets.")
508 "Set the mesh to read from.")
509 .def(
"setRemoveBoundaryTriangles",
511 "Set whether to include mesh elements outside of the simulation "
514 "Construct a levelset from a volume mesh.");
517 py::class_<FromMesh<T, D>, SmartPointer<FromMesh<T, D>>>(module,
"FromMesh")
527 py::class_<Sphere<T, D>, SmartPointer<Sphere<T, D>>>(module,
"Sphere")
529 .def(py::init(&SmartPointer<
Sphere<T, D>>::template New<
530 const std::vector<T> & ,
T >),
531 py::arg(
"origin"), py::arg(
"radius"));
533 py::class_<Plane<T, D>, SmartPointer<Plane<T, D>>>(module,
"Plane")
535 .def(py::init(&SmartPointer<
Plane<T, D>>::template New<
536 const std::vector<T> & ,
537 const std::vector<T> & >),
538 py::arg(
"origin"), py::arg(
"normal"));
540 py::class_<Box<T, D>, SmartPointer<Box<T, D>>>(module,
"Box")
542 .def(py::init(&SmartPointer<
Box<T, D>>::template New<
543 const std::vector<T> & ,
544 const std::vector<T> & >),
545 py::arg(
"minPoint"), py::arg(
"maxPoint"));
547 py::class_<Cylinder<T, D>, SmartPointer<Cylinder<T, D>>>(module,
"Cylinder")
551 const std::vector<T> & ,
552 const std::vector<T> & ,
const T ,
553 const T ,
const T >),
554 py::arg(
"origin"), py::arg(
"axisDirection"), py::arg(
"height"),
555 py::arg(
"radius"), py::arg(
"topRadius") = 0.);
558 py::class_<MakeGeometry<T, D>, SmartPointer<MakeGeometry<T, D>>>(
559 module,
"MakeGeometry")
579 "Set the levelset in which to create the geometry.")
595 .def(
"setIgnoreBoundaryConditions",
598 .def(
"setIgnoreBoundaryConditions",
604 py::class_<MarkVoidPoints<T, D>, SmartPointer<MarkVoidPoints<T, D>>>(
605 module,
"MarkVoidPoints")
614 "Set the levelset to mark void points in.")
615 .def(
"setReverseVoidDetection",
617 "Reverse the logic of detecting the top surface.")
618 .def(
"setDetectLargestSurface",
620 "Set that the top surface should be the one with the most connected "
623 "Set the logic by which to choose the surface which is non-void. "
624 "All other connected surfaces will then be marked as void points.")
626 "Save the connectivity information of all LS points in the "
627 "pointData of the level set.")
631 py::class_<Prune<T, D>, SmartPointer<Prune<T, D>>>(module,
"Prune")
633 .def(py::init(&SmartPointer<
Prune<T, D>>::template New<>))
634 .def(py::init(&SmartPointer<
Prune<T, D>>::template New<
641 py::class_<Reader<T, D>, SmartPointer<Reader<T, D>>>(module,
"Reader")
643 .def(py::init(&SmartPointer<
Reader<T, D>>::template New<>))
644 .def(py::init(&SmartPointer<
Reader<T, D>>::template New<
646 .def(py::init(&SmartPointer<
Reader<T, D>>::template New<
650 "Set levelset to write to file.")
652 "Set the filename for the output file.")
656 py::class_<Reduce<T, D>, SmartPointer<Reduce<T, D>>>(module,
"Reduce")
658 .def(py::init(&SmartPointer<
Reduce<T, D>>::template New<>))
659 .def(py::init(&SmartPointer<
Reduce<T, D>>::template New<
661 .def(py::init(&SmartPointer<
Reduce<T, D>>::template New<
663 .def(py::init(&SmartPointer<
Reduce<T, D>>::template New<
669 "Set whether the levelset should be segmented anew (balanced across "
670 "cores) after reduction.")
674 py::class_<RemoveStrayPoints<T, D>, SmartPointer<RemoveStrayPoints<T, D>>>(
675 module,
"RemoveStrayPoints")
682 "Set levelset for stray point removal.")
684 "Set the logic by which to choose the surface which should be kept. "
685 "All other LS values will be marked as stray points and removed.")
689 py::class_<ToDiskMesh<T, D>, SmartPointer<ToDiskMesh<T, D>>>(module,
697 "Set levelset to mesh.")
700 "Set the material map to use for the disk mesh.")
702 "Set the maximum level set value to include in the disk mesh.")
704 "Convert the levelset to a surface mesh.");
707 py::class_<ToMesh<T, D>, SmartPointer<ToMesh<T, D>>>(module,
"ToMesh")
709 .def(py::init(&SmartPointer<
ToMesh<T, D>>::template New<>))
710 .def(py::init(&SmartPointer<
ToMesh<T, D>>::template New<
715 .def(py::init(&SmartPointer<
ToMesh<T, D>>::template New<
722 "Set whether only defined points should be output to the mesh.")
724 "Set whether only level set points <0.5 should be output.")
726 "Convert the levelset to a surface mesh.");
729 py::class_<ToSurfaceMesh<T, D>, SmartPointer<ToSurfaceMesh<T, D>>>(
730 module,
"ToSurfaceMesh")
737 "Set levelset to mesh.")
739 "Set the mesh to generate.")
741 "Convert the levelset to a surface mesh.");
744 py::class_<ToMultiSurfaceMesh<T, D>, SmartPointer<ToMultiSurfaceMesh<T, D>>>(
745 module,
"ToMultiSurfaceMesh")
754 "Insert next level set to output in the mesh.")
756 "Set the mesh to generate.")
758 "Set the material map to use for the multi surface mesh.")
760 "Convert the levelset to a surface mesh.");
763 py::class_<ToVoxelMesh<T, D>, SmartPointer<ToVoxelMesh<T, D>>>(module,
776 "Insert next level set to output in the mesh.")
779 "Convert the levelset to a surface mesh.");
782 py::class_<Writer<T, D>, SmartPointer<Writer<T, D>>>(module,
"Writer")
784 .def(py::init(&SmartPointer<
Writer<T, D>>::template New<>))
785 .def(py::init(&SmartPointer<
Writer<T, D>>::template New<
787 .def(py::init(&SmartPointer<
Writer<T, D>>::template New<
791 "Set levelset to write to file.")
793 "Set the filename for the output file.")
797#ifdef VIENNALS_USE_VTK
798 py::class_<WriteVisualizationMesh<T, D>,
799 SmartPointer<WriteVisualizationMesh<T, D>>>(
800 module,
"WriteVisualizationMesh")
803 py::init(&SmartPointer<WriteVisualizationMesh<T, D>>::template New<>))
804 .def(py::init(&SmartPointer<WriteVisualizationMesh<T, D>>::template New<
807 .def(
"insertNextLevelSet",
808 &WriteVisualizationMesh<T, D>::insertNextLevelSet,
809 "Insert next level set to convert. Bigger level sets wrapping "
810 "smaller ones, should be inserted last.")
811 .def(
"setFileName", &WriteVisualizationMesh<T, D>::setFileName,
812 "Set Name of File to write.")
813 .def(
"setExtractHullMesh",
814 &WriteVisualizationMesh<T, D>::setExtractHullMesh,
815 "Whether to extract a hull mesh. Defaults to false.")
816 .def(
"setExtractVolumeMesh",
817 &WriteVisualizationMesh<T, D>::setExtractVolumeMesh,
818 " Whether to extract a tetra volume mesh. Defaults to true.")
819 .def(
"setMetaData", &WriteVisualizationMesh<T, D>::setMetaData,
820 "Set the metadata to be written to the file.")
822 py::overload_cast<const std::string &, T>(
823 &WriteVisualizationMesh<T, D>::addMetaData),
824 "Add a single metadata entry to the file.")
826 py::overload_cast<
const std::string &,
const std::vector<T> &>(
827 &WriteVisualizationMesh<T, D>::addMetaData),
828 "Add a single metadata entry to the file.")
831 const std::unordered_map<std::string, std::vector<T>> &>(
832 &WriteVisualizationMesh<T, D>::addMetaData),
833 "Add metadata to the file.")
834 .def(
"apply", &WriteVisualizationMesh<T, D>::apply,
835 "Make and write mesh.");
838 if constexpr (
D == 2) {
840 py::class_<CompareArea<T, D>, SmartPointer<CompareArea<T, D>>>(
841 module,
"CompareArea")
849 "Sets the target level set.")
851 "Sets the sample level set.")
853 "Set default increment value")
855 "Sets the x-range and custom increment value")
857 "Sets the y-range and custom increment value")
859 "Set the output mesh where difference areas will be stored")
861 "Returns the computed area mismatch.")
863 "Returns the computed area mismatch, with custom increments "
866 "Returns the number of cells where the level sets differ.")
868 "Returns the number of cells where the level sets differ, with "
869 "custom increments applied.")
871 "Computes the area difference between the two level sets.");
874 py::class_<CompareNarrowBand<T, D>, SmartPointer<CompareNarrowBand<T, D>>>(
875 module,
"CompareNarrowBand")
883 "Sets the target level set.")
885 "Sets the sample level set.")
887 "Set the x-coordinate range to restrict the comparison area")
889 "Set the y-coordinate range to restrict the comparison area")
891 "Clear the x-range restriction")
893 "Clear the y-range restriction")
895 "Set the output mesh where difference values will be stored")
896 .def(
"setOutputMeshSquaredDifferences",
898 "Set whether to output squared differences (true) or absolute "
899 "differences (false)")
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.")
911 "Calculate the root mean square error from previously computed "
915 py::class_<CompareSparseField<T, D>,
916 SmartPointer<CompareSparseField<T, D>>>(module,
917 "CompareSparseField")
924 .def(
"setLevelSetExpanded",
926 "Sets the expanded level set for comparison.")
927 .def(
"setLevelSetIterated",
929 "Sets the iterated level set to compare against the expanded one.")
931 "Set the x-coordinate range to restrict the comparison area")
933 "Set the y-coordinate range to restrict the comparison area")
935 "Clear the x-range restriction")
937 "Clear the y-range restriction")
939 "Set the output mesh where difference values will be stored")
940 .def(
"setFillIteratedWithDistances",
942 "Set whether to fill the iterated level set with distance values")
944 "Apply the comparison and calculate the sum of squared "
946 .def(
"getSumSquaredDifferences",
948 "Return the sum of squared differences calculated by apply().")
950 "Return the sum of absolute differences calculated by apply().")
952 "Return the number of points used in the comparison.")
953 .def(
"getNumSkippedPoints",
955 "Return the number of points skipped during comparison.")
957 "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:76
bool isInside(const vectorType &initial, const vectorType &candidate, double eps=0.) const override
Definition pyWrap.hpp:71
boundsType getBounds() const override
Sets bounds to the bounding box of the distribution.
Definition pyWrap.hpp:82
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:129
bool isInside(const Vec3D< viennahrle::CoordType > &initial, const Vec3D< viennahrle::CoordType > &candidate, double eps) const override
Quick check whether a point relative to the distributions center is inside the distribution....
Definition lsGeometricAdvectDistributions.hpp:136
std::array< viennahrle::CoordType, 6 > getBounds() const override
Sets bounds to the bounding box of the distribution.
Definition lsGeometricAdvectDistributions.hpp:159
T getSignedDistance(const Vec3D< viennahrle::CoordType > &initial, const Vec3D< viennahrle::CoordType > &candidate, unsigned long) const override
Returns the signed distance of a point relative to the distributions center. This is the signed manha...
Definition lsGeometricAdvectDistributions.hpp:148
Class describing a square box from one coordinate to another.
Definition lsGeometries.hpp:71
Definition lsCalculateCurvatures.hpp:24
void setCurvatureType(CurvatureEnum passedType)
Definition lsCalculateCurvatures.hpp:46
void setMaxValue(const T passedMaxValue)
Definition lsCalculateCurvatures.hpp:59
void apply()
Definition lsCalculateCurvatures.hpp:61
void setLevelSet(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsCalculateCurvatures.hpp:42
This algorithm is used to compute the normal vectors for all points with level set values <= maxValue...
Definition lsCalculateNormalVectors.hpp:35
void setLevelSet(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsCalculateNormalVectors.hpp:53
void apply()
Definition lsCalculateNormalVectors.hpp:82
Definition lsCalculateVisibilities.hpp:10
void apply()
Definition lsCalculateVisibilities.hpp:25
This class is used to find errors in the underlying level set structure, like invalid neighbours of d...
Definition lsCheck.hpp:22
void apply()
Definition lsCheck.hpp:78
void setLevelSet(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsCheck.hpp:66
Computes an estimate of the area where two level sets differ. The area is calculated by iterating thr...
Definition lsCompareArea.hpp: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
Definition lsGeometricAdvectDistributions.hpp:186
T getSignedDistance(const Vec3D< viennahrle::CoordType > &initial, const Vec3D< viennahrle::CoordType > &candidate, unsigned long pointId) const override
Returns the signed distance of a point relative to the distributions center. This is the signed manha...
Definition lsGeometricAdvectDistributions.hpp:199
std::array< viennahrle::CoordType, 6 > getBounds() const override
Sets bounds to the bounding box of the distribution.
Definition lsGeometricAdvectDistributions.hpp:243
Class describing a square box from one coordinate to another.
Definition lsGeometries.hpp:100
This class detects features of the level set function. This class offers two methods to determine fea...
Definition lsDetectFeatures.hpp:26
void apply()
Execute the algorithm.
Definition lsDetectFeatures.hpp:64
void setDetectionThreshold(T threshold)
Definition lsDetectFeatures.hpp:51
void setDetectionMethod(FeatureDetectionEnum passedMethod)
Set which algorithm to use to detect features. The curvature-based algorithm should always be preferr...
Definition lsDetectFeatures.hpp:59
Class containing all information about the level set, including the dimensions of the domain,...
Definition lsDomain.hpp:27
void clearMetaData()
Definition lsDomain.hpp:163
void deepCopy(const SmartPointer< Domain< T, D > > passedDomain)
copy all values of "passedDomain" to this Domain
Definition lsDomain.hpp:124
unsigned getNumberOfSegments() const
returns the number of segments, the levelset is split into. This is useful for algorithm parallelisat...
Definition lsDomain.hpp:153
void print(std::ostream &out=std::cout)
prints basic information and all memebers of the levelset structure
Definition lsDomain.hpp:178
int getLevelSetWidth() const
Definition lsDomain.hpp:158
unsigned getNumberOfPoints() const
returns the number of defined points
Definition lsDomain.hpp:156
void setLevelSetWidth(int width)
Definition lsDomain.hpp:160
Expands the levelSet to the specified number of layers. The largest value in the levelset is thus wid...
Definition lsExpand.hpp:17
void apply()
Apply the expansion to the specified width.
Definition lsExpand.hpp:44
void setWidth(int passedWidth)
Set how far the level set should be extended. Points with value width*0.5 will be added by this algor...
Definition lsExpand.hpp:37
void setLevelSet(SmartPointer< Domain< T, D > > passedlsDomain)
Definition lsExpand.hpp:31
Import the regular grid, on which the level set values are defined, from an explicit Mesh<>....
Definition lsFromMesh.hpp:16
void setMesh(const SmartPointer< Mesh< T > > passedMesh)
Definition lsFromMesh.hpp:34
void setSortPointList(bool passedSortPointList)
Definition lsFromMesh.hpp:36
void apply()
Definition lsFromMesh.hpp:40
Construct a level set from an explicit mesh.
Definition lsFromSurfaceMesh.hpp:15
void setRemoveBoundaryTriangles(bool passedRemoveBoundaryTriangles)
Set whether all triangles outside the domain should be ignored (=true) or whether boundary conditions...
Definition lsFromSurfaceMesh.hpp:227
void setLevelSet(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsFromSurfaceMesh.hpp:218
void apply()
Definition lsFromSurfaceMesh.hpp:243
void setMesh(SmartPointer< Mesh< T > > passedMesh)
Definition lsFromSurfaceMesh.hpp:222
This class creates a level set from a tetrahedral mesh. If the mesh contains a scalar data array call...
Definition lsFromVolumeMesh.hpp:22
typename Domain< T, D >::GridType GridType
Definition lsFromVolumeMesh.hpp:26
void apply()
Definition lsFromVolumeMesh.hpp:56
void setMesh(SmartPointer< Mesh< T > > passedMesh)
Definition lsFromVolumeMesh.hpp:48
void setGrid(const GridType &passedGrid)
Definition lsFromVolumeMesh.hpp:43
void setRemoveBoundaryTriangles(bool passedRemoveBoundaryTriangles)
Definition lsFromVolumeMesh.hpp:50
Base class for distributions used by lsGeometricAdvect. All functions are pure virtual and must be im...
Definition lsGeometricAdvectDistributions.hpp:15
virtual void prepare(SmartPointer< Domain< T, D > > domain)
Definition lsGeometricAdvectDistributions.hpp:43
virtual bool isInside(const Vec3D< viennahrle::CoordType > &initial, const Vec3D< viennahrle::CoordType > &candidate, double eps) const
Quick check whether a point relative to the distributions center is inside the distribution....
Definition lsGeometricAdvectDistributions.hpp:23
virtual T getSignedDistance(const Vec3D< viennahrle::CoordType > &initial, const Vec3D< viennahrle::CoordType > &candidate, unsigned long pointId) const =0
Returns the signed distance of a point relative to the distributions center. This is the signed manha...
virtual void finalize()
Definition lsGeometricAdvectDistributions.hpp:44
virtual std::array< viennahrle::CoordType, 6 > getBounds() const =0
Sets bounds to the bounding box of the distribution.
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:76
void apply()
Perform geometrical advection.
Definition lsGeometricAdvect.hpp:95
void setAdvectionDistribution(SmartPointer< GeometricAdvectDistribution< T, D > > passedDist)
Set which advection distribution to use. Must be derived from GeometricAdvectDistribution.
Definition lsGeometricAdvect.hpp:82
Create level sets describing basic geometric forms.
Definition lsMakeGeometry.hpp:27
void setIgnoreBoundaryConditions(bool passedIgnoreBoundaryConditions)
Ignore boundary conditions, meaning the parts of the generated geometry which are outside of the doma...
Definition lsMakeGeometry.hpp:129
void apply()
Definition lsMakeGeometry.hpp:146
void setLevelSet(SmartPointer< Domain< T, D > > passedlsDomain)
Definition lsMakeGeometry.hpp:87
void setGeometry(SmartPointer< Sphere< T, D > > passedSphere)
Set sphere as geometry to be created in the level set.
Definition lsMakeGeometry.hpp:92
This class is used to mark points of the level set which are enclosed in a void.
Definition lsMarkVoidPoints.hpp:28
void setLevelSet(SmartPointer< Domain< T, D > > passedlsDomain)
Definition lsMarkVoidPoints.hpp:94
void setReverseVoidDetection(bool passedReverseVoidDetection)
Set whether the "top" level set should be the most positive(default) connected chain of level set val...
Definition lsMarkVoidPoints.hpp:102
void apply()
Definition lsMarkVoidPoints.hpp:153
void setSaveComponentIds(bool scid)
Set whether the connected component IDs used to generate the void points should be saved....
Definition lsMarkVoidPoints.hpp:151
void setDetectLargestSurface(bool passedDetect)
Set whether the number of points of one connected surface should be used to detect void points....
Definition lsMarkVoidPoints.hpp:112
void setVoidTopSurface(VoidTopSurfaceEnum topSurface)
Set which connected component to use as the top surface and mark all other components as void points.
Definition lsMarkVoidPoints.hpp:118
This class holds an explicit mesh, which is always given in 3 dimensions. If it describes a 2D mesh,...
Definition lsMesh.hpp:22
Class describing a plane via a point in it and the plane normal.
Definition lsGeometries.hpp:42
Class describing a point cloud, which can be used to create geometries from its convex hull mesh.
Definition lsGeometries.hpp:145
void insertNextPoint(T *newPoint)
Definition lsGeometries.hpp:154
Removes all level set points, which do not have at least one oppositely signed neighbour (Meaning the...
Definition lsPrune.hpp:17
void apply()
removes all grid points, which do not have at least one opposite signed neighbour returns the number ...
Definition lsPrune.hpp:74
void setLevelSet(SmartPointer< Domain< T, D > > passedlsDomain)
Definition lsPrune.hpp:59
Definition lsReader.hpp:13
void setLevelSet(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsReader.hpp:26
void apply()
Definition lsReader.hpp:35
void setFileName(std::string passedFileName)
set file name for file to write
Definition lsReader.hpp:31
Reduce the level set size to the specified width. This means all level set points with value <= 0....
Definition lsReduce.hpp:14
void apply()
Reduces the leveleSet to the specified number of layers. The largest value in the levelset is thus wi...
Definition lsReduce.hpp:55
void setLevelSet(SmartPointer< Domain< T, D > > passedlsDomain)
Definition lsReduce.hpp:32
void setWidth(int passedWidth)
Set which level set points should be kept. All points with a level set value >0.5*width will be remov...
Definition lsReduce.hpp:39
void setNoNewSegment(bool passedNoNewSegment)
Set whether to segment the level set after algorithm is finished. This means points will be evenly di...
Definition lsReduce.hpp:44
This algorithm can be used to remove all LS values which are not part of a so-called top surface....
Definition lsRemoveStrayPoints.hpp:17
void setVoidTopSurface(VoidTopSurfaceEnum topSurface)
Set how the algorithm should pick the surface which will not be removed. Defaults to the surface with...
Definition lsRemoveStrayPoints.hpp:33
void apply()
Definition lsRemoveStrayPoints.hpp:37
void setLevelSet(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsRemoveStrayPoints.hpp:27
Concrete implementation of GeometricAdvectDistribution for a spherical advection distribution.
Definition lsGeometricAdvectDistributions.hpp:50
bool isInside(const Vec3D< viennahrle::CoordType > &initial, const Vec3D< viennahrle::CoordType > &candidate, double eps) const override
Quick check whether a point relative to the distributions center is inside the distribution....
Definition lsGeometricAdvectDistributions.hpp:60
std::array< viennahrle::CoordType, 6 > getBounds() const override
Sets bounds to the bounding box of the distribution.
Definition lsGeometricAdvectDistributions.hpp:110
T getSignedDistance(const Vec3D< viennahrle::CoordType > &initial, const Vec3D< viennahrle::CoordType > &candidate, unsigned long) const override
Returns the signed distance of a point relative to the distributions center. This is the signed manha...
Definition lsGeometricAdvectDistributions.hpp:75
Class describing a sphere via origin and radius.
Definition lsGeometries.hpp:15
This class creates a mesh from the level set with all grid points with a level set value <= 0....
Definition lsToDiskMesh.hpp:24
void setMesh(SmartPointer< Mesh< N > > passedMesh)
Definition lsToDiskMesh.hpp:70
void setMaterialMap(SmartPointer< MaterialMap > passedMaterialMap)
Definition lsToDiskMesh.hpp:77
void apply()
Definition lsToDiskMesh.hpp:83
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:79
void setMesh(SmartPointer< viennals::Mesh< T > > passedMesh)
Definition lsToMultiSurfaceMesh.hpp:71
void apply()
Definition lsToMultiSurfaceMesh.hpp:83
void insertNextLevelSet(SmartPointer< lsDomainType > passedLevelSet)
Definition lsToMultiSurfaceMesh.hpp:75
Extract an explicit Mesh<> instance from an lsDomain. The interface is then described by explicit sur...
Definition lsToSurfaceMesh.hpp:21
void setMesh(SmartPointer< Mesh< T > > passedMesh)
Definition lsToSurfaceMesh.hpp:41
void apply()
Definition lsToSurfaceMesh.hpp:45
void setLevelSet(SmartPointer< Domain< T, D > > passedlsDomain)
Definition lsToSurfaceMesh.hpp:37
Creates a mesh, which consists only of quads/hexas for completely filled grid cells in the level set....
Definition lsToVoxelMesh.hpp:20
void setMesh(SmartPointer< Mesh< T > > passedMesh)
Definition lsToVoxelMesh.hpp: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:87
PYBIND11_DECLARE_HOLDER_TYPE(TemplateType, SmartPointer< TemplateType >)