OpenLB 1.7
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Attributes | List of all members
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 (CuboidGeometry< T, D > &cuboidGeometry, LoadBalancer< T > &loadBalancer, int overlap=3)
 
int get (int iCglob, LatticeR< D > latticeR) const
 Read only access to the material numbers, error handling: returns 0 if data is not available.
 
int get (const int latticeR[D+1]) const
 
int get (LatticeR< D+1 > latticeR) const
 
template<typename... L>
std::enable_if_t< sizeof...(L)==(D+1), int > get (L... latticeR) const
 
int getAndCommunicate (int iCglob, LatticeR< D > latticeR) const
 Read only access to the material numbers with global communication to all ranks.
 
int getAndCommunicate (LatticeR< D+1 > latticeR) const
 
std::vector< T > getPhysR (int iCglob, LatticeR< D > latticeR) const
 Transforms a lattice to physical position (SI unites)
 
std::vector< T > getPhysR (LatticeR< D+1 > latticeR) const
 Transforms a lattice to physical position (SI unites)
 
void getPhysR (T output[D], const int latticeR[D+1]) const
 Transforms a lattice to physical position (SI unites)
 
void getPhysR (T output[D], const int iCglob, LatticeR< D > latticeR) const
 
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, std::vector< int > 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.
 
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 (CuboidGeometry< T, D > &cuboidGeometry, LoadBalancer< T > &loadBalancer, int overlap=2)
 Construction of a super structure.
 
 SuperStructure (int overlap=1)
 Default Constructor for empty SuperStructure.
 
CuboidGeometry< T, D > & getCuboidGeometry ()
 Read and write access to cuboid geometry.
 
CuboidGeometry< T, D > const & getCuboidGeometry () 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 >
CuboidGeometry< T, D > & _cuboidGeometry
 The grid structure is stored 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 69 of file superGeometry.h.

Member Typedef Documentation

◆ block_t

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

Definition at line 86 of file superGeometry.h.

Constructor & Destructor Documentation

◆ SuperGeometry()

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

Definition at line 53 of file superGeometry.hh.

55 :
56 SuperStructure<T,D>(cuboidGeometry, loadBalancer, overlap),
57 _communicator(new SuperCommunicator<T,SuperGeometry<T,D>>(*this)),
58 _communicationNeeded(false),
59 _statistics(this),
60 clout(std::cout, ("SuperGeometry" + std::to_string(D) + "D"))
61{
62 for (int iCloc=0; iCloc<this->getLoadBalancer().size(); iCloc++) {
63 int iCglob = this->getLoadBalancer().glob(iCloc);
64 _block.emplace_back(
65 new BlockGeometry<T,D>(cuboidGeometry.get(iCglob), overlap, iCglob));
66 }
67
68 _communicator->template requestField<descriptors::MATERIAL>();
69 _communicator->requestOverlap(this->_overlap);
70 _communicator->exchangeRequests();
71
72 _statistics.getStatisticsStatus() = true;
73 _communicationNeeded = true;
74 updateStatistics(false);
75}
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.
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::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 313 of file superGeometry.hh.

314{
315 updateStatistics(verbose);
316 bool error = false;
317 for (unsigned iC=0; iC<_block.size(); iC++) {
318 if (_block[iC]->checkForErrors(false)) {
319 error = true;
320 }
321 }
322 if (verbose) {
323 if (error) {
324 this->clout << "error!" << std::endl;
325 }
326 else {
327 this->clout << "the model is correct!" << std::endl;
328 }
329 }
330 return error;
331}
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 232 of file superGeometry.hh.

233{
234 this->communicate();
235 int counter=0;
236 for (unsigned iC=0; iC<_block.size(); iC++) {
237 counter+=_block[iC]->template clean <DESCRIPTOR>(false, bulkMaterials);
238 }
239#ifdef PARALLEL_MODE_MPI
240 singleton::mpi().reduceAndBcast(counter, MPI_SUM);
241#endif
242
243 if (verbose) {
244 clout << "cleaned "<< counter << " outer boundary voxel(s)" << std::endl;
245 }
246 _statistics.getStatisticsStatus() = true;
247 this->_communicationNeeded = true;
248 return counter;
249}
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()

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

+ Here is the call graph for this function:

◆ communicate()

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

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

Definition at line 188 of file superGeometry.h.

189 {
190 if (_communicationNeeded) {
191 _communicator->communicate();
192 _communicationNeeded = false;
193 }
194 }

◆ get() [1/4]

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

Definition at line 89 of file superGeometry.hh.

90{
91 if constexpr (D == 3){
92 return get(latticeR[0], {latticeR[1], latticeR[2], latticeR[3]});
93 } else {
94 return get(latticeR[0], {latticeR[1], latticeR[2]});
95 }
96}
int get(int iCglob, LatticeR< D > latticeR) const
Read only access to the material numbers, error handling: returns 0 if data is not available.

◆ get() [2/4]

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

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

Definition at line 78 of file superGeometry.hh.

79{
80 if ( this->getLoadBalancer().rank(iCglob) == singleton::mpi().getRank() ) {
81 return _block[this->getLoadBalancer().loc(iCglob)]->get(
82 latticeR);
83 } else {
84 throw std::domain_error("read only access to data which is not available locally");
85 }
86}

References olb::singleton::mpi().

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

◆ get() [3/4]

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 99 of file superGeometry.h.

99 {
100 return get(LatticeR<D+1>{latticeR...});
101 }

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

+ Here is the call graph for this function:

◆ get() [4/4]

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

Definition at line 99 of file superGeometry.hh.

100{
101 if constexpr (D == 3){
102 return get(latticeR[0], {latticeR[1], latticeR[2], latticeR[3]});
103 } else {
104 return get(latticeR[0], {latticeR[1], latticeR[2]});
105 }
106}

◆ getAndCommunicate() [1/2]

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

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

Definition at line 109 of file superGeometry.hh.

110{
111 int material = 0;
112 if ( this->getLoadBalancer().rank(iCglob) == singleton::mpi().getRank() ) {
113 material = _block[this->getLoadBalancer().loc(iCglob)]->get(latticeR);
114 }
115#ifdef PARALLEL_MODE_MPI
116 singleton::mpi().bCast(&material, 1, this->_loadBalancer.rank(iCglob));
117#endif
118 return material;
119}
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.

◆ getAndCommunicate() [2/2]

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

Definition at line 122 of file superGeometry.hh.

123{
124 if constexpr (D == 3){
125 return getAndCommunicate(latticeR[0], {latticeR[1], latticeR[2], latticeR[3]});
126 }else{
127 return getAndCommunicate(latticeR[0], {latticeR[1], latticeR[2]});
128 }
129}
int getAndCommunicate(int iCglob, LatticeR< D > latticeR) const
Read only access to the material numbers with global communication to all ranks.

◆ 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 176 of file superGeometry.hh.

177{
178 _statistics.getStatisticsStatus() = true;
179 return *_block[locIC];
180}
+ 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 184 of file superGeometry.hh.

185{
186 return *_block[locIC];
187}

◆ 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 492 of file superGeometry.hh.

493{
494 std::size_t currentBlock = 0;
495 bool* dataPtr = nullptr;
496
497 for (std::size_t iC=0; iC < _block.size(); ++iC) {
498 registerSerializableOfConstSize(iBlock, sizeBlock, currentBlock, dataPtr, getBlock(iC), loadingMode);
499 }
500
501 return dataPtr;
502}
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 162 of file superGeometry.hh.

163{
164 _statistics.getStatisticsStatus() = true;
165 return *_block[locIC];
166}
+ 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 169 of file superGeometry.hh.

170{
171 return *_block[locIC];
172}

◆ 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 469 of file superGeometry.hh.

470{
471 return this->getMaterialIndicator(std::vector<int> { material });
472}
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 457 of file superGeometry.hh.

459{
460 static_assert(std::is_base_of<SuperIndicatorF<T,D>, SuperIndicatorMaterial<T,D>>::value,
461 "Indicator to be constructed is SuperIndicatorF implementation");
462
463 return std::unique_ptr<SuperIndicatorF<T,D>>(
464 new SuperIndicatorMaterial<T,D>(*this, std::forward<std::vector<int>>(materials))
465 );
466}
+ 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 475 of file superGeometry.hh.

476{
477 return std::accumulate(_block.begin(), _block.end(), size_t(0), [](std::size_t sum, auto& b) -> std::size_t {
478 return sum + b->getNblock();
479 });
480}

◆ getPhysR() [1/4]

template<typename T , unsigned D>
std::vector< T > olb::SuperGeometry< T, D >::getPhysR ( int iCglob,
LatticeR< D > latticeR ) const

Transforms a lattice to physical position (SI unites)

Definition at line 132 of file superGeometry.hh.

133{
134 T physRv[D];
135 getPhysR(physRv, iCglob, latticeR);
136 std::vector<T> physR(physRv,physRv + D);
137 return physR;
138}
std::vector< T > getPhysR(int iCglob, LatticeR< D > latticeR) const
Transforms a lattice to physical position (SI unites)

◆ getPhysR() [2/4]

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

Transforms a lattice to physical position (SI unites)

Definition at line 141 of file superGeometry.hh.

142{
143 T physRv[D];
144 this->_cuboidGeometry.getPhysR(physRv, latticeR);
145 std::vector<T> physR(physRv,physRv + D);
146 return physR;
147}
CuboidGeometry< T, D > & _cuboidGeometry
The grid structure is stored here.

◆ getPhysR() [3/4]

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

Definition at line 156 of file superGeometry.hh.

157{
158 this->_cuboidGeometry.getPhysR(output, iCglob, latticeR);
159}

◆ getPhysR() [4/4]

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 unites)

Definition at line 150 of file superGeometry.hh.

151{
152 this->_cuboidGeometry.getPhysR(output, latticeR);
153}

◆ 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 484 of file superGeometry.hh.

485{
486 return std::accumulate(_block.begin(), _block.end(), size_t(0), [](std::size_t sum, auto& b) -> std::size_t {
487 return sum + b->getSerializableSize();
488 });
489}

◆ getStatistics() [1/2]

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

Returns the statistics object.

Definition at line 190 of file superGeometry.hh.

191{
192 if (this->_communicationNeeded) {
193 this->communicate();
194 getStatisticsStatus()=true;
195 }
196 return _statistics;
197}
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 200 of file superGeometry.hh.

201{
202 return _statistics;
203}

◆ 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 206 of file superGeometry.hh.

207{
208 return _statistics.getStatisticsStatus();
209}

◆ 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 212 of file superGeometry.hh.

213{
214 return _statistics.getStatisticsStatus();
215}

◆ 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 272 of file superGeometry.hh.

273{
274 this->communicate();
275 int counter=0;
276 for (unsigned iC=0; iC<_block.size(); iC++) {
277 counter+=_block[iC]->innerClean(false);
278 }
279#ifdef PARALLEL_MODE_MPI
281 singleton::mpi().reduceAndBcast(counter, MPI_SUM);
282#endif
283
284 if (verbose) {
285 clout << "cleaned "<< counter << " inner boundary voxel(s)" << std::endl;
286 }
287 _statistics.getStatisticsStatus() = true;
288 this->_communicationNeeded = true;
289 return counter;
290}
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 293 of file superGeometry.hh.

294{
295 this->communicate();
296 int counter=0;
297 for (unsigned iC=0; iC<_block.size(); iC++) {
298 counter+=_block[iC]->innerClean(bcType,false);
299 }
300#ifdef PARALLEL_MODE_MPI
301 singleton::mpi().reduceAndBcast(counter, MPI_SUM);
302#endif
303
304 if (verbose) {
305 clout << "cleaned "<< counter << " inner boundary voxel(s) of Type " << bcType << std::endl;
306 }
307 _statistics.getStatisticsStatus() = true;
308 this->_communicationNeeded = true;
309 return counter;
310}

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 252 of file superGeometry.hh.

253{
254 this->communicate();
255 int counter=0;
256 for (unsigned iC=0; iC<_block.size(); iC++) {
257 counter+=_block[iC]->outerClean(false, bulkMaterials);
258 }
259#ifdef PARALLEL_MODE_MPI
260 singleton::mpi().reduceAndBcast(counter, MPI_SUM);
261#endif
262
263 if (verbose) {
264 clout << "cleaned "<< counter << " outer fluid voxel(s)" << std::endl;
265 }
266 _statistics.getStatisticsStatus() = true;
267 this->_communicationNeeded = true;
268 return counter;
269}

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

+ Here is the call graph for this function:

◆ print()

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

Prints some information about the super geometry.

Definition at line 450 of file superGeometry.hh.

451{
452 this->_cuboidGeometry.print();
453 getStatistics().print();
454}
SuperGeometryStatistics< T, D > & getStatistics()
Returns the statistics object.

◆ 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 429 of file superGeometry.hh.

431{
432 if (this->_overlap>1) {
433 _communicator->communicate();
434 rename(fromBcMat, toBcMat, *condition);
435 Vector<int,D> testDirection = this->getStatistics().computeDiscreteNormal(toBcMat);
436 _communicator->communicate();
437 for (unsigned iC=0; iC<_block.size(); iC++) {
438 _block[iC]->rename(fromBcMat,toBcMat,fluidMat,*condition,testDirection);
439 }
440 _statistics.getStatisticsStatus() = true;
441 this->_communicationNeeded = true;
442 }
443 else {
444 clout << "error rename only implemented for overlap>=2" << std::endl;
445 }
446}
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 409 of file superGeometry.hh.

411{
412 if (this->_overlap>1) {
413 this->communicate();
414 rename(fromBcMat, toBcMat, condition);
415 Vector<int,D> testDirection = this->getStatistics().computeDiscreteNormal(toBcMat);
416 this->communicate();
417 for (unsigned iC=0; iC < _block.size(); iC++) {
418 _block[iC]->rename(fromBcMat,toBcMat,fluidMat,condition,testDirection);
419 }
420 _statistics.getStatisticsStatus() = true;
421 this->_communicationNeeded = true;
422 }
423 else {
424 clout << "error rename only implemented for overlap>=2" << std::endl;
425 }
426}

◆ 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 345 of file superGeometry.hh.

346{
347 this->communicate();
348 for (unsigned iC=0; iC<_block.size(); iC++) {
349 _block[iC]->rename(fromM,toM);
350 }
351 _statistics.getStatisticsStatus() = true;
352 this->_communicationNeeded = true;
353}

◆ 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 356 of file superGeometry.hh.

357{
358 this->communicate();
359 for (unsigned iC=0; iC<_block.size(); iC++) {
360 _block[iC]->rename(fromM,toM,*condition);
361 }
362 _statistics.getStatisticsStatus() = true;
363}

◆ rename() [5/6]

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

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

Definition at line 382 of file superGeometry.hh.

383{
384 if ( testDirection[0]*testDirection[0]<=(this->_overlap)*(this->_overlap)
385 && testDirection[1]*testDirection[1]<=(this->_overlap)*(this->_overlap) ){
386 if constexpr (D==3){
387 if(testDirection[2]*testDirection[2]<=(this->_overlap)*(this->_overlap)){
388 _communicator->communicate();
389 for (unsigned iC=0; iC<_block.size(); iC++) {
390 _block[iC]->rename(fromM,toM,testM,testDirection);
391 }
392 _statistics.getStatisticsStatus() = true;
393 this->_communicationNeeded = true;
394 }
395 }else{
396 _communicator->communicate();
397 for (unsigned iC=0; iC<_block.size(); iC++) {
398 _block[iC]->rename(fromM,toM,testM,testDirection);
399 }
400 _statistics.getStatisticsStatus() = true;
401 this->_communicationNeeded = true;
402 }
403 }else{
404 clout << "error rename only implemented for |testDirection[i]|<=overlap" << std::endl;
405 }
406}

◆ 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 366 of file superGeometry.hh.

367{
368 LatticeR<D> overlap (this->_overlap);
369 if ( offset <= overlap ){
370 _communicator->communicate();
371 for (unsigned iC=0; iC<_block.size(); iC++) {
372 _block[iC]->rename(fromM,toM,offset);
373 }
374 _statistics.getStatisticsStatus() = true;
375 this->_communicationNeeded = true;
376 }else{
377 clout << "error rename only implemented for offset<=overlap" << std::endl;
378 }
379}

◆ 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 334 of file superGeometry.hh.

335{
336 this->communicate();
337 for (unsigned iC = 0; iC < _block.size(); ++iC) {
338 _block[iC]->reset(domain);
339 }
340 _statistics.getStatisticsStatus() = true;
341 this->_communicationNeeded = true;
342}

◆ 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 218 of file superGeometry.hh.

219{
220 if (this->_communicationNeeded) {
221 this->communicate();
222 getStatisticsStatus()=true;
223 }
224 _statistics.update(verbose);
225 for (unsigned iC=0; iC<_block.size(); iC++) {
226 _block[iC]->getStatistics().update(verbose);
227 }
228}
+ Here is the caller graph for this function:

Member Data Documentation

◆ d

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

Definition at line 84 of file superGeometry.h.


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