25# ifndef __BITPIT_LEVELSET_SEGMENTATION_OBJECT_HPP__
26# define __BITPIT_LEVELSET_SEGMENTATION_OBJECT_HPP__
28#include "levelSetCartesianKernel.hpp"
29#include "levelSetBooleanObject.hpp"
30#include "levelSetBooleanObject.tpp"
31#include "levelSetCommon.hpp"
32#include "levelSetComplementObject.hpp"
33#include "levelSetComplementObject.tpp"
34#include "levelSetKernel.hpp"
35#include "levelSetObject.hpp"
37#include "bitpit_common.hpp"
38#include "bitpit_surfunstructured.hpp"
39#include "bitpit_volcartesian.hpp"
40#include "bitpit_voloctree.hpp"
44# include <unordered_set>
45# include <unordered_map>
76 double evalDistance(
const std::array<double, 3> &point,
const SegmentConstIterator &segmentItr,
bool signedDistance, std::array<double, 3> *distanceVector)
const;
83 void evalProjection(
const std::array<double, 3> &point,
const SegmentConstIterator &segmentItr, std::array<double, 3> *projectionPoint, std::array<double, 3> *projectionNormal)
const;
88 typedef std::pair<long, int> SegmentVertexKey;
91 std::unique_ptr<const SurfUnstructured> m_ownedSurface;
92 double m_featureAngle;
95 std::unique_ptr<SurfaceSkdTree> m_searchTree;
103 mutable std::vector<bool> m_limitedSegmentVertexNormalValid;
106 void evalProjectionOnVertex(
const std::array<double, 3> &point,
const SegmentConstIterator &segmentItr, std::array<double, 3> *projectionPoint, std::array<double, 3> *projectionNormal)
const;
107 void evalHighOrderProjectionOnLine(
const std::array<double, 3> &point,
const SegmentConstIterator &segmentItr, std::array<double, 3> *projectionPoint, std::array<double, 3> *projectionNormal)
const;
108 void evalHighOrderProjectionOnTriangle(
const std::array<double, 3> &point,
const SegmentConstIterator &segmentItr, std::array<double, 3> *projectionPoint, std::array<double, 3> *projectionNormal)
const;
109 void evalHighOrderProjectionOnPolygon(
const std::array<double, 3> &point,
const SegmentConstIterator &segmentItr, std::array<double, 3> *projectionPoint, std::array<double, 3> *projectionNormal)
const;
110 void evalHighOrderProjection(
const std::array<double, 3> &point,
const SegmentConstIterator &segmentItr, std::array<double, 3> *projectionPoint, std::array<double, 3> *projectionNormal)
const;
112 void evalLowOrderProjectionOnLine(
const std::array<double, 3> &point,
const SegmentConstIterator &segmentItr, std::array<double, 3> *projectionPoint, std::array<double, 3> *projectionNormal)
const;
113 void evalLowOrderProjectionOnTriangle(
const std::array<double, 3> &point,
const SegmentConstIterator &segmentItr, std::array<double, 3> *projectionPoint, std::array<double, 3> *projectionNormal)
const;
114 void evalLowOrderProjectionOnPolygon(
const std::array<double, 3> &point,
const SegmentConstIterator &segmentItr, std::array<double, 3> *projectionPoint, std::array<double, 3> *projectionNormal)
const;
115 void evalLowOrderProjection(
const std::array<double, 3> &point,
const SegmentConstIterator &segmentItr, std::array<double, 3> *projectionPoint, std::array<double, 3> *projectionNormal)
const;
121 std::array<double,3> computeSegmentEdgeNormal(
const SegmentConstIterator &segmentItr,
int edge,
bool limited )
const;
140 std::array<double,3>
evalCellNormal(
long id,
bool signedLevelSet)
const;
143 long evalSupport(
const std::array<double,3> &point)
const;
144 long evalSupport(
const std::array<double,3> &point,
double searchRadius)
const;
145 int evalPart(
const std::array<double,3> &point)
const;
146 std::array<double,3>
evalNormal(
const std::array<double,3> &point,
bool signedLevelSet)
const;
147 void evalProjection(
const std::array<double,3> &point,
bool signedLevelSet, std::array<double, 3> *projectionPoint, std::array<double, 3> *projectionNormal)
const;
171 virtual std::array<double,3> _evalCellNormal(
long id,
bool signedLevelSet)
const = 0;
174 virtual const SurfUnstructured & _evalSurface(
const std::array<double,3> &point)
const = 0;
175 virtual int _evalPart(
const std::array<double,3> &point)
const;
176 virtual long _evalSupport(
const std::array<double,3> &point)
const = 0;
177 virtual long _evalSupport(
const std::array<double,3> &point,
double searchRadius)
const = 0;
178 virtual void _evalProjection(
const std::array<double,3> &point,
bool signedLevelSet, std::array<double, 3> *projectionPoint, std::array<double, 3> *projectionNormal)
const = 0;
196 bool empty()
const override;
201 void setSurface(std::unique_ptr<const SurfUnstructured> &&surface,
bool force =
false);
202 void setSurface(std::unique_ptr<const SurfUnstructured> &&surface,
double featureAngle,
bool force =
false);
221 double _evalCellValue(
long id,
bool signedLevelSet)
const override;
222 std::array<double,3>
_evalCellGradient(
long id,
bool signedLevelSet)
const override;
225 std::array<double,3>
_evalCellNormal(
long id,
bool signedLevelSet)
const override;
227 short _evalSign(
const std::array<double,3> &point)
const override;
228 double _evalValue(
const std::array<double,3> &point,
bool signedLevelSet)
const override;
229 std::array<double,3>
_evalGradient(
const std::array<double,3> &point,
bool signedLevelSet)
const override;
231 long _evalSupport(
const std::array<double,3> &point)
const override;
232 long _evalSupport(
const std::array<double,3> &point,
double searchRadius)
const override;
233 void _evalProjection(
const std::array<double,3> &point,
bool signedLevelSet, std::array<double, 3> *projectionPoint, std::array<double, 3> *projectionNormal)
const override;
236 std::unique_ptr<LevelSetSegmentationSurfaceInfo> m_surfaceInfo;
238 void fillCartesianCellZoneCache();
240 short _evalSign(
const std::array<double,3> &point,
long support)
const;
241 double _evalValue(
const std::array<double,3> &point,
long support,
bool signedLevelSet)
const;
242 std::array<double,3>
_evalGradient(
const std::array<double,3> &point,
long support,
bool signedLevelSet)
const;
243 void _evalProjection(
const std::array<double,3> &point,
long support,
bool signedLevelSet, std::array<double, 3> *projectionPoint, std::array<double, 3> *projectionNormal)
const;
258 long _evalCellSupport(
long id,
double searchRadius = AUTOMATIC_SEARCH_RADIUS)
const override;
259 int _evalCellPart(
long id)
const override;
260 std::array<double,3> _evalCellNormal(
long id,
bool signedLevelSet)
const override;
262 const SurfUnstructured & _evalSurface(
const std::array<double,3> &point)
const override;
263 long _evalSupport(
const std::array<double,3> &point)
const override;
264 long _evalSupport(
const std::array<double,3> &point,
double searchRadius)
const override;
265 int _evalPart(
const std::array<double,3> &point)
const override;
266 void _evalProjection(
const std::array<double,3> &point,
bool signedLevelSet, std::array<double, 3> *projectionPoint, std::array<double, 3> *projectionNormal)
const override;
280 long _evalCellSupport(
long id,
double searchRadius = AUTOMATIC_SEARCH_RADIUS)
const override;
281 int _evalCellPart(
long id)
const override;
282 std::array<double,3> _evalCellNormal(
long id,
bool signedLevelSet)
const override;
284 const SurfUnstructured & _evalSurface(
const std::array<double,3> &point)
const override;
285 long _evalSupport(
const std::array<double,3> &point)
const override;
286 long _evalSupport(
const std::array<double,3> &point,
double searchRadius)
const override;
287 int _evalPart(
const std::array<double,3> &point)
const override;
288 void _evalProjection(
const std::array<double,3> &point,
bool signedLevelSet, std::array<double, 3> *projectionPoint, std::array<double, 3> *projectionNormal)
const override;
Base class which deals with boolean operation between two LevelSetObjects.
Class which deals with boolean operation between two LevelSetObjects.
static const std::size_t NULL_CACHE_ID
Base class that allows to evaluate the complement of a LevelSetObjects.
Class that allows to evaluate the complement of a LevelSetObjects.
Interface class for all objects with respect to whom the levelset function may be computed.
void fillFieldCellCache(LevelSetField field, const std::vector< long > &cellIds)
virtual void flushVTKOutputData(std::fstream &stream, VTKFormat format, LevelSetField field) const
virtual std::size_t createFieldCellCache(LevelSetField field, std::size_t cacheId=CellCacheCollection::NULL_CACHE_ID)
Implements visitor pattern fo segmentated geometries.
void evalProjection(const std::array< double, 3 > &point, bool signedLevelSet, std::array< double, 3 > *projectionPoint, std::array< double, 3 > *projectionNormal) const
void fillFieldCellCache(LevelSetField field, long id) override
void flushVTKOutputData(std::fstream &stream, VTKFormat format, LevelSetField field) const override
std::array< double, 3 > evalNormal(const std::array< double, 3 > &point, bool signedLevelSet) const
long getSupport(long cellId) const
const SurfUnstructured & evalSurface(const std::array< double, 3 > &point) const
LevelSetFieldset getSupportedFields() const override
std::array< double BITPIT_COMMA 3 > getNormal(long cellId) const
LevelSetIntersectionStatus _intersectSurface(long, double distance, LevelSetIntersectionMode=LevelSetIntersectionMode::FAST_FUZZY) const override
virtual int _evalPart(const std::array< double, 3 > &point) const
void addVTKOutputData(LevelSetField field, const std::string &objectName) override
int getPart(long cellId) const
std::array< double, 3 > evalCellNormal(long id, bool signedLevelSet) const
double getSurfaceFeatureSize(long cellId) const
virtual int _evalCellPart(long id) const
std::size_t createFieldCellCache(LevelSetField field, std::size_t cacheId=CellCacheCollection::NULL_CACHE_ID) override
int evalPart(const std::array< double, 3 > &point) const
long evalCellSupport(long id, double searchRadius=AUTOMATIC_SEARCH_RADIUS) const
int evalCellPart(long id) const
static BITPIT_PUBLIC_API const double AUTOMATIC_SEARCH_RADIUS
long evalSupport(const std::array< double, 3 > &point) const
const SurfUnstructured & evalCellSurface(long id) const
std::string getVTKOutputFieldName(LevelSetField field) const override
Implements visitor pattern fo segmentated geometries.
const SurfUnstructured & _evalSurface(const std::array< double, 3 > &point) const override
double getMaxSurfaceFeatureSize() const
LevelSetSegmentationObject * clone() const override
long _evalCellSupport(long id, double searchRadius=AUTOMATIC_SEARCH_RADIUS) const override
LevelSetCellLocation fillCellGeometricNarrowBandLocationCache(long id) override
long _evalSupport(const std::array< double, 3 > &point) const override
short _evalSign(const std::array< double, 3 > &point) const override
std::array< double, 3 > _evalGradient(const std::array< double, 3 > &point, bool signedLevelSet) const override
double _evalCellValue(long id, bool signedLevelSet) const override
bool empty() const override
std::array< double, 3 > _evalCellGradient(long id, bool signedLevelSet) const override
void fillCellLocationCache() override
LevelSetSurfaceSmoothing getSurfaceSmoothing() const
LevelSetSegmentationObject(int)
short _evalCellSign(long id) const override
double _evalValue(const std::array< double, 3 > &point, bool signedLevelSet) const override
void setSurface(std::unique_ptr< const SurfUnstructured > &&surface, bool force=false)
double getMinSurfaceFeatureSize() const
const SurfUnstructured & getSurface() const
std::array< double, 3 > _evalCellNormal(long id, bool signedLevelSet) const override
const SurfUnstructured & _evalCellSurface(long id) const override
double getFeatureAngle() const
void _evalProjection(const std::array< double, 3 > &point, bool signedLevelSet, std::array< double, 3 > *projectionPoint, std::array< double, 3 > *projectionNormal) const override
const SurfaceSkdTree & getSearchTree() const
void evalProjection(const std::array< double, 3 > &point, const SegmentConstIterator &segmentItr, std::array< double, 3 > *projectionPoint, std::array< double, 3 > *projectionNormal) const
double evalDistance(const std::array< double, 3 > &point, const SegmentConstIterator &segmentItr, bool signedDistance, std::array< double, 3 > *distanceVector) const
const SurfaceSkdTree & getSearchTree() const
const SurfUnstructured & getSurface() const
std::array< double, 3 > evalDistanceVector(const std::array< double, 3 > &point, const SegmentConstIterator &segmentItr) const
void setSurface(std::unique_ptr< const SurfUnstructured > &&surface, double featureAngle=DEFAULT_FEATURE_ANGLE)
std::array< double, 3 > evalNormal(const std::array< double, 3 > &point, const SegmentConstIterator &segmentItr) const
double getFeatureAngle() const
static BITPIT_PUBLIC_API const double DEFAULT_FEATURE_ANGLE
LevelSetSurfaceSmoothing getSurfaceSmoothing() const
std::array< double, 3 > evalPseudoNormal(const SurfUnstructured::CellConstIterator &segmentIterator, const double *lambda) const
LevelSetSegmentationSurfaceInfo()
Iterator for the class PiercedStorage.
Metafunction for generating a pierced storage.
The SurfUnstructured class defines an unstructured surface triangulation.
The SurfaceSkdTree implements a Bounding Volume Hierarchy tree for surface patches.
#define BITPIT_DEPRECATED(func)
LevelSetIntersectionStatus