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 |
LevelSetObject & | getObject (int) const |
template<typename T > | |
T & | getObject (int) const |
int | getObjectCount () const |
std::vector< int > | getObjectIds () const |
LevelSetObject * | getObjectPtr (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) |
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.
Definition at line 51 of file levelSet.hpp.
bitpit::LevelSet::LevelSet | ( | LevelSetFillIn | expectedFillIn = LevelSetFillIn::SPARSE | ) |
Default constructor
Definition at line 83 of file levelSet.cpp.
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.
[in] | list | list of indices of cells |
[in] | id | id to be assigned to object. In case default value is passed the insertion order will be used as identifier |
Definition at line 323 of file levelSet.cpp.
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.
[in] | list | list of indices of interfaces |
[in] | refInterface | id of reference interface |
[in] | invert | if orientation should be inverted with respect to the reference interface |
[in] | id | id to be assigned to object. In case default value is passed the insertion order will be used as identifier |
Definition at line 341 of file levelSet.cpp.
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.
[in] | operation | boolean operation |
[in] | ids | vector with indices of operand objects |
[in] | id | id to be assigned to object. In case default value is passed the insertion order will be used as identifier |
Definition at line 86 of file levelSet.tpp.
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.
[in] | operation | boolean operation |
[in] | id1 | id of first operand |
[in] | id2 | id of second operand |
[in] | id | id to be assigned to object. In case default value is passed the insertion order will be used as identifier |
Definition at line 60 of file levelSet.tpp.
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.
[in] | object | generic object |
Definition at line 356 of file levelSet.cpp.
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.
[in] | segmentation | surface segmentation |
[in] | angle | feature angle |
[in] | id | identifier of object; in case no id is provided the insertion order will be used as identifier |
Definition at line 263 of file levelSet.cpp.
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.
[in] | segmentation | surface segmentation |
[in] | angle | feature angle |
[in] | id | identifier of object; in case no id is provided the insertion order will be used as identifier |
Definition at line 217 of file levelSet.cpp.
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.
[in] | segmentation | surface segmentation |
[in] | angle | feature angle |
[in] | id | identifier of object; in case no id is provided the insertion order will be used as identifier |
Definition at line 283 of file levelSet.cpp.
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.
[in] | segmentation | surface segmentation |
[in] | angle | feature angle |
[in] | surfaceSmoothing | is the given surface snoothing order |
[in] | id | identifier of object; in case no id is provided the insertion order will be used as identifier |
Definition at line 304 of file levelSet.cpp.
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.
[in] | segmentation | surface segmentation |
[in] | angle | feature angle |
[in] | id | identifier of object; in case no id is provided the insertion order will be used as identifier |
Definition at line 232 of file levelSet.cpp.
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.
[in] | segmentation | surface segmentation |
[in] | angle | feature angle |
[in] | surfaceSmoothing | is the given surface snoothing order |
[in] | id | identifier of object; in case no id is provided the insertion order will be used as identifier |
Definition at line 248 of file levelSet.cpp.
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.
[in] | sourceId | id of source object |
[in] | id | id to be assigned to object. In case default value is passed the insertion order will be used as identifier |
Definition at line 38 of file levelSet.tpp.
void bitpit::LevelSet::clear | ( | ) |
Clear the levelset entirely, deleting kernel and objects
Definition at line 101 of file levelSet.cpp.
void bitpit::LevelSet::dump | ( | std::ostream & | stream | ) | const |
Writes LevelSetKernel to stream in binary format
[in] | stream | output stream |
Definition at line 616 of file levelSet.cpp.
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.
Definition at line 145 of file levelSet.cpp.
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.
id | is the object id |
Definition at line 569 of file levelSet.cpp.
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.
id | is the object id |
Definition at line 110 of file levelSet.tpp.
int bitpit::LevelSet::getObjectCount | ( | ) | const |
Get the number of levelset objects
Definition at line 594 of file levelSet.cpp.
std::vector< int > bitpit::LevelSet::getObjectIds | ( | ) | const |
Get the ids of the bodies.
Definition at line 602 of file levelSet.cpp.
LevelSetObject * bitpit::LevelSet::getObjectPtr | ( | int | id | ) | const |
Get a constant pointer to the specified object.
id | is the object id |
Definition at line 578 of file levelSet.cpp.
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.
id | is the object id |
Definition at line 121 of file levelSet.tpp.
std::vector< LevelSetObject * > bitpit::LevelSet::getObjectPtrs | ( | ) | const |
Get vector of pointers to all object.
Definition at line 586 of file levelSet.cpp.
std::vector< T * > bitpit::LevelSet::getObjectPtrs | ( | ) | const |
Get vector of pointers to all object.
Definition at line 130 of file levelSet.tpp.
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.
[in] | id | id of object |
Definition at line 451 of file levelSet.cpp.
void bitpit::LevelSet::partition | ( | const std::vector< adaption::Info > & | adaptionData | ) |
Updates the levelset after mesh partitioning.
[in] | adaptionData | are the information about the adaption |
Definition at line 817 of file levelSet.cpp.
bool bitpit::LevelSet::removeObject | ( | int | id | ) |
Remove a levelset object Objects that are sources for other objects cannot be deleted.
[in] | id | id of object to be removed |
Definition at line 416 of file levelSet.cpp.
void bitpit::LevelSet::removeObjects | ( | ) |
Remove all levelset objects
Definition at line 404 of file levelSet.cpp.
void bitpit::LevelSet::restore | ( | std::istream & | stream | ) |
Reads LevelSetKernel from stream in binary format
[in] | stream | output stream |
Definition at line 636 of file levelSet.cpp.
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.
[in] | mesh | computational mesh |
Definition at line 183 of file levelSet.cpp.
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.
[in] | size | is the size of the narrow band. |
Definition at line 164 of file levelSet.cpp.
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:
[in] | flag | True/false to active/disable the propagation . |
Definition at line 673 of file levelSet.cpp.
void bitpit::LevelSet::setSign | ( | bool | flag | ) |
Set if the signed or unsigned levelset distance should be computed.
[in] | flag | true/false for signed /unsigned levelset distance. |
Definition at line 656 of file levelSet.cpp.
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.
[in] | adaptionData | are 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.
[in] | adaptionData | are the information about the adaption |
[in] | id | identifier 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.
[in] | adaptionData | are the information about the adaption |
[in] | ids | identifiers of objects. |
Definition at line 113 of file levelSet.cpp.