Loading...
Searching...
No Matches
Public Member Functions | List of all members
bitpit::LevelSet Class Reference

Level Set driver class. More...

Public Member Functions

 LevelSet (LevelSet &&other)=default
 
 LevelSet (LevelSetFillIn expectedFillIn=LevelSetFillIn::SPARSE)
 
int addObject (const std::unordered_set< long > &, int id=levelSetDefaults::OBJECT)
 
int addObject (const std::vector< long > &, long, bool, int id=levelSetDefaults::OBJECT)
 
template<typename LevelSetSourceObject = LevelSetObject>
int addObject (LevelSetBooleanOperation, const std::vector< int > &, int id=levelSetDefaults::OBJECT)
 
template<typename LevelSetSourceObject = LevelSetObject>
int addObject (LevelSetBooleanOperation, int, int, int id=levelSetDefaults::OBJECT)
 
int addObject (std::unique_ptr< LevelSetObject > &&)
 
int addObject (std::unique_ptr< SurfaceKernel > &&, double, int id=levelSetDefaults::OBJECT)
 
int addObject (std::unique_ptr< SurfUnstructured > &&, double, int id=levelSetDefaults::OBJECT)
 
int addObject (SurfaceKernel *, double, int id=levelSetDefaults::OBJECT)
 
int addObject (SurfaceKernel *, double, LevelSetSurfaceSmoothing, int id=levelSetDefaults::OBJECT)
 
int addObject (SurfUnstructured *, double, int id=levelSetDefaults::OBJECT)
 
int addObject (SurfUnstructured *, double, LevelSetSurfaceSmoothing, int id=levelSetDefaults::OBJECT)
 
template<typename LevelSetSourceObject = LevelSetObject>
int addObjectComplement (int, int id=levelSetDefaults::OBJECT)
 
 BITPIT_DEPRECATED_FOR (double getSizeNarrowBand() const, double getNarrowBandSize() const)
 
 BITPIT_DEPRECATED_FOR (void compute(), void evaluate())
 
 BITPIT_DEPRECATED_FOR (void compute(const std::vector< int > &ids), void evaluate(const std::vector< int > &ids))
 
 BITPIT_DEPRECATED_FOR (void compute(int id), void evaluate(int id))
 
 BITPIT_DEPRECATED_FOR (void setSizeNarrowBand(double size), void setNarrowBandSize(double size))
 
 BITPIT_DEPRECATED_FOR (void update(const std::vector< adaption::Info > &adaptionData, const std::vector< int > &ids), void update(const std::vector< adaption::Info > &adaptionData))
 
 BITPIT_DEPRECATED_FOR (void update(const std::vector< adaption::Info > &adaptionData, int id), void update(const std::vector< adaption::Info > &adaptionData))
 
void clear ()
 
void dump (std::ostream &) const
 
double getNarrowBandSize () const
 
LevelSetObjectgetObject (int) const
 
template<typename T >
T & getObject (int) const
 
int getObjectCount () const
 
std::vector< int > getObjectIds () const
 
LevelSetObjectgetObjectPtr (int) const
 
template<typename T >
T * getObjectPtr (int) const
 
std::vector< LevelSetObject * > getObjectPtrs () const
 
template<typename T >
std::vector< T * > getObjectPtrs () const
 
bool isObjectRemovable (int)
 
void partition (const std::vector< adaption::Info > &)
 
bool removeObject (int)
 
void removeObjects ()
 
void restore (std::istream &)
 
void setMesh (VolumeKernel *mesh)
 
void setNarrowBandSize (double size=0)
 
void setPropagateSign (bool)
 
void setSign (bool)
 
void update (const std::vector< adaption::Info > &adaptionData)
 

Detailed Description

Level Set driver class.

LevelSet is the main user interface class for computing signed- or unsigned- distance functions on Cartesian or Octree meshes with respect to geometrical objects. The user needs to define the computional kernel by calling setMesh() and the objects which define the zero levelset via addObject().

Evaluation of the fields inside the narrow band is always performed using an exact algorithm, on the other hand evaluation of the fields in the bulk can be performed choosing different algorithms.

With respect to the levelset value, the domain can be divided in two regions: the narrow band and the bulk. The narrow band defines the portion of the domain close to the zero-levelset iso surface whereas the bulk is everything else. Regardless of the specified narrow bans size, the narrow band will always contain the intersected cells and their neighbours.

LevelSet can use two types of storages: sparse or dense. When sparse storage is used, objects will only allocate space for storing information of cells that are inside the narrow band. Instead, when dense storage is used, objects will still evaluate information only for cells inside the narrow band, but they will allocate space for all cells of the mesh. If the narrow band covers a large portion of the domain, it will be more efficient to allocate space for all the cells of the mesh, rather than keep track of the cells inside the narrow band and store space only for those cells.

LevelSet will test if the underlying mesh can provide a MPI communicator. In case LevelSet is parallelized according the underlying mesh partitioning.

Examples
RBF_example_00001.cpp.

Definition at line 51 of file levelSet.hpp.

Constructor & Destructor Documentation

◆ LevelSet()

bitpit::LevelSet::LevelSet ( LevelSetFillIn expectedFillIn = LevelSetFillIn::SPARSE)

Default constructor

Definition at line 83 of file levelSet.cpp.

Member Function Documentation

◆ addObject() [1/11]

int bitpit::LevelSet::addObject ( const std::unordered_set< long > & list,
int id = levelSetDefaults::OBJECT )

Adds a LevelSetMask object composed of the external envelope of a list of mesh cells. Objects can be added to the levelset only after setting the mesh.

Parameters
[in]listlist of indices of cells
[in]idid to be assigned to object. In case default value is passed the insertion order will be used as identifier
Returns
identifier of new object

Definition at line 323 of file levelSet.cpp.

◆ addObject() [2/11]

int bitpit::LevelSet::addObject ( const std::vector< long > & list,
long refInterface,
bool invert,
int id = levelSetDefaults::OBJECT )

Adds a LevelSetMask object composed of a list of interfaces Objects can be added to the levelset only after setting the mesh.

Parameters
[in]listlist of indices of interfaces
[in]refInterfaceid of reference interface
[in]invertif orientation should be inverted with respect to the reference interface
[in]idid to be assigned to object. In case default value is passed the insertion order will be used as identifier
Returns
identifier of new object

Definition at line 341 of file levelSet.cpp.

◆ addObject() [3/11]

template<typename LevelSetSourceObject >
int bitpit::LevelSet::addObject ( LevelSetBooleanOperation operation,
const std::vector< int > & ids,
int id = levelSetDefaults::OBJECT )

Adds a boolean operation between that will be applied recursively to a series of objects Objects can be added to the levelset only after setting the mesh.

Parameters
[in]operationboolean operation
[in]idsvector with indices of operand objects
[in]idid to be assigned to object. In case default value is passed the insertion order will be used as identifier
Returns
identifier of new object

Definition at line 86 of file levelSet.tpp.

◆ addObject() [4/11]

template<typename LevelSetSourceObject >
int bitpit::LevelSet::addObject ( LevelSetBooleanOperation operation,
int id1,
int id2,
int id = levelSetDefaults::OBJECT )

Adds a boolean operation between two objects Objects can be added to the levelset only after setting the mesh.

Parameters
[in]operationboolean operation
[in]id1id of first operand
[in]id2id of second operand
[in]idid to be assigned to object. In case default value is passed the insertion order will be used as identifier
Returns
identifier of new object
Examples
RBF_example_00001.cpp.

Definition at line 60 of file levelSet.tpp.

◆ addObject() [5/11]

int bitpit::LevelSet::addObject ( std::unique_ptr< LevelSetObject > && object)

Adds a generic LevelSetObject Objects can be added to the levelset only after setting the mesh.

Parameters
[in]objectgeneric object
Returns
the index associated to the object

Definition at line 356 of file levelSet.cpp.

◆ addObject() [6/11]

int bitpit::LevelSet::addObject ( std::unique_ptr< SurfaceKernel > && segmentation,
double angle,
int id = levelSetDefaults::OBJECT )

Adds a segmentation object Objects can be added to the levelset only after setting the mesh.

Parameters
[in]segmentationsurface segmentation
[in]anglefeature angle
[in]ididentifier of object; in case no id is provided the insertion order will be used as identifier

Definition at line 263 of file levelSet.cpp.

◆ addObject() [7/11]

int bitpit::LevelSet::addObject ( std::unique_ptr< SurfUnstructured > && segmentation,
double angle,
int id = levelSetDefaults::OBJECT )

Adds a segmentation object Objects can be added to the levelset only after setting the mesh.

Parameters
[in]segmentationsurface segmentation
[in]anglefeature angle
[in]ididentifier of object; in case no id is provided the insertion order will be used as identifier

Definition at line 217 of file levelSet.cpp.

◆ addObject() [8/11]

int bitpit::LevelSet::addObject ( SurfaceKernel * segmentation,
double angle,
int id = levelSetDefaults::OBJECT )

Adds a segmentation object Objects can be added to the levelset only after setting the mesh.

Parameters
[in]segmentationsurface segmentation
[in]anglefeature angle
[in]ididentifier of object; in case no id is provided the insertion order will be used as identifier

Definition at line 283 of file levelSet.cpp.

◆ addObject() [9/11]

int bitpit::LevelSet::addObject ( SurfaceKernel * segmentation,
double angle,
LevelSetSurfaceSmoothing surfaceSmoothing,
int id = levelSetDefaults::OBJECT )

Adds a segmentation object Objects can be added to the levelset only after setting the mesh.

Parameters
[in]segmentationsurface segmentation
[in]anglefeature angle
[in]surfaceSmoothingis the given surface snoothing order
[in]ididentifier of object; in case no id is provided the insertion order will be used as identifier

Definition at line 304 of file levelSet.cpp.

◆ addObject() [10/11]

int bitpit::LevelSet::addObject ( SurfUnstructured * segmentation,
double angle,
int id = levelSetDefaults::OBJECT )

Adds a segmentation object Objects can be added to the levelset only after setting the mesh.

Parameters
[in]segmentationsurface segmentation
[in]anglefeature angle
[in]ididentifier of object; in case no id is provided the insertion order will be used as identifier

Definition at line 232 of file levelSet.cpp.

◆ addObject() [11/11]

int bitpit::LevelSet::addObject ( SurfUnstructured * segmentation,
double angle,
LevelSetSurfaceSmoothing surfaceSmoothing,
int id = levelSetDefaults::OBJECT )

Adds a segmentation object Objects can be added to the levelset only after setting the mesh.

Parameters
[in]segmentationsurface segmentation
[in]anglefeature angle
[in]surfaceSmoothingis the given surface snoothing order
[in]ididentifier of object; in case no id is provided the insertion order will be used as identifier

Definition at line 248 of file levelSet.cpp.

◆ addObjectComplement()

template<typename LevelSetSourceObject >
int bitpit::LevelSet::addObjectComplement ( int sourceId,
int id = levelSetDefaults::OBJECT )

Adds the complement of the specified object. Objects can be added to the levelset only after setting the mesh.

Parameters
[in]sourceIdid of source object
[in]idid to be assigned to object. In case default value is passed the insertion order will be used as identifier
Returns
identifier of new object

Definition at line 38 of file levelSet.tpp.

◆ clear()

void bitpit::LevelSet::clear ( )

Clear the levelset entirely, deleting kernel and objects

Definition at line 101 of file levelSet.cpp.

◆ dump()

void bitpit::LevelSet::dump ( std::ostream & stream) const

Writes LevelSetKernel to stream in binary format

Parameters
[in]streamoutput stream

Definition at line 616 of file levelSet.cpp.

◆ getNarrowBandSize()

double bitpit::LevelSet::getNarrowBandSize ( ) const

Get the size of the narrow band.

With respect to the levelset value, the domain can be divided in two regions: the narrow band and the bulk. The narrow band defines the portion of the domain close to the zero-levelset iso surface whereas the bulk is everything else.

The size of the narrow band is the absolute distance from the zero-levelset iso surface below which a point is considered belonging to the narrow band. Setting the size of the narrow band to LEVELSET_NARROW_BAND_UNLIMITED means that the whole domain belongs to the narrow band. Regardless of the specified size, the narrow band will always contain the intersected cells and their neighbours.

Returns
The size of the narrow band.

Definition at line 145 of file levelSet.cpp.

◆ getObject() [1/2]

LevelSetObject & bitpit::LevelSet::getObject ( int id) const

Get a constant reference to the specified object. If the specified id does not exist an exception is thrown.

Parameters
idis the object id
Returns
reference to levelset object
Examples
RBF_example_00001.cpp.

Definition at line 569 of file levelSet.cpp.

◆ getObject() [2/2]

template<typename T >
T & bitpit::LevelSet::getObject ( int id) const

Get a constant reference to the specified object. If the specified id does not exist an exception is thrown.

Parameters
idis the object id
Returns
reference to levelset object

Definition at line 110 of file levelSet.tpp.

◆ getObjectCount()

int bitpit::LevelSet::getObjectCount ( ) const

Get the number of levelset objects

Returns
number of objects

Definition at line 594 of file levelSet.cpp.

◆ getObjectIds()

std::vector< int > bitpit::LevelSet::getObjectIds ( ) const

Get the ids of the bodies.

Returns
a list of the body ids

Definition at line 602 of file levelSet.cpp.

◆ getObjectPtr() [1/2]

LevelSetObject * bitpit::LevelSet::getObjectPtr ( int id) const

Get a constant pointer to the specified object.

Parameters
idis the object id
Returns
pointer to levelset object

Definition at line 578 of file levelSet.cpp.

◆ getObjectPtr() [2/2]

template<typename T >
T * bitpit::LevelSet::getObjectPtr ( int id) const

Get a constant pointer to the specified object. If the specified id does not exist an exception is thrown.

Parameters
idis the object id
Returns
pointer to levelset object

Definition at line 121 of file levelSet.tpp.

◆ getObjectPtrs() [1/2]

std::vector< LevelSetObject * > bitpit::LevelSet::getObjectPtrs ( ) const

Get vector of pointers to all object.

Returns
vector of pointers to levelset objects

Definition at line 586 of file levelSet.cpp.

◆ getObjectPtrs() [2/2]

template<typename T >
std::vector< T * > bitpit::LevelSet::getObjectPtrs ( ) const

Get vector of pointers to all object.

Returns
vector of pointers to levelset objects

Definition at line 130 of file levelSet.tpp.

◆ isObjectRemovable()

bool bitpit::LevelSet::isObjectRemovable ( int id)

Check if an object can be deleted. Non-existent objects or objects that are sources for other objects cannot be deleted.

Parameters
[in]idid of object
Returns
true if object can be deleted

Definition at line 451 of file levelSet.cpp.

◆ partition()

void bitpit::LevelSet::partition ( const std::vector< adaption::Info > & adaptionData)

Updates the levelset after mesh partitioning.

Parameters
[in]adaptionDataare the information about the adaption

Definition at line 817 of file levelSet.cpp.

◆ removeObject()

bool bitpit::LevelSet::removeObject ( int id)

Remove a levelset object Objects that are sources for other objects cannot be deleted.

Parameters
[in]idid of object to be removed
Returns
true if object has been found and removed

Definition at line 416 of file levelSet.cpp.

◆ removeObjects()

void bitpit::LevelSet::removeObjects ( )

Remove all levelset objects

Definition at line 404 of file levelSet.cpp.

◆ restore()

void bitpit::LevelSet::restore ( std::istream & stream)

Reads LevelSetKernel from stream in binary format

Parameters
[in]streamoutput stream

Definition at line 636 of file levelSet.cpp.

◆ setMesh()

void bitpit::LevelSet::setMesh ( VolumeKernel * mesh)

Sets the mesh on which the levelset function should be computed.

Only cartesian, octree and unstructured patches are supported. If the specified mesh type is not among the supported types, an exception is thrown.

Parameters
[in]meshcomputational mesh
Examples
RBF_example_00001.cpp.

Definition at line 183 of file levelSet.cpp.

◆ setNarrowBandSize()

void bitpit::LevelSet::setNarrowBandSize ( double size = 0)

Set the size of the narrow band.

With respect to the levelset value, the domain can be divided in two regions: the narrow band and the bulk. The narrow band defines the portion of the domain close to the zero-levelset iso surface whereas the bulk is everything else.

The size of the narrow band is the absolute distance from the zero-levelset iso surface below which a point is considered belonging to the narrow band. Setting the size of the narrow band to LEVELSET_NARROW_BAND_UNLIMITED means that the whole domain belongs to the narrow band. Regardless of the specified size, the narrow band will always contain the intersected cells and their neighbours.

Parameters
[in]sizeis the size of the narrow band.
Examples
RBF_example_00001.cpp.

Definition at line 164 of file levelSet.cpp.

◆ setPropagateSign()

void bitpit::LevelSet::setPropagateSign ( bool flag)

Set if the levelset sign has to be propagated from the narrow band to the whole domain.

This function is provided only for compatibility with older versions of bitpit. It sets the bulk evaluation mode that matches the behaviour of the older levelset versions:

  • if sign propagation is enabled, the bulk evaluation mode is set to "sign propagation";
  • if sign propagation is disabled, the bulk evaluation mode is set to "none". The recommended way to setup sign propagation is to manually set the bulk evaluation mode of the relevant objects to "sign propagation".
Parameters
[in]flagTrue/false to active/disable the propagation .

Definition at line 673 of file levelSet.cpp.

◆ setSign()

void bitpit::LevelSet::setSign ( bool flag)

Set if the signed or unsigned levelset distance should be computed.

Parameters
[in]flagtrue/false for signed /unsigned levelset distance.

Definition at line 656 of file levelSet.cpp.

◆ update()

void bitpit::LevelSet::update ( const std::vector< adaption::Info > & adaptionData)

Updates the levelset a mesh update. Before being able to update the cached, it has to be filled. Levelset and associated information will be updated on both internal and ghost cells.

Parameters
[in]adaptionDataare the information about the adaption

Computes levelset on given mesh with respect to the specified object.

It is not possible to update the levelset for a specific objects, levelset will be computed for all the objects. This function is provided only for compatibility with older versions of bitpit.

Parameters
[in]adaptionDataare the information about the adaption
[in]ididentifier of object.

Computes levelset on given mesh with respect to the specified objects.

It is not possible to update the levelset for a specific objects, levelset will be computed for all the objects. This function is provided only for compatibility with older versions of bitpit.

Parameters
[in]adaptionDataare the information about the adaption
[in]idsidentifiers of objects.
Examples
RBF_example_00001.cpp.

Definition at line 113 of file levelSet.cpp.


The documentation for this class was generated from the following files:
--- layout: doxygen_footer ---