8using namespace viennacore;
18 SmartPointer<Domain<T, D>> levelSet =
nullptr;
25 : levelSet(passedLevelSet) {}
28 levelSet = passedLevelSet;
34 voidTopSurface = topSurface;
38 if (levelSet ==
nullptr) {
40 .addWarning(
"No level set was passed to lsPrune.")
44 if (levelSet->getNumberOfPoints() == 0) {
57 levelSet->getPointData().getScalarData(
"VoidPointMarkers",
true);
58 if (voidMarkers ==
nullptr) {
60 .addWarning(
"RemoveStrayPoints: No scalar data for void point "
61 "markers found. Cannot remove stray points.")
66 auto &grid = levelSet->getGrid();
67 auto newlsDomain = SmartPointer<Domain<T, D>>::New(grid);
71 newDomain.initialize(domain.getNewSegmentation(), domain.getAllocation());
73 std::vector<typename Domain<T, D>::PointValueVectorType> newPoints;
76#pragma omp parallel num_threads(newDomain.getNumberOfSegments())
80 p = omp_get_thread_num();
83 auto &domainSegment = newDomain.getDomainSegment(p);
85 hrleVectorType<hrleIndexType, D> startVector =
86 (p == 0) ? grid.getMinGridPoint()
87 : newDomain.getSegmentation()[p - 1];
89 hrleVectorType<hrleIndexType, D> endVector =
91 ? newDomain.getSegmentation()[p]
92 : grid.incrementIndices(grid.getMaxGridPoint());
96 it.getStartIndices() < endVector; it.next()) {
97 if (it.isDefined() && !voidMarkers->at(it.getPointId())) {
98 newPoints[p].push_back(
99 std::make_pair(it.getStartIndices(), it.getValue()));
106 newPoints[0].insert(newPoints[0].end(), newPoints[i].begin(),
116 levelSet->finalize(2);
Class containing all information about the level set, including the dimensions of the domain,...
Definition lsDomain.hpp:28
void deepCopy(const SmartPointer< Domain< T, D > > passedDomain)
copy all values of "passedDomain" to this Domain
Definition lsDomain.hpp:121
unsigned getNumberOfSegments() const
returns the number of segments, the levelset is split into. This is useful for algorithm parallelisat...
Definition lsDomain.hpp:150
hrleDomain< T, D > DomainType
Definition lsDomain.hpp:33
void finalize(int newWidth)
this function sets a new levelset width and finalizes the levelset, so it is ready for use by other a...
Definition lsDomain.hpp:114
void insertPoints(PointValueVectorType pointData, bool sort=true)
re-initalise Domain with the point/value pairs in pointData This is similar to lsFromMesh with the di...
Definition lsDomain.hpp:132
This class is used to mark points of the level set which are enclosed in a void.
Definition lsMarkVoidPoints.hpp:30
void setLevelSet(SmartPointer< Domain< T, D > > passedlsDomain)
Definition lsMarkVoidPoints.hpp:95
void apply()
Definition lsMarkVoidPoints.hpp:154
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
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
RemoveStrayPoints()
Definition lsRemoveStrayPoints.hpp:22
RemoveStrayPoints(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsRemoveStrayPoints.hpp:24
void apply()
Definition lsRemoveStrayPoints.hpp:37
void setLevelSet(SmartPointer< Domain< T, D > > passedLevelSet)
Definition lsRemoveStrayPoints.hpp:27
Definition lsAdvect.hpp:46
VoidTopSurfaceEnum
Enumeration describing which connected component to use as top surface during void point detection....
Definition lsMarkVoidPoints.hpp:21