OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::SuperGeometry< T, D > Class Template Reference

Representation of a statistic for a parallel 2D geometry. More...

#include <superGeometry.h>

+ Inheritance diagram for olb::SuperGeometry< T, D >:
+ Collaboration diagram for olb::SuperGeometry< T, D >:

Public Types

using block_t = ConcretizableBlockGeometry<T,D>
 
- Public Types inherited from olb::SuperStructure< T, D >
using value_t = T
 

Public Member Functions

 SuperGeometry (CuboidDecomposition< T, D > &cuboidDecomposition, LoadBalancer< T > &loadBalancer, int overlap=3)
 
int get (LatticeR< D+1 > latticeR) const
 Read only access to the material numbers, error handling: returns 0 if data is not available.
 
template<typename... L>
std::enable_if_t< sizeof...(L)==(D+1), int > get (L... latticeR) const
 
int getAndCommunicate (LatticeR< D+1 > latticeR) const
 Read only access to the material numbers with global communication to all ranks.
 
Vector< T, D > getPhysR (LatticeR< D+1 > latticeR) const
 Transforms a lattice to physical position (SI units)
 
void getPhysR (T output[D], const int latticeR[D+1]) const
 Transforms a lattice to physical position (SI units)
 
BlockGeometry< T, D > & getBlockGeometry (int locIC)
 Read and write access to a single block geometry.
 
BlockGeometry< T, D > const & getBlockGeometry (int locIC) const
 Read only access to a single block geometry.
 
template<typename BLOCK = BlockGeometry<T,D>>
BLOCK & getBlock (int locIC)
 Read and write access to a single extended block geometry.
 
template<typename BLOCK = BlockGeometry<T,D>>
const BLOCK & getBlock (int locIC) const
 Read only access to a single extended block geometry.
 
SuperGeometryStatistics< T, D > & getStatistics ()
 Returns the statistics object.
 
const SuperGeometryStatistics< T, D > & getStatistics () const
 Returns the statistics object (readonly)
 
bool & getStatisticsStatus ()
 Read and write access to the statistic status flag, update needed = true.
 
bool const & getStatisticsStatus () const
 Read only access to the statistic status flag, update needed = true.
 
void updateStatistics (bool verbose=true)
 Updates the super geometry at the boundaries if needed and afterwards the statisics if needed.
 
template<typename DESCRIPTOR = std::conditional_t<D==2,descriptors::D2Q9<>,descriptors::D3Q27<>>>
int clean (bool verbose=true, std::vector< int > bulkMaterials={1})
 Executes an outer cleaning: Sets all material numbers which are not bulk-materials to 0 if there is no neighbour from bulkMaterials.
 
int outerClean (bool verbose=true, std::vector< int > bulkMaterials={1})
 Removes not needed fluid cells from the outer domain.
 
int innerClean (bool verbose=true)
 inner cleaning for all boundary types
 
int innerClean (int material, bool verbose=true)
 inner cleaning for specific boundary types
 
bool checkForErrors (bool verbose=true)
 check for errors (searches for all outer voxels (=0) with an inner voxel (=1) as a direct neighbour)
 
void reset (IndicatorF< T, D > &domain)
 reset all cell materials inside of a domain to 0
 
void rename (int fromM, int toM)
 replace one material with another
 
void rename (int fromM, int toM, FunctorPtr< IndicatorF< T, D > > &&condition)
 replace one material that fulfills an indicator functor condition with another
 
void rename (int fromM, int toM, LatticeR< D > offset)
 replace one material with another respecting an offset (overlap)
 
void rename (int fromM, int toM, int testM, Vector< int, D > testDirection)
 renames all voxels of material fromM to toM if the number of voxels given by testDirection is of material testM
 
void rename (int fromBcMat, int toBcMat, int fluidMat, IndicatorF< T, D > &condition)
 renames all boundary voxels of material fromBcMat to toBcMat if two neighbour voxel in the direction of the discrete normal are fluid voxel with material fluidM in the region where the indicator function is fulfilled
 
void rename (int fromBcMat, int toBcMat, int fluidMat, FunctorPtr< IndicatorF< T, D > > &&condition)
 renames all boundary voxels of material fromBcMat to toBcMat if two neighbour voxel in the direction of the discrete normal are fluid voxel with material fluidM in the region where the indicator function is fulfilled
 
void print ()
 Prints some information about the super geometry.
 
void setWriteIncrementalVTK (bool state)
 Toggles whether geometry should be written out as VTK after every modification.
 
bool getWriteIncrementalVTKState ()
 
void print (const T physR[D], int offset)
 
std::unique_ptr< SuperIndicatorF< T, D > > getMaterialIndicator (std::vector< int > &&materials)
 Returns a material indicator using the given vector of materials.
 
std::unique_ptr< SuperIndicatorF< T, D > > getMaterialIndicator (int material)
 Returns a material indicator using a single material number.
 
void communicate () override
 
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.
 
- Public Member Functions inherited from olb::SuperStructure< T, D >
virtual ~SuperStructure ()
 Virtual Destructor for inheritance.
 
 SuperStructure (CuboidDecomposition< T, D > &cuboidDecomposition, LoadBalancer< T > &loadBalancer, int overlap=2)
 Construction of a super structure.
 
CuboidDecomposition< T, D > & getCuboidDecomposition ()
 Read and write access to cuboid geometry.
 
const CuboidDecomposition< T, D > & getCuboidDecomposition () const
 Read only access to cuboid geometry.
 
int getOverlap ()
 Read and write access to the overlap.
 
int getOverlap () const
 Read only access to the overlap.
 
LoadBalancer< T > & getLoadBalancer ()
 Read and write access to the load balancer.
 
LoadBalancer< T > const & getLoadBalancer () const
 Read only access to the load balancer.
 
template<typename F >
void forCorePhysLocations (F f) const
 Iterate over discrete physical locations.
 
template<typename F >
void forCorePhysLocations (PhysR< T, D > min, PhysR< T, D > max, F f) const
 Iterate over discrete physical locations between min and max.
 
template<typename F >
void forCoreSpatialLocations (F f) const
 Iterate over spatial locations NOTE: Based on physical locations (as opposed to its blockStructure version)
 
template<typename F >
void forCoreSpatialLocations (PhysR< T, D > min, PhysR< T, D > max, F f) const
 Iterate over spatial locations between min and max NOTE: Based on physical locations (as opposed to its blockStructure version)
 
- Public Member Functions inherited from olb::Serializable
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 unsigned d = D
 

Additional Inherited Members

- Protected Member Functions inherited from olb::BufferSerializable
template<typename DataType >
void registerSerializable (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t &currentBlock, size_t &sizeBufferIndex, bool *&dataPtr, DataType &data, const bool loadingMode=false)
 Register Serializable object of dynamic size.
 
template<typename DataType >
void registerStdVectorOfVars (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t &currentBlock, size_t &sizeBufferIndex, bool *&dataPtr, std::vector< DataType > &data, const bool loadingMode=false)
 Method for registering a std::vector<DataType> of primitive DataType (int, double, ...)
 
template<typename DataType >
void registerStdVectorOfSerializablesOfConstSize (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t &currentBlock, size_t &sizeBufferIndex, bool *&dataPtr, std::vector< DataType > &data, const bool loadingMode=false)
 Method for registering a std::vector<DataType> of constant-sized Serializable
 
template<typename DataType >
void registerStdVectorOfSerializables (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t &currentBlock, size_t &sizeBufferIndex, bool *&dataPtr, std::vector< DataType > &data, const bool loadingMode=false)
 Method for registering a std::vector<DataType> of dynamic-sized DataType
 
template<typename DataTypeKey , typename DataTypeValue >
void registerMap (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t &currentBlock, size_t &sizeBufferIndex, bool *&dataPtr, std::map< DataTypeKey, DataTypeValue > &data, const bool loadingMode=false)
 Method for registering a std::map<DataTypeKey, DataTypeValue> of fixed-sized types (i.e. int, double)
 
size_t addSizeToBuffer (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t &currentBlock, size_t &sizeBufferIndex, bool *&dataPtr, const size_t data) const
 Add a size_t to the sizeBuffer in the n-th util::round and return that size_t in all successive rounds.
 
- Protected Member Functions inherited from olb::Serializable
template<typename DataType >
void registerVar (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t &currentBlock, 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 &currentBlock, 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 &currentBlock, bool *&dataPtr, DataType *data, const size_t arrayLength, const bool loadingMode=false)
 Register an array of Serializable objects of constant size.
 
- Protected Attributes inherited from olb::SuperStructure< T, D >
CuboidDecomposition< T, D > & _cuboidDecomposition
 The grid structure is referenced here.
 
LoadBalancer< T > & _loadBalancer
 Distribution of the cuboids of the cuboid structure.
 
int _overlap
 Size of ghost cell layer (must be greater than 1 and greater_overlapBC, default =1)
 
OstreamManager clout
 class specific output stream
 
- Protected Attributes inherited from olb::BufferSerializable
std::vector< bool * > _dataBuffer
 Data buffer for data that has to be buffered between two getBlock() iterations.
 
std::vector< size_t > _sizeBuffer
 std::vector of integer buffers (e.g. for std::vector size) to be buffered for the whole iteration process
 

Detailed Description

template<typename T, unsigned D>
class olb::SuperGeometry< T, D >

Representation of a statistic for a parallel 2D geometry.

Representation of a statistic for a parallel 3D geometry.

A super geomety statistic computes different integral values, like total number of different materials, materials of any kind, min./max. physical position, of an underlying super geoemtry.

This class is not intended to be derived from.

A super geometry statistic computes different integral values, like total number of different materials, materials of any kind, min./max. physical position, of an underlying super geometry.

This class is not intended to be derived from.

Definition at line 54 of file superGeometryStatistics3D.h.

Member Typedef Documentation

◆ block_t

template<typename T , unsigned D>
using olb::SuperGeometry< T, D >::block_t = ConcretizableBlockGeometry<T,D>

Definition at line 92 of file superGeometry.h.

Constructor & Destructor Documentation

◆ SuperGeometry()

template<typename T , unsigned D>
olb::SuperGeometry< T, D >::SuperGeometry ( CuboidDecomposition< T, D > & cuboidDecomposition,
LoadBalancer< T > & loadBalancer,
int overlap = 3 )

Definition at line 57 of file superGeometry.hh.

59 :
60 SuperStructure<T,D>(cuboidDecomposition, loadBalancer, overlap),
61 _communicator(new SuperCommunicator<T,SuperGeometry<T,D>>(*this)),
62 _communicationNeeded(false),
63 _statistics(this),
64 _clout(std::cout, ("SuperGeometry" + std::to_string(D) + "D")),
65 _iConstructionT{0},
66 _writeIncrementalVtkEnabled{true}
67{
68 for (int iCloc=0; iCloc < this->getLoadBalancer().size(); iCloc++) {
69 int iCglob = this->getLoadBalancer().glob(iCloc);
70 _block.emplace_back(
71 new BlockGeometry<T,D>(cuboidDecomposition.get(iCglob), overlap, iCglob));
72 }
73
74 _communicator->template requestField<descriptors::MATERIAL>();
75 _communicator->requestOverlap(this->_overlap);
76 _communicator->exchangeRequests();
77
78 _statistics.getStatisticsStatus() = true;
79 _communicationNeeded = true;
80 updateStatistics(false);
81
82 //writeIncrementalVTK();
83}
SuperGeometry(CuboidDecomposition< T, D > &cuboidDecomposition, LoadBalancer< T > &loadBalancer, int overlap=3)
void updateStatistics(bool verbose=true)
Updates the super geometry at the boundaries if needed and afterwards the statisics if needed.
LoadBalancer< T > & getLoadBalancer()
Read and write access to the load balancer.
SuperStructure(CuboidDecomposition< T, D > &cuboidDecomposition, LoadBalancer< T > &loadBalancer, int overlap=2)
Construction of a super structure.
int _overlap
Size of ghost cell layer (must be greater than 1 and greater_overlapBC, default =1)
SuperCommunicator(SUPER &) -> SuperCommunicator< typename SUPER::value_t, SUPER >

References olb::SuperStructure< T, D >::_overlap, olb::CuboidDecomposition< T, D >::get(), olb::SuperStructure< T, D >::getLoadBalancer(), and olb::SuperGeometry< T, D >::updateStatistics().

+ Here is the call graph for this function:

Member Function Documentation

◆ checkForErrors()

template<typename T , unsigned D>
bool olb::SuperGeometry< T, D >::checkForErrors ( bool verbose = true)

check for errors (searches for all outer voxels (=0) with an inner voxel (=1) as a direct neighbour)

Definition at line 291 of file superGeometry.hh.

292{
293 updateStatistics(verbose);
294 bool error = false;
295 for (unsigned iC=0; iC<_block.size(); iC++) {
296 if (_block[iC]->checkForErrors(false)) {
297 error = true;
298 }
299 }
300 if (verbose) {
301 if (error) {
302 this->_clout << "error!" << std::endl;
303 }
304 else {
305 this->_clout << "the model is correct!" << std::endl;
306 }
307 }
308 return error;
309}
bool checkForErrors(bool verbose=true)
check for errors (searches for all outer voxels (=0) with an inner voxel (=1) as a direct neighbour)

◆ clean()

template<typename T , unsigned D>
template<typename DESCRIPTOR >
int olb::SuperGeometry< T, D >::clean ( bool verbose = true,
std::vector< int > bulkMaterials = {1} )

Executes an outer cleaning: Sets all material numbers which are not bulk-materials to 0 if there is no neighbour from bulkMaterials.

Definition at line 206 of file superGeometry.hh.

207{
208 this->communicate();
209 int counter=0;
210 for (unsigned iC=0; iC<_block.size(); iC++) {
211 counter+=_block[iC]->template clean <DESCRIPTOR>(false, bulkMaterials);
212 }
213#ifdef PARALLEL_MODE_MPI
214 singleton::mpi().reduceAndBcast(counter, MPI_SUM);
215#endif
216
217 if (verbose) {
218 _clout << "cleaned "<< counter << " outer boundary voxel(s)" << std::endl;
219 }
220 _statistics.getStatisticsStatus() = true;
221 this->_communicationNeeded = true;
222 writeIncrementalVTK();
223 return counter;
224}
int clean(bool verbose=true, std::vector< int > bulkMaterials={1})
Executes an outer cleaning: Sets all material numbers which are not bulk-materials to 0 if there is n...
void communicate() override
void reduceAndBcast(T &reductVal, MPI_Op op, int root=0, MPI_Comm comm=MPI_COMM_WORLD)
Reduction operation, followed by a broadcast.
MpiManager & mpi()

◆ communicate()

template<typename T , unsigned D>
void olb::SuperGeometry< T, D >::communicate ( )
inlineoverridevirtual

Reimplemented from olb::SuperStructure< T, D >.

Definition at line 199 of file superGeometry.h.

200 {
201 if (_communicationNeeded) {
202 _communicator->communicate();
203 _communicationNeeded = false;
204 }
205 }

◆ get() [1/2]

template<typename T , unsigned D>
template<typename... L>
std::enable_if_t< sizeof...(L)==(D+1), int > olb::SuperGeometry< T, D >::get ( L... latticeR) const
inline

Definition at line 103 of file superGeometry.h.

103 {
104 return get(LatticeR<D+1>{latticeR...});
105 }
int get(LatticeR< D+1 > latticeR) const
Read only access to the material numbers, error handling: returns 0 if data is not available.
Vector< std::int32_t, D > LatticeR
Type for spatial block-local lattice coordinates.

References olb::SuperGeometry< T, D >::get().

+ Here is the call graph for this function:

◆ get() [2/2]

template<typename T , unsigned D>
int olb::SuperGeometry< T, D >::get ( LatticeR< D+1 > latticeR) const

Read only access to the material numbers, error handling: returns 0 if data is not available.

Definition at line 100 of file superGeometry.hh.

101{
102 if ( this->getLoadBalancer().rank(latticeR[0]) == singleton::mpi().getRank() ) {
103 return _block[this->getLoadBalancer().loc(latticeR[0])]->get(latticeR.data()+1);
104 } else {
105 throw std::domain_error("read only access to data which is not available locally");
106 }
107}

References olb::Vector< T, Size >::data(), and olb::singleton::mpi().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAndCommunicate()

template<typename T , unsigned D>
int olb::SuperGeometry< T, D >::getAndCommunicate ( LatticeR< D+1 > latticeR) const

Read only access to the material numbers with global communication to all ranks.

Definition at line 110 of file superGeometry.hh.

111{
112 int material = 0;
113 if ( this->getLoadBalancer().rank(latticeR[0]) == singleton::mpi().getRank() ) {
114 material = _block[this->getLoadBalancer().loc(latticeR[0])]->get(latticeR.data()+1);
115 }
116#ifdef PARALLEL_MODE_MPI
117 singleton::mpi().bCast(&material, 1, this->_loadBalancer.rank(latticeR[0]));
118#endif
119 return material;
120}
LoadBalancer< T > & _loadBalancer
Distribution of the cuboids of the cuboid structure.
void bCast(T *sendBuf, int sendCount, int root=0, MPI_Comm comm=MPI_COMM_WORLD)
Broadcast data from one processor to multiple processors.

◆ getBlock() [1/3]

template<typename T , unsigned D>
template<typename BLOCK >
BLOCK & olb::SuperGeometry< T, D >::getBlock ( int locIC)

Read and write access to a single extended block geometry.

Definition at line 150 of file superGeometry.hh.

151{
152 _statistics.getStatisticsStatus() = true;
153 return *_block[locIC];
154}
+ Here is the caller graph for this function:

◆ getBlock() [2/3]

template<typename T , unsigned D>
template<typename BLOCK >
const BLOCK & olb::SuperGeometry< T, D >::getBlock ( int locIC) const

Read only access to a single extended block geometry.

Definition at line 158 of file superGeometry.hh.

159{
160 return *_block[locIC];
161}

◆ getBlock() [3/3]

template<typename T , unsigned D>
bool * olb::SuperGeometry< T, D >::getBlock ( std::size_t iBlock,
std::size_t & sizeBlock,
bool loadingMode )
overridevirtual

Return a pointer to the memory of the current block and its size for the serializable interface.

Implements olb::Serializable.

Definition at line 511 of file superGeometry.hh.

512{
513 std::size_t currentBlock = 0;
514 bool* dataPtr = nullptr;
515
516 for (std::size_t iC=0; iC < _block.size(); ++iC) {
517 registerSerializableOfConstSize(iBlock, sizeBlock, currentBlock, dataPtr, getBlock(iC), loadingMode);
518 }
519
520 return dataPtr;
521}
void registerSerializableOfConstSize(const std::size_t iBlock, std::size_t &sizeBlock, std::size_t &currentBlock, bool *&dataPtr, DataType &data, const bool loadingMode=false)
Register Serializable object of constant size.
Definition serializer.h:239
BLOCK & getBlock(int locIC)
Read and write access to a single extended block geometry.

◆ getBlockGeometry() [1/2]

template<typename T , unsigned D>
BlockGeometry< T, D > & olb::SuperGeometry< T, D >::getBlockGeometry ( int locIC)

Read and write access to a single block geometry.

Definition at line 136 of file superGeometry.hh.

137{
138 _statistics.getStatisticsStatus() = true;
139 return *_block[locIC];
140}
+ Here is the caller graph for this function:

◆ getBlockGeometry() [2/2]

template<typename T , unsigned D>
BlockGeometry< T, D > const & olb::SuperGeometry< T, D >::getBlockGeometry ( int locIC) const

Read only access to a single block geometry.

Definition at line 143 of file superGeometry.hh.

144{
145 return *_block[locIC];
146}

◆ getMaterialIndicator() [1/2]

template<typename T , unsigned D>
std::unique_ptr< SuperIndicatorF< T, D > > olb::SuperGeometry< T, D >::getMaterialIndicator ( int material)

Returns a material indicator using a single material number.

Parameters
materialMaterial to be indicated
Returns
Unique ownership of the constructed indicator. May be stored or passed directly to e.g. defineDynamics

Definition at line 488 of file superGeometry.hh.

489{
490 return this->getMaterialIndicator(std::vector<int> { material });
491}
std::unique_ptr< SuperIndicatorF< T, D > > getMaterialIndicator(std::vector< int > &&materials)
Returns a material indicator using the given vector of materials.

◆ getMaterialIndicator() [2/2]

template<typename T , unsigned D>
std::unique_ptr< SuperIndicatorF< T, D > > olb::SuperGeometry< T, D >::getMaterialIndicator ( std::vector< int > && materials)

Returns a material indicator using the given vector of materials.

Parameters
materialsMaterials to be indicated
Returns
Unique ownership of the constructed indicator. May be stored or passed directly to e.g. defineDynamics

Definition at line 476 of file superGeometry.hh.

478{
479 static_assert(std::is_base_of<SuperIndicatorF<T,D>, SuperIndicatorMaterial<T,D>>::value,
480 "Indicator to be constructed is SuperIndicatorF implementation");
481
482 return std::unique_ptr<SuperIndicatorF<T,D>>(
483 new SuperIndicatorMaterial<T,D>(*this, std::forward<std::vector<int>>(materials))
484 );
485}
std::conditional_t< D==2, SuperIndicatorMaterial2D< T >, SuperIndicatorMaterial3D< T > > SuperIndicatorMaterial
Definition aliases.h:287
+ Here is the caller graph for this function:

◆ getNblock()

template<typename T , unsigned D>
std::size_t olb::SuperGeometry< T, D >::getNblock ( ) const
overridevirtual

Number of data blocks for the serializable interface.

Implements olb::Serializable.

Definition at line 494 of file superGeometry.hh.

495{
496 return std::accumulate(_block.begin(), _block.end(), size_t(0), [](std::size_t sum, auto& b) -> std::size_t {
497 return sum + b->getNblock();
498 });
499}

◆ getPhysR() [1/2]

template<typename T , unsigned D>
Vector< T, D > olb::SuperGeometry< T, D >::getPhysR ( LatticeR< D+1 > latticeR) const

Transforms a lattice to physical position (SI units)

Definition at line 123 of file superGeometry.hh.

124{
125 return this->_cuboidDecomposition.getPhysR(latticeR);
126}
CuboidDecomposition< T, D > & _cuboidDecomposition
The grid structure is referenced here.

◆ getPhysR() [2/2]

template<typename T , unsigned D>
void olb::SuperGeometry< T, D >::getPhysR ( T output[D],
const int latticeR[D+1] ) const

Transforms a lattice to physical position (SI units)

Definition at line 129 of file superGeometry.hh.

130{
131 auto physR = this->_cuboidDecomposition.getPhysR(latticeR);
132 std::copy(physR.data(), physR.data() + D, output);
133}

◆ getSerializableSize()

template<typename T , unsigned D>
std::size_t olb::SuperGeometry< T, D >::getSerializableSize ( ) const
overridevirtual

Binary size for the serializer.

Implements olb::Serializable.

Definition at line 503 of file superGeometry.hh.

504{
505 return std::accumulate(_block.begin(), _block.end(), size_t(0), [](std::size_t sum, auto& b) -> std::size_t {
506 return sum + b->getSerializableSize();
507 });
508}

◆ getStatistics() [1/2]

template<typename T , unsigned D>
SuperGeometryStatistics< T, D > & olb::SuperGeometry< T, D >::getStatistics ( )

Returns the statistics object.

Definition at line 164 of file superGeometry.hh.

165{
166 if (this->_communicationNeeded) {
167 this->communicate();
168 getStatisticsStatus()=true;
169 }
170 return _statistics;
171}
bool & getStatisticsStatus()
Read and write access to the statistic status flag, update needed = true.
+ Here is the caller graph for this function:

◆ getStatistics() [2/2]

template<typename T , unsigned D>
const SuperGeometryStatistics< T, D > & olb::SuperGeometry< T, D >::getStatistics ( ) const

Returns the statistics object (readonly)

Definition at line 174 of file superGeometry.hh.

175{
176 return _statistics;
177}

◆ getStatisticsStatus() [1/2]

template<typename T , unsigned D>
bool & olb::SuperGeometry< T, D >::getStatisticsStatus ( )

Read and write access to the statistic status flag, update needed = true.

Definition at line 180 of file superGeometry.hh.

181{
182 return _statistics.getStatisticsStatus();
183}

◆ getStatisticsStatus() [2/2]

template<typename T , unsigned D>
bool const & olb::SuperGeometry< T, D >::getStatisticsStatus ( ) const

Read only access to the statistic status flag, update needed = true.

Definition at line 186 of file superGeometry.hh.

187{
188 return _statistics.getStatisticsStatus();
189}

◆ getWriteIncrementalVTKState()

template<typename T , unsigned D>
bool olb::SuperGeometry< T, D >::getWriteIncrementalVTKState ( )
inline

Definition at line 174 of file superGeometry.h.

175 {
176 return _writeIncrementalVtkEnabled;
177 }
+ Here is the caller graph for this function:

◆ innerClean() [1/2]

template<typename T , unsigned D>
int olb::SuperGeometry< T, D >::innerClean ( bool verbose = true)

inner cleaning for all boundary types

Definition at line 248 of file superGeometry.hh.

249{
250 this->communicate();
251 int counter=0;
252 for (unsigned iC=0; iC<_block.size(); iC++) {
253 counter+=_block[iC]->innerClean(false);
254 }
255#ifdef PARALLEL_MODE_MPI
257 singleton::mpi().reduceAndBcast(counter, MPI_SUM);
258#endif
259
260 if (verbose) {
261 _clout << "cleaned "<< counter << " inner boundary voxel(s)" << std::endl;
262 }
263 _statistics.getStatisticsStatus() = true;
264 this->_communicationNeeded = true;
265 writeIncrementalVTK();
266 return counter;
267}
void barrier(MPI_Comm comm=MPI_COMM_WORLD)
Synchronizes the processes.

References olb::singleton::MpiManager::barrier(), olb::singleton::mpi(), and olb::singleton::MpiManager::reduceAndBcast().

+ Here is the call graph for this function:

◆ innerClean() [2/2]

template<typename T , unsigned D>
int olb::SuperGeometry< T, D >::innerClean ( int material,
bool verbose = true )

inner cleaning for specific boundary types

Definition at line 270 of file superGeometry.hh.

271{
272 this->communicate();
273 int counter=0;
274 for (unsigned iC=0; iC<_block.size(); iC++) {
275 counter+=_block[iC]->innerClean(bcType,false);
276 }
277#ifdef PARALLEL_MODE_MPI
278 singleton::mpi().reduceAndBcast(counter, MPI_SUM);
279#endif
280
281 if (verbose) {
282 _clout << "cleaned "<< counter << " inner boundary voxel(s) of Type " << bcType << std::endl;
283 }
284 _statistics.getStatisticsStatus() = true;
285 this->_communicationNeeded = true;
286 writeIncrementalVTK();
287 return counter;
288}

References olb::singleton::mpi(), and olb::singleton::MpiManager::reduceAndBcast().

+ Here is the call graph for this function:

◆ outerClean()

template<typename T , unsigned D>
int olb::SuperGeometry< T, D >::outerClean ( bool verbose = true,
std::vector< int > bulkMaterials = {1} )

Removes not needed fluid cells from the outer domain.

Definition at line 227 of file superGeometry.hh.

228{
229 this->communicate();
230 int counter=0;
231 for (unsigned iC=0; iC<_block.size(); iC++) {
232 counter+=_block[iC]->outerClean(false, bulkMaterials);
233 }
234#ifdef PARALLEL_MODE_MPI
235 singleton::mpi().reduceAndBcast(counter, MPI_SUM);
236#endif
237
238 if (verbose) {
239 _clout << "cleaned "<< counter << " outer fluid voxel(s)" << std::endl;
240 }
241 _statistics.getStatisticsStatus() = true;
242 this->_communicationNeeded = true;
243 writeIncrementalVTK();
244 return counter;
245}

References olb::singleton::mpi(), and olb::singleton::MpiManager::reduceAndBcast().

+ Here is the call graph for this function:

◆ print() [1/2]

template<typename T , unsigned D>
void olb::SuperGeometry< T, D >::print ( )

Prints some information about the super geometry.

Definition at line 435 of file superGeometry.hh.

436{
437 this->_cuboidDecomposition.print();
438 getStatistics().print();
439}
SuperGeometryStatistics< T, D > & getStatistics()
Returns the statistics object.

◆ print() [2/2]

template<typename T , unsigned D>
void olb::SuperGeometry< T, D >::print ( const T physR[D],
int offset )

Definition at line 443 of file superGeometry.hh.

444{
445 if (offset >= this->_overlap) {
446 _clout << "Warning! the offset is larger than overlap, set offset to _overlap = " << this->_overlap << std::endl;
447 offset=this->_overlap;
448 }
449 int latticeR[D+1];
450
451 if ( this->_cuboidDecomposition.getLatticeR(latticeR, physR) ) {
452 int iCglob = latticeR[0];
453
454 std::vector<int> loc(D, 0);
455 if constexpr (D==3) {
456 loc[0] = latticeR[1];
457 loc[1] = latticeR[2];
458 loc[2] = latticeR[3];
459 _clout << "physR(center)" << "=" << "{" << latticeR[1] << "," << latticeR[2] << "," << latticeR[3] << "}" << std::endl;
460 }
461 else {
462 loc[0] = latticeR[1];
463 loc[1] = latticeR[2];
464 _clout << "physR(center)" << "=" << "{" << latticeR[1] << "," << latticeR[2] << "}" << std::endl;
465 }
466
467 _block[this->getLoadBalancer().loc(iCglob)]->printNode(loc,offset);
468
469 }
470 else {
471 _clout << "this point isn't inside the geometry" << std::endl;
472 }
473}

◆ rename() [1/6]

template<typename T , unsigned D>
void olb::SuperGeometry< T, D >::rename ( int fromBcMat,
int toBcMat,
int fluidMat,
FunctorPtr< IndicatorF< T, D > > && condition )

renames all boundary voxels of material fromBcMat to toBcMat if two neighbour voxel in the direction of the discrete normal are fluid voxel with material fluidM in the region where the indicator function is fulfilled

Definition at line 413 of file superGeometry.hh.

415{
416 if (this->_overlap>1) {
417 _communicator->communicate();
418 rename(fromBcMat, toBcMat, *condition);
419 Vector<int,D> testDirection = this->getStatistics().computeDiscreteNormal(toBcMat);
420 _communicator->communicate();
421 for (unsigned iC=0; iC<_block.size(); iC++) {
422 _block[iC]->rename(fromBcMat,toBcMat,fluidMat,*condition,testDirection);
423 }
424 _statistics.getStatisticsStatus() = true;
425 this->_communicationNeeded = true;
426 writeIncrementalVTK();
427 }
428 else {
429 _clout << "error rename only implemented for overlap>=2" << std::endl;
430 }
431}
void rename(int fromM, int toM)
replace one material with another

◆ rename() [2/6]

template<typename T , unsigned D>
void olb::SuperGeometry< T, D >::rename ( int fromBcMat,
int toBcMat,
int fluidMat,
IndicatorF< T, D > & condition )

renames all boundary voxels of material fromBcMat to toBcMat if two neighbour voxel in the direction of the discrete normal are fluid voxel with material fluidM in the region where the indicator function is fulfilled

Definition at line 392 of file superGeometry.hh.

394{
395 if (this->_overlap>1) {
396 this->communicate();
397 rename(fromBcMat, toBcMat, condition);
398 Vector<int,D> testDirection = this->getStatistics().computeDiscreteNormal(toBcMat);
399 this->communicate();
400 for (unsigned iC=0; iC < _block.size(); iC++) {
401 _block[iC]->rename(fromBcMat,toBcMat,fluidMat,condition,testDirection);
402 }
403 _statistics.getStatisticsStatus() = true;
404 this->_communicationNeeded = true;
405 writeIncrementalVTK();
406 }
407 else {
408 _clout << "error rename only implemented for overlap>=2" << std::endl;
409 }
410}

◆ rename() [3/6]

template<typename T , unsigned D>
void olb::SuperGeometry< T, D >::rename ( int fromM,
int toM )

replace one material with another

Definition at line 324 of file superGeometry.hh.

325{
326 this->communicate();
327 for (unsigned iC=0; iC<_block.size(); iC++) {
328 _block[iC]->rename(fromM,toM);
329 }
330 _statistics.getStatisticsStatus() = true;
331 this->_communicationNeeded = true;
332 writeIncrementalVTK();
333}
+ Here is the caller graph for this function:

◆ rename() [4/6]

template<typename T , unsigned D>
void olb::SuperGeometry< T, D >::rename ( int fromM,
int toM,
FunctorPtr< IndicatorF< T, D > > && condition )

replace one material that fulfills an indicator functor condition with another

Definition at line 336 of file superGeometry.hh.

337{
338 this->communicate();
339 for (unsigned iC=0; iC<_block.size(); iC++) {
340 _block[iC]->rename(fromM,toM,*condition);
341 }
342 _statistics.getStatisticsStatus() = true;
343 writeIncrementalVTK();
344}

◆ rename() [5/6]

template<typename T , unsigned D>
void olb::SuperGeometry< T, D >::rename ( int fromM,
int toM,
int testM,
Vector< int, D > testDirection )

renames all voxels of material fromM to toM if the number of voxels given by testDirection is of material testM

Definition at line 364 of file superGeometry.hh.

365{
366 if ( testDirection[0]*testDirection[0]<=(this->_overlap)*(this->_overlap)
367 && testDirection[1]*testDirection[1]<=(this->_overlap)*(this->_overlap) ){
368 if constexpr (D==3){
369 if(testDirection[2]*testDirection[2]<=(this->_overlap)*(this->_overlap)){
370 _communicator->communicate();
371 for (unsigned iC=0; iC<_block.size(); iC++) {
372 _block[iC]->rename(fromM,toM,testM,testDirection);
373 }
374 _statistics.getStatisticsStatus() = true;
375 this->_communicationNeeded = true;
376 }
377 }else{
378 _communicator->communicate();
379 for (unsigned iC=0; iC<_block.size(); iC++) {
380 _block[iC]->rename(fromM,toM,testM,testDirection);
381 }
382 _statistics.getStatisticsStatus() = true;
383 this->_communicationNeeded = true;
384 }
385 writeIncrementalVTK();
386 } else {
387 _clout << "error rename only implemented for |testDirection[i]|<=overlap" << std::endl;
388 }
389}

◆ rename() [6/6]

template<typename T , unsigned D>
void olb::SuperGeometry< T, D >::rename ( int fromM,
int toM,
LatticeR< D > offset )

replace one material with another respecting an offset (overlap)

Definition at line 347 of file superGeometry.hh.

348{
349 LatticeR<D> overlap (this->_overlap);
350 if ( offset <= overlap ){
351 _communicator->communicate();
352 for (unsigned iC=0; iC<_block.size(); iC++) {
353 _block[iC]->rename(fromM,toM,offset);
354 }
355 _statistics.getStatisticsStatus() = true;
356 this->_communicationNeeded = true;
357 writeIncrementalVTK();
358 }else{
359 _clout << "error rename only implemented for offset<=overlap" << std::endl;
360 }
361}

◆ reset()

template<typename T , unsigned D>
void olb::SuperGeometry< T, D >::reset ( IndicatorF< T, D > & domain)

reset all cell materials inside of a domain to 0

Definition at line 312 of file superGeometry.hh.

313{
314 this->communicate();
315 for (unsigned iC = 0; iC < _block.size(); ++iC) {
316 _block[iC]->reset(domain);
317 }
318 _statistics.getStatisticsStatus() = true;
319 this->_communicationNeeded = true;
320 writeIncrementalVTK();
321}

◆ setWriteIncrementalVTK()

template<typename T , unsigned D>
void olb::SuperGeometry< T, D >::setWriteIncrementalVTK ( bool state)
inline

Toggles whether geometry should be written out as VTK after every modification.

Definition at line 171 of file superGeometry.h.

171 {
172 _writeIncrementalVtkEnabled = state;
173 }
+ Here is the caller graph for this function:

◆ updateStatistics()

template<typename T , unsigned D>
void olb::SuperGeometry< T, D >::updateStatistics ( bool verbose = true)

Updates the super geometry at the boundaries if needed and afterwards the statisics if needed.

Definition at line 192 of file superGeometry.hh.

193{
194 if (this->_communicationNeeded) {
195 this->communicate();
196 getStatisticsStatus()=true;
197 }
198 _statistics.update(verbose);
199 for (unsigned iC=0; iC<_block.size(); iC++) {
200 _block[iC]->getStatistics().update(verbose);
201 }
202}
+ Here is the caller graph for this function:

Member Data Documentation

◆ d

template<typename T , unsigned D>
unsigned olb::SuperGeometry< T, D >::d = D
staticconstexpr

Definition at line 90 of file superGeometry.h.


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