29#ifndef BLOCK_GEOMETRY_H
30#define BLOCK_GEOMETRY_H
54template <
typename T,
unsigned D>
90 "BlockGeometry only offers MATERIAL for communication");
91 return _communicatable;
105 template <
typename... L>
106 std::enable_if_t<
sizeof...(L) == D,
int>
107 get(L... latticeR)
const {
108 return _data[0][this->
getCellId(latticeR...)];
111 int get(
const int latticeR[D])
const;
112 int get(std::size_t iCell)
const;
118 template <
typename... L>
119 std::enable_if_t<
sizeof...(L) == D,
int>
126 void set(
const int latticeR[D],
int material);
127 void set(std::size_t iCell,
int material);
135 void getPhysR(T physR[D],
const int latticeR[D])
const;
144 template <
typename... L>
145 std::enable_if_t<
sizeof...(L) == D,
void>
146 get(T physR[D],L... latticeR)
const {
152 template <
typename DESCRIPTOR = std::conditional_t<D==2,descriptors::D2Q9<>,descriptors::D3Q27<>>>
int clean(
bool verbose=
true, std::vector<int> bulkMaterials={1});
154 int outerClean(
bool verbose=
true, std::vector<int> bulkMaterials={1});
161 void reset(IndicatorF<T,D>& domain);
164 bool find(
int material, std::vector<unsigned> offset, std::vector<int> var);
167 bool check(
int material, std::vector<int> var, std::vector<unsigned> offset);
172 void rename(
int fromM,
int toM);
174 void rename(
int fromM,
int toM, IndicatorF<T,D>& condition);
176 void rename(
int fromM,
int toM, LatticeR<D> offset);
178 void rename(
int fromM,
int toM,
int testM, std::vector<int> testDirection);
180 void rename(
int fromM,
int toM,
int fluidM, IndicatorF<T,D>& condition, Vector<int,D> discreteNormal);
182 void rename(
int fromM,
int toM,
int fluidM, IndicatorF<T,D>& condition);
185 void copyMaterialLayer(IndicatorF3D<T>& condition,
int discreteNormal[D],
int numberOfLayers);
188 void regionGrowing(
int fromM,
int toM, LatticeR<D> seed, std::vector<int> offset, std::map<std::vector<int>,
int >* tmp=
nullptr);
191 void printLayer(std::vector<int> min, std::vector<int> max,
bool linenumber =
false);
193 void printLayer(
int direction,
int layer,
bool linenumber =
false);
202 bool*
getBlock(std::size_t iBlock, std::size_t& sizeBlock,
bool loadingMode)
override;
205 void resetStatistics();
216template<
typename T,
unsigned D>
221template <Platform PLATFORM>
Representation of a statistic for a 2D geometry – header file.
Representation of a block geometry.
int innerClean(bool verbose=true)
Changes all cell materials which are not 0 or 1 to 1 if there is a non robust constiallation.
void rename(int fromM, int toM)
Replaces all material numbers (fromM) to another (toM)
Platform getPlatform() const
void reset(IndicatorF< T, D > &domain)
Resets all cell materials inside of a domain to 0.
const BlockGeometryStatistics< T, D > & getStatistics() const
Read only access to the associated block statistic.
Vector< T, D > getPhysR(LatticeR< D > latticeR)
int getMaterial(LatticeR< D > latticeR) const
returns the (iX,iY) entry in the 2D scalar field
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 bulkMate...
BlockGeometry(Cuboid< T, D > &cuboid, int padding, int iCglob=-1)
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...
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.
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...
int getIcGlob() const
Read only access to the global iC number which is given !=-1 if the block geometries are part of a su...
static constexpr Platform platform
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....
Cuboid< T, D > & getCuboid()
auto & getCommunicatable(std::type_index field)
std::size_t getNblock() const override
Number of data blocks for the serializable interface.
T getDeltaR() const
Read only access to the voxel size given in SI units (meter)
bool hasCommunicatable(std::type_index field) const
const Cuboid< T, D > & getCuboid() const
std::enable_if_t< sizeof...(L)==D, int > getMaterial(L... latticeR) const
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 copyMaterialLayer(IndicatorF3D< T > &condition, int discreteNormal[D], int numberOfLayers)
Copy a layer of material numbers inside an indicator in a discrete normal direction.
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.
std::enable_if_t< sizeof...(L)==D, void > get(T physR[D], L... latticeR) const
Vector< T, D > getOrigin() const
Read only access to the origin position given in SI units (meter)
void printNode(std::vector< int > loc)
Prints a chosen node and its neighbourhood.
Vector< int, D > getExtent() const
Returns the extend of the block in lattice units.
void printLayer(std::vector< int > min, std::vector< int > max, bool linenumber=false)
Prints a chosen part of the block geometry.
void set(LatticeR< D > latticeR, int material)
Write access to a material number.
std::size_t getSerializableSize() const override
Binary size for the serializer.
std::enable_if_t< sizeof...(L)==D, int > get(L... latticeR) const
Read-only access to a material number.
CellID getCellId(LatticeR< D > latticeR) const
Get 1D cell ID.
SoA storage for instances of a single FIELD.
class for marking output with some text
Base class for serializable objects of constant size. For dynamic size use BufferSerializable.
The description of a single 2D cuboid – header file.
Descriptor for all types of 2D and 3D lattices.
Top level namespace for all of OpenLB.
Platform
OpenLB execution targets.
std::conditional_t< D==2, BlockGeometryStatistics2D< T >, BlockGeometryStatistics3D< T > > BlockGeometryStatistics
std::conditional_t< D==2, Cuboid2D< T >, Cuboid3D< T > > Cuboid
#define OLB_ASSERT(COND, MESSAGE)
Curried BlockGeometry template for use in callUsingConcretePlatform.