![]() |
OpenLB 1.7
|
Representation of a block geometry. More...
#include <blockGeometry.h>
Public Member Functions | |
BlockGeometry (Cuboid< T, D > &cuboid, int padding, int iCglob=-1) | |
Platform | getPlatform () const |
const BlockGeometryStatistics< T, D > & | getStatistics () const |
Read only access to the associated block statistic. | |
BlockGeometryStatistics< T, D > & | getStatistics () |
Write access to the associated block statistic. | |
bool | hasCommunicatable (std::type_index field) const |
auto & | getCommunicatable (std::type_index field) |
int | getIcGlob () const |
Read only access to the global iC number which is given !=-1 if the block geometries are part of a super geometry. | |
Vector< int, D > | getExtent () const |
Returns the extend of the block in lattice units. | |
Vector< T, D > | getOrigin () const |
Read only access to the origin position given in SI units (meter) | |
T | getDeltaR () const |
Read only access to the voxel size given in SI units (meter) | |
template<typename... L> | |
std::enable_if_t< sizeof...(L)==D, int > | get (L... latticeR) const |
Read-only access to a material number. | |
int | get (LatticeR< D > latticeR) const |
int | get (const int latticeR[D]) const |
int | get (std::size_t iCell) const |
int | getMaterial (LatticeR< D > latticeR) const |
returns the (iX,iY) entry in the 2D scalar field | |
int | getMaterial (const int latticeR[D]) const |
template<typename... L> | |
std::enable_if_t< sizeof...(L)==D, int > | getMaterial (L... latticeR) const |
void | set (LatticeR< D > latticeR, int material) |
Write access to a material number. | |
void | set (const int latticeR[D], int material) |
void | set (std::size_t iCell, int material) |
Vector< T, D > | getPhysR (LatticeR< D > latticeR) |
void | getPhysR (T physR[D], const int latticeR[D]) const |
Transforms lattice to physical coordinates (wrapped from cuboid geometry) | |
void | getPhysR (T physR[D], LatticeR< D > latticeR) const |
Cuboid< T, D > & | getCuboid () |
const Cuboid< T, D > & | getCuboid () const |
template<typename... L> | |
std::enable_if_t< sizeof...(L)==D, void > | get (T physR[D], L... latticeR) const |
template<typename DESCRIPTOR = std::conditional_t<D==2,descriptors::D2Q9<>,descriptors::D3Q27<>>> | |
int | clean (bool verbose=true, std::vector< int > bulkMaterials={1}) |
Changes all cell materials which are not in bulkMaterials to 0 if there is no neighbour from bulkMaterials. | |
int | outerClean (bool verbose=true, std::vector< int > bulkMaterials={1}) |
Changes all cell materials from bulkMaterials to 0 if there is a neighbour with material 0. | |
int | innerClean (bool verbose=true) |
Changes all cell materials which are not 0 or 1 to 1 if there is a non robust constiallation. | |
int | innerClean (int fromM, bool verbose=true) |
Changes all cells with material fromM to 1 if there is a non robust constiallation. | |
void | reset (IndicatorF< T, D > &domain) |
Resets all cell materials inside of a domain to 0. | |
bool | find (int material, std::vector< unsigned > offset, std::vector< int > var) |
Returns the coordinates (iX,iY) of a voxel with a given material number (material) if there exists an neighbourhood of size (offsetX,offsetY) only with voxels of the given material number. | |
bool | check (int material, std::vector< int > var, std::vector< unsigned > offset) |
Returns true if at position (iX,iY) and in a neighbourhood of size (offsetX,offsetY) only voxels with a given material number (material) are there. | |
bool | checkForErrors (bool verbose=true) const |
Checks for errors (searches for all outer voxels (=0) with an inner voxel (=1) as a direct neighbour) | |
void | rename (int fromM, int toM) |
Replaces all material numbers (fromM) to another (toM) | |
void | rename (int fromM, int toM, IndicatorF< T, D > &condition) |
Replaces all material numbers (fromM) to another (toM) if an indicator functor condition is fulfilled. | |
void | rename (int fromM, int toM, LatticeR< D > offset) |
Replaces all material numbers (fromM) to another (toM) if all materials in the neighbourhood (iX-offsetX,..,iX,..,ix+offsetX), .. are of the original material number (fromM) | |
void | rename (int fromM, int toM, int testM, std::vector< int > testDirection) |
Replaces all material numbers (fromM) to another (toM) if all materials in the neighbourhood (iX+1,iX+2,..,ix+testDirection[0]), .. are of another material number (testM) | |
void | rename (int fromM, int toM, int fluidM, IndicatorF< T, D > &condition, Vector< int, D > discreteNormal) |
Replaces all material numbers (fromM) to another (toM) if all materials in the neighbourhood (iX+discreteNormal[0],iX+2*discreteNormal[0]), .. are of another material number (testM) and if an indicator functor condition is fulfilled. | |
void | rename (int fromM, int toM, int fluidM, IndicatorF< T, D > &condition) |
Replaces all material numbers (fromM) to another (toM) if all materials in the neighbourhood (iX+discreteNormal[0],iX+2*discreteNormal[0]), .. are of another material number (fluidM) and if an indicator functor condition is fulfilled, the discreteNormal is computed from all fromM which fulfill the indicator functor condition. | |
void | copyMaterialLayer (IndicatorF3D< T > &condition, int discreteNormal[D], int numberOfLayers) |
Copy a layer of material numbers inside an indicator in a discrete normal direction. | |
void | regionGrowing (int fromM, int toM, LatticeR< D > seed, std::vector< int > offset, std::map< std::vector< int >, int > *tmp=nullptr) |
Replaces all material numbers (fromM) to another (toM) using a seed point and max. directions indicated by offsetX,Y != 0. | |
void | printLayer (std::vector< int > min, std::vector< int > max, bool linenumber=false) |
Prints a chosen part of the block geometry. | |
void | printLayer (int direction, int layer, bool linenumber=false) |
Prints a chosen part of the block geometry. | |
void | printNode (std::vector< int > loc) |
Prints a chosen node and its neighbourhood. | |
std::size_t | getNblock () const override |
Number of data blocks for the serializable interface. | |
std::size_t | getSerializableSize () const override |
Binary size for the serializer. | |
bool * | getBlock (std::size_t iBlock, std::size_t &sizeBlock, bool loadingMode) override |
Return a pointer to the memory of the current block and its size for the serializable interface. | |
![]() | |
BlockStructureD (Vector< int, D > size, int padding=0) | |
BlockStructureD () | |
int | getNx () const |
Read only access to block width. | |
int | getNy () const |
Read only access to block height. | |
int | getNz () const |
Read only access to block height. | |
LatticeR< D > | getExtent () const |
int | getPadding () const |
Read only access to padding. | |
std::size_t | getNcells () const |
Get number of cells. | |
CellID | getCellId (LatticeR< D > latticeR) const |
Get 1D cell ID. | |
template<typename... L> | |
std::enable_if_t< sizeof...(L)==D, CellID > | getCellId (L... latticeR) const |
CellDistance | getNeighborDistance (LatticeR< D > dir) const |
Get 1D neighbor distance. | |
bool | isInside (LatticeR< D > latticeR) const |
Return whether location is valid. | |
bool | isInsideCore (LatticeR< D > latticeR) const |
Return whether location is inside core. | |
bool | isPadding (LatticeR< D > latticeR) const |
Return whether location is valid. | |
template<typename... L> | |
std::enable_if_t< sizeof...(L)==D, bool > | isInside (L... latticeR) const |
CellDistance | getNeighborhoodRadius (LatticeR< D > latticeR) const |
Return maximum valid neighborhood sphere radius w.r.t. latticeR. | |
template<typename F > | |
void | forSpatialLocations (F f) const |
template<typename F > | |
void | forSpatialLocationsParallel (F f) const |
template<typename F > | |
void | forSpatialLocations (LatticeR< D > min, LatticeR< D > max, F f) const |
template<typename F > | |
void | forCoreSpatialLocations (F f) const |
template<typename F > | |
void | forCellIndices (F f) const |
![]() | |
virtual | ~Serializable ()=default |
template<bool includeLogOutputDir = true> | |
bool | save (std::string fileName="", const bool enforceUint=false) |
Save Serializable into file fileName | |
template<bool includeLogOutputDir = true> | |
bool | load (std::string fileName="", const bool enforceUint=false) |
Load Serializable from file fileName | |
bool | save (std::uint8_t *buffer) |
Save Serializable into buffer of length getSerializableSize | |
bool | load (const std::uint8_t *buffer) |
Load Serializable from buffer of length getSerializableSize | |
virtual void | postLoad () |
Static Public Attributes | |
static constexpr Platform | platform = Platform::CPU_SISD |
Additional Inherited Members | |
![]() | |
template<typename DataType > | |
void | registerVar (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t ¤tBlock, bool *&dataPtr, const DataType &data, const size_t arrayLength=1) const |
Register primitive data types (int , double , ...) or arrays of those. | |
template<typename DataType > | |
void | registerSerializableOfConstSize (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t ¤tBlock, bool *&dataPtr, DataType &data, const bool loadingMode=false) |
Register Serializable object of constant size. | |
template<typename DataType > | |
void | registerSerializablesOfConstSize (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t ¤tBlock, bool *&dataPtr, DataType *data, const size_t arrayLength, const bool loadingMode=false) |
Register an array of Serializable objects of constant size. | |
![]() | |
LatticeR< D > | _core |
LatticeR< D > | _size |
LatticeR< D > | _projection |
int | _padding |
Representation of a block geometry.
Representation of a statistic for a 3D geometry.
Representation of a statistic for a 2D geometry.
This class is derived from block geometry structure. It holds the actual data with the materials. It stores pointers to all dependent block geometry views. It presents a volume of voxels where different types are given my material numbers which is important e.g. to work with different boundaries (like for inflow/output regions).
A block geomety statistic computes different integral values, like total number of different materials, materials of any kind, min./max. physical position, of an underlying block geoemtry structure.
This class is not intended to be derived from.
Definition at line 55 of file blockGeometry.h.
olb::BlockGeometry< T, D >::BlockGeometry | ( | Cuboid< T, D > & | cuboid, |
int | padding, | ||
int | iCglob = -1 ) |
Definition at line 44 of file blockGeometry.hh.
bool olb::BlockGeometry< T, D >::check | ( | int | material, |
std::vector< int > | var, | ||
std::vector< unsigned > | offset ) |
Returns true if at position (iX,iY) and in a neighbourhood of size (offsetX,offsetY) only voxels with a given material number (material) are there.
Definition at line 354 of file blockGeometry.hh.
bool olb::BlockGeometry< T, D >::checkForErrors | ( | bool | verbose = true | ) | const |
Checks for errors (searches for all outer voxels (=0) with an inner voxel (=1) as a direct neighbour)
Definition at line 377 of file blockGeometry.hh.
int olb::BlockGeometry< T, D >::clean | ( | bool | verbose = true, |
std::vector< int > | bulkMaterials = {1} ) |
Changes all cell materials which are not in bulkMaterials to 0 if there is no neighbour from bulkMaterials.
Definition at line 174 of file blockGeometry.hh.
void olb::BlockGeometry< T, D >::copyMaterialLayer | ( | IndicatorF3D< T > & | condition, |
int | discreteNormal[D], | ||
int | numberOfLayers ) |
Copy a layer of material numbers inside an indicator in a discrete normal direction.
Definition at line 566 of file blockGeometry.hh.
bool olb::BlockGeometry< T, D >::find | ( | int | material, |
std::vector< unsigned > | offset, | ||
std::vector< int > | var ) |
Returns the coordinates (iX,iY) of a voxel with a given material number (material) if there exists an neighbourhood of size (offsetX,offsetY) only with voxels of the given material number.
Definition at line 332 of file blockGeometry.hh.
int olb::BlockGeometry< T, D >::get | ( | const int | latticeR[D] | ) | const |
Definition at line 87 of file blockGeometry.hh.
|
inline |
Read-only access to a material number.
Definition at line 107 of file blockGeometry.h.
References olb::BlockStructureD< D >::getCellId().
int olb::BlockGeometry< T, D >::get | ( | LatticeR< D > | latticeR | ) | const |
Definition at line 81 of file blockGeometry.hh.
int olb::BlockGeometry< T, D >::get | ( | std::size_t | iCell | ) | const |
Definition at line 93 of file blockGeometry.hh.
|
inline |
Definition at line 146 of file blockGeometry.h.
References olb::BlockGeometry< T, D >::getPhysR().
|
overridevirtual |
Return a pointer to the memory of the current block and its size for the serializable interface.
Implements olb::Serializable.
Definition at line 742 of file blockGeometry.hh.
|
inline |
Definition at line 88 of file blockGeometry.h.
References OLB_ASSERT.
|
inline |
Definition at line 137 of file blockGeometry.h.
|
inline |
Definition at line 140 of file blockGeometry.h.
T olb::BlockGeometry< T, D >::getDeltaR | ( | ) | const |
Read only access to the voxel size given in SI units (meter)
Definition at line 75 of file blockGeometry.hh.
Vector< int, D > olb::BlockGeometry< T, D >::getExtent | ( | ) | const |
Returns the extend of the block in lattice units.
Definition at line 162 of file blockGeometry.hh.
int olb::BlockGeometry< T, D >::getIcGlob | ( | ) | const |
Read only access to the global iC number which is given !=-1 if the block geometries are part of a super geometry.
Definition at line 156 of file blockGeometry.hh.
int olb::BlockGeometry< T, D >::getMaterial | ( | const int | latticeR[D] | ) | const |
Definition at line 110 of file blockGeometry.hh.
|
inline |
Definition at line 120 of file blockGeometry.h.
References olb::BlockGeometry< T, D >::getMaterial().
int olb::BlockGeometry< T, D >::getMaterial | ( | LatticeR< D > | latticeR | ) | const |
returns the (iX,iY) entry in the 2D scalar field
Definition at line 99 of file blockGeometry.hh.
|
overridevirtual |
Number of data blocks for the serializable interface.
Implements olb::Serializable.
Definition at line 730 of file blockGeometry.hh.
References olb::BlockGeometry< T, D >::getNblock().
Vector< T, D > olb::BlockGeometry< T, D >::getOrigin | ( | ) | const |
Read only access to the origin position given in SI units (meter)
Definition at line 69 of file blockGeometry.hh.
|
inline |
Definition at line 129 of file blockGeometry.h.
References olb::BlockGeometry< T, D >::getPhysR().
void olb::BlockGeometry< T, D >::getPhysR | ( | T | physR[D], |
const int | latticeR[D] ) const |
Transforms lattice to physical coordinates (wrapped from cuboid geometry)
Definition at line 141 of file blockGeometry.hh.
void olb::BlockGeometry< T, D >::getPhysR | ( | T | physR[D], |
LatticeR< D > | latticeR ) const |
Definition at line 149 of file blockGeometry.hh.
|
inline |
Definition at line 76 of file blockGeometry.h.
References olb::BlockGeometry< T, D >::platform.
|
overridevirtual |
Binary size for the serializer.
Implements olb::Serializable.
Definition at line 736 of file blockGeometry.hh.
BlockGeometryStatistics< T, D > & olb::BlockGeometry< T, D >::getStatistics | ( | ) |
Write access to the associated block statistic.
Definition at line 63 of file blockGeometry.hh.
const BlockGeometryStatistics< T, D > & olb::BlockGeometry< T, D >::getStatistics | ( | ) | const |
Read only access to the associated block statistic.
Definition at line 57 of file blockGeometry.hh.
|
inline |
Definition at line 85 of file blockGeometry.h.
int olb::BlockGeometry< T, D >::innerClean | ( | bool | verbose = true | ) |
Changes all cell materials which are not 0 or 1 to 1 if there is a non robust constiallation.
Definition at line 227 of file blockGeometry.hh.
int olb::BlockGeometry< T, D >::innerClean | ( | int | fromM, |
bool | verbose = true ) |
Changes all cells with material fromM to 1 if there is a non robust constiallation.
Definition at line 272 of file blockGeometry.hh.
int olb::BlockGeometry< T, D >::outerClean | ( | bool | verbose = true, |
std::vector< int > | bulkMaterials = {1} ) |
Changes all cell materials from bulkMaterials to 0 if there is a neighbour with material 0.
Definition at line 201 of file blockGeometry.hh.
void olb::BlockGeometry< T, D >::printLayer | ( | int | direction, |
int | layer, | ||
bool | linenumber = false ) |
Prints a chosen part of the block geometry.
Definition at line 676 of file blockGeometry.hh.
void olb::BlockGeometry< T, D >::printLayer | ( | std::vector< int > | min, |
std::vector< int > | max, | ||
bool | linenumber = false ) |
Prints a chosen part of the block geometry.
Definition at line 650 of file blockGeometry.hh.
void olb::BlockGeometry< T, D >::printNode | ( | std::vector< int > | loc | ) |
Prints a chosen node and its neighbourhood.
Definition at line 704 of file blockGeometry.hh.
void olb::BlockGeometry< T, D >::regionGrowing | ( | int | fromM, |
int | toM, | ||
LatticeR< D > | seed, | ||
std::vector< int > | offset, | ||
std::map< std::vector< int >, int > * | tmp = nullptr ) |
Replaces all material numbers (fromM) to another (toM) using a seed point and max. directions indicated by offsetX,Y != 0.
Definition at line 591 of file blockGeometry.hh.
void olb::BlockGeometry< T, D >::rename | ( | int | fromM, |
int | toM ) |
Replaces all material numbers (fromM) to another (toM)
Definition at line 409 of file blockGeometry.hh.
void olb::BlockGeometry< T, D >::rename | ( | int | fromM, |
int | toM, | ||
IndicatorF< T, D > & | condition ) |
Replaces all material numbers (fromM) to another (toM) if an indicator functor condition is fulfilled.
Definition at line 419 of file blockGeometry.hh.
void olb::BlockGeometry< T, D >::rename | ( | int | fromM, |
int | toM, | ||
int | fluidM, | ||
IndicatorF< T, D > & | condition ) |
Replaces all material numbers (fromM) to another (toM) if all materials in the neighbourhood (iX+discreteNormal[0],iX+2*discreteNormal[0]), .. are of another material number (fluidM) and if an indicator functor condition is fulfilled, the discreteNormal is computed from all fromM which fulfill the indicator functor condition.
Definition at line 534 of file blockGeometry.hh.
void olb::BlockGeometry< T, D >::rename | ( | int | fromM, |
int | toM, | ||
int | fluidM, | ||
IndicatorF< T, D > & | condition, | ||
Vector< int, D > | discreteNormal ) |
Replaces all material numbers (fromM) to another (toM) if all materials in the neighbourhood (iX+discreteNormal[0],iX+2*discreteNormal[0]), .. are of another material number (testM) and if an indicator functor condition is fulfilled.
Definition at line 503 of file blockGeometry.hh.
void olb::BlockGeometry< T, D >::rename | ( | int | fromM, |
int | toM, | ||
int | testM, | ||
std::vector< int > | testDirection ) |
Replaces all material numbers (fromM) to another (toM) if all materials in the neighbourhood (iX+1,iX+2,..,ix+testDirection[0]), .. are of another material number (testM)
Definition at line 468 of file blockGeometry.hh.
References olb::util::max(), and olb::util::min().
void olb::BlockGeometry< T, D >::rename | ( | int | fromM, |
int | toM, | ||
LatticeR< D > | offset ) |
Replaces all material numbers (fromM) to another (toM) if all materials in the neighbourhood (iX-offsetX,..,iX,..,ix+offsetX), .. are of the original material number (fromM)
Definition at line 435 of file blockGeometry.hh.
void olb::BlockGeometry< T, D >::reset | ( | IndicatorF< T, D > & | domain | ) |
Resets all cell materials inside of a domain to 0.
Definition at line 318 of file blockGeometry.hh.
void olb::BlockGeometry< T, D >::set | ( | const int | latticeR[D], |
int | material ) |
Definition at line 128 of file blockGeometry.hh.
void olb::BlockGeometry< T, D >::set | ( | LatticeR< D > | latticeR, |
int | material ) |
Write access to a material number.
Definition at line 122 of file blockGeometry.hh.
void olb::BlockGeometry< T, D >::set | ( | std::size_t | iCell, |
int | material ) |
Definition at line 134 of file blockGeometry.hh.
|
staticconstexpr |
Definition at line 72 of file blockGeometry.h.