OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | List of all members
olb::CuboidGeometry3D< T > Class Template Reference

A cuboid geometry represents a voxel mesh. More...

#include <cuboidGeometry3D.h>

+ Inheritance diagram for olb::CuboidGeometry3D< T >:
+ Collaboration diagram for olb::CuboidGeometry3D< T >:

Public Member Functions

 CuboidGeometry3D ()
 Constructs empty Geometry.
 
 CuboidGeometry3D (T originX, T originY, T originZ, T deltaR, int nX, int nY, int nZ, int nC=1)
 Constructs a cuboid geometry with a cubic shape of size nX times nY times nZ with origin originR=(originX, originY, originZ) that consists of nC cuboids.
 
 CuboidGeometry3D (std::vector< T > origin, T deltaR, std::vector< int > extent, int nC=1)
 Constructor with vectors.
 
 CuboidGeometry3D (Vector< T, 3 > origin, T deltaR, Vector< int, 3 > extent, int nC=1)
 
 CuboidGeometry3D (const Cuboid3D< T > &motherCuboid, int nC)
 Construction from an alrealy existing mother cuboid.
 
 CuboidGeometry3D (IndicatorF3D< T > &indicatorF, T voxelSize, int nC=1)
 Constructs a cuboid structure with a uniform spacing of voxelSize which consists of nC cuboids, the cuboids not needed are removed and too big ones are shrinked.
 
 CuboidGeometry3D (std::shared_ptr< IndicatorF3D< T > > indicator_sharedPtrF, T voxelSize, int nC=1)
 
 CuboidGeometry3D (IndicatorF3D< T > &indicatorF, T voxelSize, int nC, std::string minimizeBy)
 Constructs a cuboid structure with a uniform spacing of voxelSize which consists of nC cuboids, the cuboids not needed are removed and too big ones are shrinked. Uses an iterative method: Halves the largest child cuboid until the set number of cuboids is reached. Largest cuboid is determined by either volume or weight as choosen in minimizeBy.
 
 CuboidGeometry3D (std::shared_ptr< IndicatorF3D< T > > indicator_sharedPtrF, T voxelSize, int nC, std::string minimizeBy)
 
virtual ~CuboidGeometry3D ()
 Destructs CuboidGeometry.
 
Cuboid3D< T > & get (int iC)
 Read and write access to a single cuboid.
 
Cuboid3D< T > const & get (int iC) const
 Read access to a single cuboid.
 
Cuboid3D< T > getMotherCuboid ()
 Returns the smallest cuboid that includes all cuboids of the structure.
 
Cuboid3D< T > const & getMotherCuboid () const
 
void setPeriodicity (bool periodicityX, bool periodicityY, bool periodicityZ)
 Set flag to enable/disable periodicity depending of direction. Be aware that not all directions are true to ensure boundary conditions like for velocity are not disturbed.
 
std::vector< Cuboid3D< T > > & cuboids ()
 
int get_iC (T globX, T globY, T globZ, int offset=0) const
 Gives for a given point (globX/globY/globZ) the related cuboidID and _p if the point is not in any of the cuboid _childrenQ.
 
int get_iC (Vector< T, 3 >, int offset=0) const
 
int get_iC (T globX, T globY, T globZ, int orientationX, int orientationY, int orientationZ) const
 This function checks if the points (globX/globY/globZ) and (globX + orientationX/delta/globY + orientationY/delta/ globZ + orientationZ/delta) is in a cuboid.
 
bool getC (T physR[3], int &iC) const
 Returns true and the cuboid number of the nearest lattice position to the given physical position if the physical position is within any of the cuboids with an overlap of 1/2*delta belonging to the cuboid geometry.
 
bool getC (std::vector< T > physR, int &iC) const
 Returns true and the cuboid number of the nearest lattice position to the given physical position if the physical position is within any of the cuboids with an overlap of 1/2*delta belonging to the cuboid geometry.
 
bool getC (const Vector< T, 3 > &physR, int &iC) const
 Returns true and the cuboid number of the nearest lattice position to the given physical position if the physical position is within any of the cuboids with an overlap of 1/2*delta belonging to the cuboid geometry.
 
bool getLatticeR (int latticeR[4], const T physR[3]) const
 Returns true and the nearest lattice position to the given physical position if the physical position is within any of the cuboids with an overlap of 1/2*delta belonging to the cuboid geometry.
 
bool getFloorLatticeR (const std::vector< T > &physR, std::vector< int > &latticeR) const
 Returns true and the util::floor lattice position to the given physical position if the physical position is within any of the cuboids with an overlap of 1/2*delta belonging to the cuboid geometry.
 
bool getFloorLatticeR (const Vector< T, 3 > &physR, Vector< int, 4 > &latticeR) const
 Returns true and the util::floor lattice position to the given physical position if the physical position is within any of the cuboids with an overlap of 1/2*delta belonging to the cuboid geometry.
 
void getPhysR (T physR[3], const int &iCglob, const int &iX, const int &iY, const int &iZ) const
 Returns the physical position to the given lattice position respecting periodicity for the overlap nodes which are not in the mother cuboid for the case the flag periodicityOn[iDim]=true if the physical position is within any of the cuboids with an overlap of 1/2*delta belonging to the cuboid geometry.
 
void getPhysR (T physR[3], const int latticeR[4]) const
 Returns the physical position to the given lattice position respecting periodicity for the overlap nodes which are not in the mother cuboid for the case the flag periodicityOn[iDim]=true.
 
void getPhysR (T physR[3], LatticeR< 4 > latticeR) const
 
void getPhysR (T output[3], const int iCglob, LatticeR< 3 > latticeR) const
 
void getNeighbourhood (int cuboid, std::vector< int > &neighbours, int overlap=0)
 Stores the iC of the neighbouring cuboids in a vector;.
 
int getNc () const
 Returns the number of cuboids in the structure.
 
getMinRatio () const
 Returns the minimum of the ratio nX/NY in the structure.
 
getMaxRatio () const
 Returns the maximum of the ratio nX/NY in the structure.
 
Vector< T, 3 > getMinPhysR () const
 Returns the minimum coordinate in the structure.
 
Vector< T, 3 > getMaxPhysR () const
 Returns the maximum coordinate in the structure.
 
getMinPhysVolume () const
 Returns the minimum volume in the structure.
 
getMaxPhysVolume () const
 Returns the maximum volume in the structure.
 
size_t getMinLatticeVolume () const
 Returns the minimum number of nodes in the structure.
 
size_t getMaxLatticeVolume () const
 Returns the maximum number of nodes in the structure.
 
size_t getMinLatticeWeight () const
 Returns the minimum number of nodes in the structure inside the indicator.
 
size_t getMaxLatticeWeight () const
 Returns the maximum number of nodes in the structure inside the indicator.
 
getMinDeltaR () const
 Returns the minimum delta in the structure.
 
getMaxDeltaR () const
 Returns the maximum delta in the structure.
 
bool operator== (CuboidGeometry3D< T > &rhs)
 Compares two CuboidGeometries.
 
void swap (CuboidGeometry3D< T > &rhs)
 Swaps data from input into object.
 
void swapCuboids (std::vector< Cuboid3D< T > > &cuboids)
 Swaps the vector of cuboids.
 
void replaceCuboids (std::vector< Cuboid3D< T > > &cuboids)
 Replace the vector of cuboids.
 
std::size_t replaceContainedBy (Cuboid3D< T > mother)
 
std::size_t hypotheticalReplaceContainedBy (Cuboid3D< T > mother)
 
void setWeights (IndicatorF3D< T > &indicatorF)
 Sets the number of full cells of each cuboid.
 
void clearCuboids ()
 Resets the cuboid array.
 
void add (Cuboid3D< T > cuboid)
 Adds a cuboid.
 
void split (int iC, int p)
 Splits cuboid iC, removes it and adds p cuboids of same volume.
 
void splitRegular (int iC, int width)
 Splits cuboid iC, removes it, adds approx. width^3 sized new cuboids.
 
void splitByWeight (int iC, int p, IndicatorF3D< T > &indicatorF)
 Splits cuboid iC, removes it and adds p cuboids of same weight.
 
void splitFractional (int iC, int iD, std::vector< T > fractions)
 Splits cuboid iC along dimension iD into cuboids of fractions.
 
void remove (int iC)
 Removes the cuboid iC.
 
void remove (IndicatorF3D< T > &indicatorF)
 Removes all cuboids where indicatorF = 0.
 
void removeByWeight ()
 Removes all cuboids where weight = 0.
 
void shrink (int iC, IndicatorF3D< T > &indicatorF)
 Shrink cuboid iC so that no empty planes are left.
 
void shrink (IndicatorF3D< T > &indicatorF)
 Shrink all cuboids so that no empty planes are left.
 
void refine (int factor)
 Refines mesh by splitting each cell into factor^3 cells.
 
bool tryRefineTo (T deltaR)
 Tries to refine mesh to given deltaR.
 
size_t getNblock () const override
 Number of data blocks for the serializer interface.
 
size_t getSerializableSize () const override
 Binary size for the serializer interface.
 
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.
 
void print () const
 Prints cuboid geometry details.
 
void printExtended ()
 Prints cuboid geometry details plus details of all cuboids.
 
void writeToExistingFile (std::string completeFileName, LoadBalancer< T > &loadBalancer)
 Save CuboidGeometry into an existing XML File.
 
void writeToFile (std::string fileName, LoadBalancer< T > &loadBalancer)
 Save CuboidGeometry into XML File.
 
- 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 ()
 

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::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>
class olb::CuboidGeometry3D< T >

A cuboid geometry represents a voxel mesh.

A cuboid geometry is given by a number of cuboids. To represent a connected domain it is required that the distance between two neighbouring cuboids is less than the smallest delta of them.

By the class, access is provided to the cuboids. Core methods of the class are transforming lattice to physical positions in the corresponding unit systems.

WARNING: At the moment there are only cuboids with a constant delta possible and the distance between two neighbouring cuboids must be delta since an interpolation operator in time and space is missing in cuboidNeighbourhood and superLattice.

This class is not intended to be derived from.

Definition at line 72 of file cuboidGeometry3D.h.

Constructor & Destructor Documentation

◆ CuboidGeometry3D() [1/9]

template<typename T >
olb::CuboidGeometry3D< T >::CuboidGeometry3D ( )

Constructs empty Geometry.

Definition at line 45 of file cuboidGeometry3D.hh.

46 : _motherCuboid(0,0,0,0,0,0,0), _periodicityOn(false), clout(std::cout, "CuboidGeometry3D")
47{
48 _cuboids.reserve(2);
49 add(_motherCuboid);
50 split(0, 1);
51}
void split(int iC, int p)
Splits cuboid iC, removes it and adds p cuboids of same volume.
void add(Cuboid3D< T > cuboid)
Adds a cuboid.

References olb::CuboidGeometry3D< T >::add(), and olb::CuboidGeometry3D< T >::split().

+ Here is the call graph for this function:

◆ CuboidGeometry3D() [2/9]

template<typename T >
olb::CuboidGeometry3D< T >::CuboidGeometry3D ( T originX,
T originY,
T originZ,
T deltaR,
int nX,
int nY,
int nZ,
int nC = 1 )

Constructs a cuboid geometry with a cubic shape of size nX times nY times nZ with origin originR=(originX, originY, originZ) that consists of nC cuboids.

Definition at line 54 of file cuboidGeometry3D.hh.

56 : _motherCuboid(originX, originY, originZ, deltaR, nX, nY, nZ),
57 _periodicityOn(false), clout(std::cout, "CuboidGeometry3D")
58{
59 _cuboids.reserve(nC+2);
60 add(_motherCuboid);
61 split(0, nC);
62}

References olb::CuboidGeometry3D< T >::add(), and olb::CuboidGeometry3D< T >::split().

+ Here is the call graph for this function:

◆ CuboidGeometry3D() [3/9]

template<typename T >
olb::CuboidGeometry3D< T >::CuboidGeometry3D ( std::vector< T > origin,
T deltaR,
std::vector< int > extent,
int nC = 1 )

Constructor with vectors.

Definition at line 65 of file cuboidGeometry3D.hh.

67 : CuboidGeometry3D(origin[0], origin[1], origin[2], deltaR,
68 extent[0], extent[1], extent[2], nC)
69{ }
CuboidGeometry3D()
Constructs empty Geometry.

◆ CuboidGeometry3D() [4/9]

template<typename T >
olb::CuboidGeometry3D< T >::CuboidGeometry3D ( Vector< T, 3 > origin,
T deltaR,
Vector< int, 3 > extent,
int nC = 1 )

Definition at line 72 of file cuboidGeometry3D.hh.

74 : CuboidGeometry3D(origin[0], origin[1], origin[2], deltaR,
75 extent[0], extent[1], extent[2], nC)
76{ }

◆ CuboidGeometry3D() [5/9]

template<typename T >
olb::CuboidGeometry3D< T >::CuboidGeometry3D ( const Cuboid3D< T > & motherCuboid,
int nC )

Construction from an alrealy existing mother cuboid.

Definition at line 79 of file cuboidGeometry3D.hh.

81 motherCuboid.getOrigin(), motherCuboid.getDeltaR(),
82 motherCuboid.getExtent(), nC)
83{ }

◆ CuboidGeometry3D() [6/9]

template<typename T >
olb::CuboidGeometry3D< T >::CuboidGeometry3D ( IndicatorF3D< T > & indicatorF,
T voxelSize,
int nC = 1 )

Constructs a cuboid structure with a uniform spacing of voxelSize which consists of nC cuboids, the cuboids not needed are removed and too big ones are shrinked.

Definition at line 86 of file cuboidGeometry3D.hh.

87 : _motherCuboid( indicatorF.getMin()[0], indicatorF.getMin()[1], indicatorF.getMin()[2], voxelSize,
88 (int)((indicatorF.getMax()[0] - indicatorF.getMin()[0]) / voxelSize + 1.5),
89 (int)((indicatorF.getMax()[1] - indicatorF.getMin()[1]) / voxelSize + 1.5),
90 (int)((indicatorF.getMax()[2] - indicatorF.getMin()[2]) / voxelSize + 1.5)),
91 _periodicityOn(false), clout(std::cout, "CuboidGeometry3D")
92{
93 _cuboids.reserve(nC+2);
94 add(_motherCuboid);
95 if (nC > 1) {
96 split(0, nC);
97 shrink(indicatorF);
98 }
99}
void shrink(int iC, IndicatorF3D< T > &indicatorF)
Shrink cuboid iC so that no empty planes are left.
virtual Vector< S, 3 > & getMax()
virtual Vector< S, 3 > & getMin()

References olb::CuboidGeometry3D< T >::add(), olb::CuboidGeometry3D< T >::shrink(), and olb::CuboidGeometry3D< T >::split().

+ Here is the call graph for this function:

◆ CuboidGeometry3D() [7/9]

template<typename T >
olb::CuboidGeometry3D< T >::CuboidGeometry3D ( std::shared_ptr< IndicatorF3D< T > > indicator_sharedPtrF,
T voxelSize,
int nC = 1 )

Definition at line 102 of file cuboidGeometry3D.hh.

103 : CuboidGeometry3D<T>(*indicator_sharedPtrF, voxelSize, nC)
104{
105}

◆ CuboidGeometry3D() [8/9]

template<typename T >
olb::CuboidGeometry3D< T >::CuboidGeometry3D ( IndicatorF3D< T > & indicatorF,
T voxelSize,
int nC,
std::string minimizeBy )

Constructs a cuboid structure with a uniform spacing of voxelSize which consists of nC cuboids, the cuboids not needed are removed and too big ones are shrinked. Uses an iterative method: Halves the largest child cuboid until the set number of cuboids is reached. Largest cuboid is determined by either volume or weight as choosen in minimizeBy.

Definition at line 108 of file cuboidGeometry3D.hh.

109 : _motherCuboid( indicatorF.getMin()[0], indicatorF.getMin()[1], indicatorF.getMin()[2], voxelSize,
110 (int)((indicatorF.getMax()[0] - indicatorF.getMin()[0]) / voxelSize + 1.5),
111 (int)((indicatorF.getMax()[1] - indicatorF.getMin()[1]) / voxelSize + 1.5),
112 (int)((indicatorF.getMax()[2] - indicatorF.getMin()[2]) / voxelSize + 1.5)),
113 _periodicityOn(false), clout(std::cout, "CuboidGeometry3D")
114{
115 _cuboids.reserve(nC+2);
116 add(_motherCuboid);
117
118 if ( minimizeBy == "volume" ) {
119 minimizeByVolume(*this, indicatorF, nC);
120 }
121 else if ( minimizeBy == "weight" ) {
122 minimizeByWeight(*this, indicatorF, nC);
123 }
124}
void minimizeByVolume(CuboidGeometry3D< T > &cGeometry, IndicatorF3D< T > &indicatorF, int nC)
Splits into nC cuboids by-volume.
void minimizeByWeight(CuboidGeometry3D< T > &cGeometry, IndicatorF3D< T > &indicatorF, int nC)

References olb::CuboidGeometry3D< T >::add(), olb::minimizeByVolume(), and olb::minimizeByWeight().

+ Here is the call graph for this function:

◆ CuboidGeometry3D() [9/9]

template<typename T >
olb::CuboidGeometry3D< T >::CuboidGeometry3D ( std::shared_ptr< IndicatorF3D< T > > indicator_sharedPtrF,
T voxelSize,
int nC,
std::string minimizeBy )

Definition at line 127 of file cuboidGeometry3D.hh.

128 : CuboidGeometry3D<T>(*indicator_sharedPtrF, voxelSize, nC, minimizeBy)
129{
130}

◆ ~CuboidGeometry3D()

template<typename T >
olb::CuboidGeometry3D< T >::~CuboidGeometry3D ( )
virtual

Destructs CuboidGeometry.

Definition at line 133 of file cuboidGeometry3D.hh.

133{};

Member Function Documentation

◆ add()

template<typename T >
void olb::CuboidGeometry3D< T >::add ( Cuboid3D< T > cuboid)

Adds a cuboid.

Definition at line 670 of file cuboidGeometry3D.hh.

671{
672
673 _cuboids.push_back(cuboid);
674}
+ Here is the caller graph for this function:

◆ clearCuboids()

template<typename T >
void olb::CuboidGeometry3D< T >::clearCuboids ( )
inline

Resets the cuboid array.

Definition at line 194 of file cuboidGeometry3D.h.

195 {
196 _cuboids.clear();
197 }
+ Here is the caller graph for this function:

◆ cuboids()

template<typename T >
std::vector< Cuboid3D< T > > & olb::CuboidGeometry3D< T >::cuboids ( )
inline

Definition at line 114 of file cuboidGeometry3D.h.

114 {
115 return _cuboids;
116 }
+ Here is the caller graph for this function:

◆ get() [1/2]

template<typename T >
Cuboid3D< T > & olb::CuboidGeometry3D< T >::get ( int iC)

Read and write access to a single cuboid.

Definition at line 137 of file cuboidGeometry3D.hh.

138{
139 return _cuboids[iC];
140}
+ Here is the caller graph for this function:

◆ get() [2/2]

template<typename T >
Cuboid3D< T > const & olb::CuboidGeometry3D< T >::get ( int iC) const

Read access to a single cuboid.

Definition at line 143 of file cuboidGeometry3D.hh.

144{
145 return _cuboids[iC];
146}

◆ get_iC() [1/3]

template<typename T >
int olb::CuboidGeometry3D< T >::get_iC ( T globX,
T globY,
T globZ,
int offset = 0 ) const

Gives for a given point (globX/globY/globZ) the related cuboidID and _p if the point is not in any of the cuboid _childrenQ.

Definition at line 170 of file cuboidGeometry3D.hh.

171{
172 unsigned i;
173 for (i = 0; i < _cuboids.size(); i++) {
174 if (_cuboids[i].checkPoint(x, y, z, offset)) {
175 return (int)i;
176 }
177 }
178 return (int)i;
179}

◆ get_iC() [2/3]

template<typename T >
int olb::CuboidGeometry3D< T >::get_iC ( T globX,
T globY,
T globZ,
int orientationX,
int orientationY,
int orientationZ ) const

This function checks if the points (globX/globY/globZ) and (globX + orientationX/delta/globY + orientationY/delta/ globZ + orientationZ/delta) is in a cuboid.

It gives the related cuboidID and _p if the points are not in any of the cuboids. util::abs(orientationX) = util::abs(orientationY) = util::abs(orientationY) = 1 must be satisfied

Definition at line 189 of file cuboidGeometry3D.hh.

191{
192 unsigned i;
193 for (i = 0; i < _cuboids.size(); i++) {
194 if (_cuboids[i].checkPoint(x, y, z) &&
195 _cuboids[i].checkPoint(x + orientationX / _cuboids[i].getDeltaR(),
196 y + orientationY / _cuboids[i].getDeltaR(),
197 z + orientationZ / _cuboids[i].getDeltaR())) {
198 return (int)i;
199 }
200 }
201 return (int)i;
202}

◆ get_iC() [3/3]

template<typename T >
int olb::CuboidGeometry3D< T >::get_iC ( Vector< T, 3 > coords,
int offset = 0 ) const

Definition at line 183 of file cuboidGeometry3D.hh.

184{
185 return get_iC(coords[0], coords[1], coords[2], offset);
186}
int get_iC(T globX, T globY, T globZ, int offset=0) const
Gives for a given point (globX/globY/globZ) the related cuboidID and _p if the point is not in any of...

◆ getBlock()

template<typename T >
bool * olb::CuboidGeometry3D< T >::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 1109 of file cuboidGeometry3D.hh.

1110{
1111 std::size_t currentBlock = 0;
1112 size_t sizeBufferIndex = 0;
1113 bool* dataPtr = nullptr;
1114
1115 registerVar<bool> (iBlock, sizeBlock, currentBlock, dataPtr, _periodicityOn[0], 3);
1116 registerSerializableOfConstSize (iBlock, sizeBlock, currentBlock, dataPtr, _motherCuboid, loadingMode);
1117 registerStdVectorOfSerializablesOfConstSize (iBlock, sizeBlock, currentBlock, sizeBufferIndex, dataPtr,
1118 _cuboids, loadingMode);
1119
1120 return dataPtr;
1121}
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
Definition serializer.h:418
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

◆ getC() [1/3]

template<typename T >
bool olb::CuboidGeometry3D< T >::getC ( const Vector< T, 3 > & physR,
int & iC ) const

Returns true and the cuboid number of the nearest lattice position to the given physical position if the physical position is within any of the cuboids with an overlap of 1/2*delta belonging to the cuboid geometry.

Definition at line 231 of file cuboidGeometry3D.hh.

232{
233 const int iCtmp = get_iC(physR);
234 if (iCtmp < getNc()) {
235 iC = iCtmp;
236 return true;
237 }
238 else {
239 return false;
240 }
241}
int getNc() const
Returns the number of cuboids in the structure.

◆ getC() [2/3]

template<typename T >
bool olb::CuboidGeometry3D< T >::getC ( std::vector< T > physR,
int & iC ) const

Returns true and the cuboid number of the nearest lattice position to the given physical position if the physical position is within any of the cuboids with an overlap of 1/2*delta belonging to the cuboid geometry.

Definition at line 218 of file cuboidGeometry3D.hh.

219{
220 const int iCtmp = get_iC(physR);
221 if (iCtmp < getNc()) {
222 iC = iCtmp;
223 return true;
224 }
225 else {
226 return false;
227 }
228}

◆ getC() [3/3]

template<typename T >
bool olb::CuboidGeometry3D< T >::getC ( T physR[3],
int & iC ) const

Returns true and the cuboid number of the nearest lattice position to the given physical position if the physical position is within any of the cuboids with an overlap of 1/2*delta belonging to the cuboid geometry.

Definition at line 205 of file cuboidGeometry3D.hh.

206{
207 const int iCtmp = get_iC(physR[0], physR[1], physR[2]);
208 if (iCtmp < getNc()) {
209 iC = iCtmp;
210 return true;
211 }
212 else {
213 return false;
214 }
215}
+ Here is the caller graph for this function:

◆ getFloorLatticeR() [1/2]

template<typename T >
bool olb::CuboidGeometry3D< T >::getFloorLatticeR ( const std::vector< T > & physR,
std::vector< int > & latticeR ) const

Returns true and the util::floor lattice position to the given physical position if the physical position is within any of the cuboids with an overlap of 1/2*delta belonging to the cuboid geometry.

Definition at line 260 of file cuboidGeometry3D.hh.

261{
262 int iCtmp = get_iC(physR[0], physR[1], physR[2]);
263 if (iCtmp < getNc()) {
264 latticeR[0] = iCtmp;
265 latticeR[1] = (int)util::floor( (physR[0] - _cuboids[latticeR[0]].getOrigin()[0] ) / _cuboids[latticeR[0]].getDeltaR() );
266 latticeR[2] = (int)util::floor( (physR[1] - _cuboids[latticeR[0]].getOrigin()[1] ) / _cuboids[latticeR[0]].getDeltaR() );
267 latticeR[3] = (int)util::floor( (physR[2] - _cuboids[latticeR[0]].getOrigin()[2] ) / _cuboids[latticeR[0]].getDeltaR() );
268 return true;
269 }
270 else {
271 return false;
272 }
273}
ADf< T, DIM > floor(const ADf< T, DIM > &a)
Definition aDiff.h:869

References olb::util::floor().

+ Here is the call graph for this function:

◆ getFloorLatticeR() [2/2]

template<typename T >
bool olb::CuboidGeometry3D< T >::getFloorLatticeR ( const Vector< T, 3 > & physR,
Vector< int, 4 > & latticeR ) const

Returns true and the util::floor lattice position to the given physical position if the physical position is within any of the cuboids with an overlap of 1/2*delta belonging to the cuboid geometry.

Definition at line 276 of file cuboidGeometry3D.hh.

278{
279 int iCtmp = get_iC(physR[0], physR[1], physR[2]);
280 if (iCtmp < getNc()) {
281 latticeR[0] = iCtmp;
282 latticeR[1] = (int)util::floor( (physR[0] - _cuboids[latticeR[0]].getOrigin()[0] ) / _cuboids[latticeR[0]].getDeltaR() );
283 latticeR[2] = (int)util::floor( (physR[1] - _cuboids[latticeR[0]].getOrigin()[1] ) / _cuboids[latticeR[0]].getDeltaR() );
284 latticeR[3] = (int)util::floor( (physR[2] - _cuboids[latticeR[0]].getOrigin()[2] ) / _cuboids[latticeR[0]].getDeltaR() );
285 return true;
286 }
287 else {
288 return false;
289 }
290}

References olb::util::floor().

+ Here is the call graph for this function:

◆ getLatticeR()

template<typename T >
bool olb::CuboidGeometry3D< T >::getLatticeR ( int latticeR[4],
const T physR[3] ) const

Returns true and the nearest lattice position to the given physical position if the physical position is within any of the cuboids with an overlap of 1/2*delta belonging to the cuboid geometry.

Definition at line 244 of file cuboidGeometry3D.hh.

245{
246 int iCtmp = get_iC(physR[0], physR[1], physR[2]);
247 if (iCtmp < getNc()) {
248 latticeR[0] = iCtmp;
249 latticeR[1] = (int)util::floor( (physR[0] - _cuboids[latticeR[0]].getOrigin()[0] ) / _cuboids[latticeR[0]].getDeltaR() + .5);
250 latticeR[2] = (int)util::floor( (physR[1] - _cuboids[latticeR[0]].getOrigin()[1] ) / _cuboids[latticeR[0]].getDeltaR() + .5);
251 latticeR[3] = (int)util::floor( (physR[2] - _cuboids[latticeR[0]].getOrigin()[2] ) / _cuboids[latticeR[0]].getDeltaR() + .5);
252 return true;
253 }
254 else {
255 return false;
256 }
257}

References olb::util::floor().

+ Here is the call graph for this function:

◆ getMaxDeltaR()

template<typename T >
T olb::CuboidGeometry3D< T >::getMaxDeltaR ( ) const

Returns the maximum delta in the structure.

Definition at line 647 of file cuboidGeometry3D.hh.

648{
649 T maxDelta = _cuboids[0].getDeltaR();
650 for (unsigned i = 0; i < _cuboids.size(); i++) {
651 if (_cuboids[i].getDeltaR() > maxDelta) {
652 maxDelta = _cuboids[i].getDeltaR();
653 }
654 }
655 return maxDelta;
656}

◆ getMaxLatticeVolume()

template<typename T >
size_t olb::CuboidGeometry3D< T >::getMaxLatticeVolume ( ) const

Returns the maximum number of nodes in the structure.

Definition at line 599 of file cuboidGeometry3D.hh.

600{
601 size_t maxNodes = _cuboids[0].getLatticeVolume();
602 for (unsigned i = 0; i < _cuboids.size(); i++) {
603 if (_cuboids[i].getLatticeVolume() > maxNodes) {
604 maxNodes = _cuboids[i].getLatticeVolume();
605 }
606 }
607 return maxNodes;
608}

◆ getMaxLatticeWeight()

template<typename T >
size_t olb::CuboidGeometry3D< T >::getMaxLatticeWeight ( ) const

Returns the maximum number of nodes in the structure inside the indicator.

Definition at line 623 of file cuboidGeometry3D.hh.

624{
625 size_t maxNodes = _cuboids[0].getWeight();
626 for (unsigned i = 0; i < _cuboids.size(); i++) {
627 if (_cuboids[i].getWeight() > maxNodes) {
628 maxNodes = _cuboids[i].getWeight();
629 }
630 }
631 return maxNodes;
632}

◆ getMaxPhysR()

template<typename T >
Vector< T, 3 > olb::CuboidGeometry3D< T >::getMaxPhysR ( ) const

Returns the maximum coordinate in the structure.

Definition at line 542 of file cuboidGeometry3D.hh.

543{
544 Vector<T,3> output (_cuboids[0].getOrigin());
545 output[0] += _cuboids[0].getNx()*_cuboids[0].getDeltaR();
546 output[1] += _cuboids[0].getNy()*_cuboids[0].getDeltaR();
547 output[2] += _cuboids[0].getNz()*_cuboids[0].getDeltaR();
548 for (unsigned i = 0; i < _cuboids.size(); i++) {
549 if (_cuboids[i].getOrigin()[0] + _cuboids[i].getNx()*_cuboids[i].getDeltaR() > output[0]) {
550 output[0] = _cuboids[i].getOrigin()[0] + _cuboids[i].getNx()*_cuboids[i].getDeltaR();
551 }
552 if (_cuboids[i].getOrigin()[1] + _cuboids[i].getNy()*_cuboids[i].getDeltaR() > output[1]) {
553 output[1] = _cuboids[i].getOrigin()[1] + _cuboids[i].getNy()*_cuboids[i].getDeltaR();
554 }
555 if (_cuboids[i].getOrigin()[2] + _cuboids[i].getNz()*_cuboids[i].getDeltaR() > output[2]) {
556 output[2] = _cuboids[i].getOrigin()[2] + _cuboids[i].getNz()*_cuboids[i].getDeltaR();
557 }
558 }
559 return output;
560}

◆ getMaxPhysVolume()

template<typename T >
T olb::CuboidGeometry3D< T >::getMaxPhysVolume ( ) const

Returns the maximum volume in the structure.

Definition at line 575 of file cuboidGeometry3D.hh.

576{
577 T maxVolume = _cuboids[0].getPhysVolume();
578 for (unsigned i = 0; i < _cuboids.size(); i++) {
579 if (_cuboids[i].getPhysVolume() > maxVolume) {
580 maxVolume = _cuboids[i].getPhysVolume();
581 }
582 }
583 return maxVolume;
584}

◆ getMaxRatio()

template<typename T >
T olb::CuboidGeometry3D< T >::getMaxRatio ( ) const

Returns the maximum of the ratio nX/NY in the structure.

Definition at line 506 of file cuboidGeometry3D.hh.

507{
508 T maxRatio = 1.;
509 for (unsigned i = 0; i < _cuboids.size(); i++) {
510 if ((T)_cuboids[i].getNx() / (T)_cuboids[i].getNy() > maxRatio) {
511 maxRatio = (T)_cuboids[i].getNx() / (T)_cuboids[i].getNy();
512 }
513 if ((T)_cuboids[i].getNy() / (T)_cuboids[i].getNz() > maxRatio) {
514 maxRatio = (T)_cuboids[i].getNy() / (T)_cuboids[i].getNz();
515 }
516 if ((T)_cuboids[i].getNz() / (T)_cuboids[i].getNx() > maxRatio) {
517 maxRatio = (T)_cuboids[i].getNz() / (T)_cuboids[i].getNx();
518 }
519 }
520 return maxRatio;
521}

◆ getMinDeltaR()

template<typename T >
T olb::CuboidGeometry3D< T >::getMinDeltaR ( ) const

Returns the minimum delta in the structure.

Definition at line 635 of file cuboidGeometry3D.hh.

636{
637 T minDelta = _cuboids[0].getDeltaR();
638 for (unsigned i = 0; i < _cuboids.size(); i++) {
639 if (_cuboids[i].getDeltaR() < minDelta) {
640 minDelta = _cuboids[i].getDeltaR();
641 }
642 }
643 return minDelta;
644}
+ Here is the caller graph for this function:

◆ getMinLatticeVolume()

template<typename T >
size_t olb::CuboidGeometry3D< T >::getMinLatticeVolume ( ) const

Returns the minimum number of nodes in the structure.

Definition at line 587 of file cuboidGeometry3D.hh.

588{
589 size_t minNodes = _cuboids[0].getLatticeVolume();
590 for (unsigned i = 0; i < _cuboids.size(); i++) {
591 if (_cuboids[i].getLatticeVolume() < minNodes) {
592 minNodes = _cuboids[i].getLatticeVolume();
593 }
594 }
595 return minNodes;
596}

◆ getMinLatticeWeight()

template<typename T >
size_t olb::CuboidGeometry3D< T >::getMinLatticeWeight ( ) const

Returns the minimum number of nodes in the structure inside the indicator.

Definition at line 611 of file cuboidGeometry3D.hh.

612{
613 size_t minNodes = _cuboids[0].getWeight();
614 for (unsigned i = 0; i < _cuboids.size(); i++) {
615 if (_cuboids[i].getWeight() < minNodes) {
616 minNodes = _cuboids[i].getWeight();
617 }
618 }
619 return minNodes;
620}

◆ getMinPhysR()

template<typename T >
Vector< T, 3 > olb::CuboidGeometry3D< T >::getMinPhysR ( ) const

Returns the minimum coordinate in the structure.

Definition at line 524 of file cuboidGeometry3D.hh.

525{
526 Vector<T,3> output (_cuboids[0].getOrigin());
527 for (unsigned i = 0; i < _cuboids.size(); i++) {
528 if (_cuboids[i].getOrigin()[0] < output[0]) {
529 output[0] = _cuboids[i].getOrigin()[0];
530 }
531 if (_cuboids[i].getOrigin()[1] < output[1]) {
532 output[1] = _cuboids[i].getOrigin()[1];
533 }
534 if (_cuboids[i].getOrigin()[2] < output[2]) {
535 output[2] = _cuboids[i].getOrigin()[2];
536 }
537 }
538 return output;
539}

◆ getMinPhysVolume()

template<typename T >
T olb::CuboidGeometry3D< T >::getMinPhysVolume ( ) const

Returns the minimum volume in the structure.

Definition at line 563 of file cuboidGeometry3D.hh.

564{
565 T minVolume = _cuboids[0].getPhysVolume();
566 for (unsigned i = 0; i < _cuboids.size(); i++) {
567 if (_cuboids[i].getPhysVolume() < minVolume) {
568 minVolume = _cuboids[i].getPhysVolume();
569 }
570 }
571 return minVolume;
572}

◆ getMinRatio()

template<typename T >
T olb::CuboidGeometry3D< T >::getMinRatio ( ) const

Returns the minimum of the ratio nX/NY in the structure.

Definition at line 488 of file cuboidGeometry3D.hh.

489{
490 T minRatio = 1.;
491 for (unsigned i = 0; i < _cuboids.size(); i++) {
492 if ((T)_cuboids[i].getNx() / (T)_cuboids[i].getNy() < minRatio) {
493 minRatio = (T)_cuboids[i].getNx() / (T)_cuboids[i].getNy();
494 }
495 if ((T)_cuboids[i].getNy() / (T)_cuboids[i].getNz() < minRatio) {
496 minRatio = (T)_cuboids[i].getNy() / (T)_cuboids[i].getNz();
497 }
498 if ((T)_cuboids[i].getNz() / (T)_cuboids[i].getNx() < minRatio) {
499 minRatio = (T)_cuboids[i].getNz() / (T)_cuboids[i].getNx();
500 }
501 }
502 return minRatio;
503}

◆ getMotherCuboid() [1/2]

template<typename T >
Cuboid3D< T > olb::CuboidGeometry3D< T >::getMotherCuboid ( )

Returns the smallest cuboid that includes all cuboids of the structure.

Definition at line 149 of file cuboidGeometry3D.hh.

150{
151 return _motherCuboid;
152}
+ Here is the caller graph for this function:

◆ getMotherCuboid() [2/2]

template<typename T >
Cuboid3D< T > const & olb::CuboidGeometry3D< T >::getMotherCuboid ( ) const

Definition at line 155 of file cuboidGeometry3D.hh.

156{
157 return _motherCuboid;
158}

◆ getNblock()

template<typename T >
size_t olb::CuboidGeometry3D< T >::getNblock ( ) const
overridevirtual

Number of data blocks for the serializer interface.

Implements olb::Serializable.

Definition at line 1090 of file cuboidGeometry3D.hh.

1091{
1092 return 1 // _periodicityOn
1093 + _motherCuboid.getNblock() // _motherCuboid
1094 + _cuboids.size() > 0 ? 1 + _cuboids.size() * _cuboids[0].getNblock() : 0; // _cuboids;
1095}

◆ getNc()

template<typename T >
int olb::CuboidGeometry3D< T >::getNc ( ) const

Returns the number of cuboids in the structure.

Definition at line 482 of file cuboidGeometry3D.hh.

483{
484 return _cuboids.size();
485}
+ Here is the caller graph for this function:

◆ getNeighbourhood()

template<typename T >
void olb::CuboidGeometry3D< T >::getNeighbourhood ( int cuboid,
std::vector< int > & neighbours,
int overlap = 0 )

Stores the iC of the neighbouring cuboids in a vector;.

Definition at line 336 of file cuboidGeometry3D.hh.

337{
338 neighbours.clear();
339
340 std::set<int> dummy;
341
342 for (int iC = 0; iC < getNc(); iC++) {
343 if (cuboid == iC) {
344 continue;
345 }
346 T globX = get(iC).getOrigin()[0];
347 T globY = get(iC).getOrigin()[1];
348 T globZ = get(iC).getOrigin()[2];
349 T nX = get(iC).getNx();
350 T nY = get(iC).getNy();
351 T nZ = get(iC).getNz();
352 T deltaR = get(iC).getDeltaR();
353 if (get(cuboid).checkInters(globX,
354 globX + (nX + overlap - 1)*deltaR,
355 globY - overlap * deltaR,
356 globY + (nY + overlap - 1)*deltaR,
357 globZ - overlap * deltaR,
358 globZ + (nZ + overlap - 1)*deltaR, overlap)) {
359 //neighbours.push_back(iC);
360 dummy.insert(iC);
361 }
362
363 if (_periodicityOn[0]) {
364 if (get(cuboid).getOrigin()[0] + (get(cuboid).getNx() + overlap - 1)*get(cuboid).getDeltaR() > getMaxPhysR()[0]) {
365 Cuboid3D<T> cub(get(cuboid).getOrigin()[0]-getMaxPhysR()[0],
366 get(cuboid).getOrigin()[1],
367 get(cuboid).getOrigin()[2],
368 get(cuboid).getDeltaR(),
369 get(cuboid).getNx(),
370 get(cuboid).getNy(),
371 get(cuboid).getNz());
372 if (cub.checkInters(globX - overlap * deltaR,
373 globX + (nX + overlap - 1)*deltaR,
374 globY - overlap * deltaR,
375 globY + (nY + overlap - 1)*deltaR,
376 globZ - overlap * deltaR,
377 globZ + (nZ + overlap - 1)*deltaR, overlap)) {
378 dummy.insert(iC);
379 }
380 }
381 if (get(cuboid).getOrigin()[0] - overlap*get(cuboid).getDeltaR() < getMinPhysR()[0]) {
382 Cuboid3D<T> cub(get(cuboid).getOrigin()[0]+getMaxPhysR()[0],
383 get(cuboid).getOrigin()[1],
384 get(cuboid).getOrigin()[2],
385 get(cuboid).getDeltaR(),
386 get(cuboid).getNx(),
387 get(cuboid).getNy(),
388 get(cuboid).getNz());
389 if (cub.checkInters(globX - overlap * deltaR,
390 globX + (nX + overlap - 1)*deltaR,
391 globY - overlap * deltaR,
392 globY + (nY + overlap - 1)*deltaR,
393 globZ - overlap * deltaR,
394 globZ + (nZ + overlap - 1)*deltaR, overlap)) {
395 dummy.insert(iC);
396 }
397 }
398 }
399
400 if (_periodicityOn[1]) {
401 if (get(cuboid).getOrigin()[1] + (get(cuboid).getNy() + overlap - 1)*get(cuboid).getDeltaR() > getMaxPhysR()[1]) {
402 Cuboid3D<T> cub(get(cuboid).getOrigin()[0],
403 get(cuboid).getOrigin()[1]-getMaxPhysR()[1],
404 get(cuboid).getOrigin()[2],
405 get(cuboid).getDeltaR(),
406 get(cuboid).getNx(),
407 get(cuboid).getNy(),
408 get(cuboid).getNz());
409 if (cub.checkInters(globX - overlap * deltaR,
410 globX + (nX + overlap - 1)*deltaR,
411 globY - overlap * deltaR,
412 globY + (nY + overlap - 1)*deltaR,
413 globZ - overlap * deltaR,
414 globZ + (nZ + overlap - 1)*deltaR, overlap)) {
415 dummy.insert(iC);
416 }
417 }
418 if (get(cuboid).getOrigin()[1] - overlap*get(cuboid).getDeltaR() < getMinPhysR()[1]) {
419 Cuboid3D<T> cub(get(cuboid).getOrigin()[0],
420 get(cuboid).getOrigin()[1]+getMaxPhysR()[1],
421 get(cuboid).getOrigin()[2],
422 get(cuboid).getDeltaR(),
423 get(cuboid).getNx(),
424 get(cuboid).getNy(),
425 get(cuboid).getNz());
426 if (cub.checkInters(globX - overlap * deltaR,
427 globX + (nX + overlap - 1)*deltaR,
428 globY - overlap * deltaR,
429 globY + (nY + overlap - 1)*deltaR,
430 globZ - overlap * deltaR,
431 globZ + (nZ + overlap - 1)*deltaR, overlap)) {
432 dummy.insert(iC);
433 }
434 }
435 }
436
437 if (_periodicityOn[2]) {
438 if (get(cuboid).getOrigin()[2] + (get(cuboid).getNz() + overlap - 1)*get(cuboid).getDeltaR() > getMaxPhysR()[2]) {
439 Cuboid3D<T> cub(get(cuboid).getOrigin()[0],
440 get(cuboid).getOrigin()[1],
441 get(cuboid).getOrigin()[2]-getMaxPhysR()[2],
442 get(cuboid).getDeltaR(),
443 get(cuboid).getNx(),
444 get(cuboid).getNy(),
445 get(cuboid).getNz());
446 if (cub.checkInters(globX - overlap * deltaR,
447 globX + (nX + overlap - 1)*deltaR,
448 globY - overlap * deltaR,
449 globY + (nY + overlap - 1)*deltaR,
450 globZ - overlap * deltaR,
451 globZ + (nZ + overlap - 1)*deltaR, overlap)) {
452 dummy.insert(iC);
453 }
454 }
455 if (get(cuboid).getOrigin()[2] - overlap*get(cuboid).getDeltaR() < getMinPhysR()[2]) {
456 Cuboid3D<T> cub(get(cuboid).getOrigin()[0],
457 get(cuboid).getOrigin()[1],
458 get(cuboid).getOrigin()[2]+getMaxPhysR()[2],
459 get(cuboid).getDeltaR(),
460 get(cuboid).getNx(),
461 get(cuboid).getNy(),
462 get(cuboid).getNz());
463 if (cub.checkInters(globX - overlap * deltaR,
464 globX + (nX + overlap - 1)*deltaR,
465 globY - overlap * deltaR,
466 globY + (nY + overlap - 1)*deltaR,
467 globZ - overlap * deltaR,
468 globZ + (nZ + overlap - 1)*deltaR, overlap)) {
469 dummy.insert(iC);
470 }
471 }
472 }
473
474 }
475 std::set<int>::iterator it = dummy.begin();
476 for (; it != dummy.end(); ++it) {
477 neighbours.push_back(*it);
478 }
479}
Cuboid3D< T > & get(int iC)
Read and write access to a single cuboid.
Vector< T, 3 > getMinPhysR() const
Returns the minimum coordinate in the structure.
Vector< T, 3 > getMaxPhysR() const
Returns the maximum coordinate in the structure.

References olb::Cuboid3D< T >::checkInters().

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

◆ getPhysR() [1/4]

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

Definition at line 330 of file cuboidGeometry3D.hh.

331{
332 getPhysR(physR, iCglob, latticeR[0], latticeR[1], latticeR[2]);
333}
void getPhysR(T physR[3], const int &iCglob, const int &iX, const int &iY, const int &iZ) const
Returns the physical position to the given lattice position respecting periodicity for the overlap no...

◆ getPhysR() [2/4]

template<typename T >
void olb::CuboidGeometry3D< T >::getPhysR ( T physR[3],
const int & iCglob,
const int & iX,
const int & iY,
const int & iZ ) const

Returns the physical position to the given lattice position respecting periodicity for the overlap nodes which are not in the mother cuboid for the case the flag periodicityOn[iDim]=true if the physical position is within any of the cuboids with an overlap of 1/2*delta belonging to the cuboid geometry.

Definition at line 293 of file cuboidGeometry3D.hh.

294{
295 _cuboids[iCglob].getPhysR(physR, iX, iY, iZ);
296 for (int iDim = 0; iDim < 3; iDim++) {
297 if (_periodicityOn[iDim]) {
298 //std::cout << "!!! " << iDim << _periodicityOn[iDim] <<":"<< _motherCuboid.getDeltaR()*(_motherCuboid.getExtent()[iDim]) << std::endl;
299 physR[iDim] = remainder( physR[iDim] - _motherCuboid.getOrigin()[iDim]
300 + _motherCuboid.getDeltaR() * (_motherCuboid.getExtent()[iDim]),
301 _motherCuboid.getDeltaR() * (_motherCuboid.getExtent()[iDim]));
302 // solving the rounding error problem for double
303 if ( physR[iDim]*physR[iDim] < 0.001 * _motherCuboid.getDeltaR()*_motherCuboid.getDeltaR() ) {
304 physR[iDim] = T();
305 }
306 // make it to mod instead remainer
307 if ( physR[iDim] < 0 ) {
308 physR[iDim] += _motherCuboid.getDeltaR() *( _motherCuboid.getExtent()[iDim]);
309 }
310 // add origin
311 physR[iDim] += _motherCuboid.getOrigin()[iDim];
312 }
313 }
314 return;
315}
+ Here is the caller graph for this function:

◆ getPhysR() [3/4]

template<typename T >
void olb::CuboidGeometry3D< T >::getPhysR ( T physR[3],
const int latticeR[4] ) const

Returns the physical position to the given lattice position respecting periodicity for the overlap nodes which are not in the mother cuboid for the case the flag periodicityOn[iDim]=true.

Definition at line 318 of file cuboidGeometry3D.hh.

319{
320 getPhysR(physR, latticeR[0], latticeR[1], latticeR[2], latticeR[3]);
321}

◆ getPhysR() [4/4]

template<typename T >
void olb::CuboidGeometry3D< T >::getPhysR ( T physR[3],
LatticeR< 4 > latticeR ) const

Definition at line 324 of file cuboidGeometry3D.hh.

325{
326 getPhysR(physR, latticeR[0], latticeR[1], latticeR[2], latticeR[3]);
327}

◆ getSerializableSize()

template<typename T >
size_t olb::CuboidGeometry3D< T >::getSerializableSize ( ) const
overridevirtual

Binary size for the serializer interface.

Implements olb::Serializable.

Definition at line 1099 of file cuboidGeometry3D.hh.

1100{
1101 return 3 * sizeof(bool) // _periodicityOn
1102 + _motherCuboid.getSerializableSize() // _motherCuboid
1103 + (_cuboids.size() > 0 ?
1104 sizeof(size_t) + _cuboids.size() * _cuboids[0].getSerializableSize() :
1105 0); // _cuboids;
1106}

◆ hypotheticalReplaceContainedBy()

template<typename T >
std::size_t olb::CuboidGeometry3D< T >::hypotheticalReplaceContainedBy ( Cuboid3D< T > mother)

◆ operator==()

template<typename T >
bool olb::CuboidGeometry3D< T >::operator== ( CuboidGeometry3D< T > & rhs)

Compares two CuboidGeometries.

Definition at line 660 of file cuboidGeometry3D.hh.

661{
662 return _motherCuboid == rhs._motherCuboid
663 && _periodicityOn == rhs._periodicityOn
664 && _cuboids == rhs._cuboids;
665}

◆ print()

template<typename T >
void olb::CuboidGeometry3D< T >::print ( ) const

Prints cuboid geometry details.

Definition at line 1125 of file cuboidGeometry3D.hh.

1126{
1127 clout << "---Cuboid Stucture Statistics---" << std::endl;
1128 clout << " Number of Cuboids: " << "\t" << getNc() << std::endl;
1129 clout << " Delta (min): " << "\t" << "\t" << getMinDeltaR() << std::endl;
1130 clout << " (max): " << "\t" << "\t" << getMaxDeltaR() << std::endl;
1131 clout << " Ratio (min): " << "\t" << "\t" << getMinRatio() << std::endl;
1132 clout << " (max): " << "\t" << "\t" << getMaxRatio() << std::endl;
1133 clout << " Nodes (min): " << "\t" << "\t" << getMinLatticeVolume() << std::endl;
1134 clout << " (max): " << "\t" << "\t" << getMaxLatticeVolume() << std::endl;
1135 clout << " Weight (min): " << "\t" << "\t" << getMinLatticeWeight() << std::endl;
1136 clout << " (max): " << "\t" << "\t" << getMaxLatticeWeight() << std::endl;
1137 clout << "--------------------------------" << std::endl;
1138}
T getMinRatio() const
Returns the minimum of the ratio nX/NY in the structure.
T getMaxRatio() const
Returns the maximum of the ratio nX/NY in the structure.
T getMaxDeltaR() const
Returns the maximum delta in the structure.
size_t getMaxLatticeVolume() const
Returns the maximum number of nodes in the structure.
size_t getMinLatticeVolume() const
Returns the minimum number of nodes in the structure.
size_t getMaxLatticeWeight() const
Returns the maximum number of nodes in the structure inside the indicator.
T getMinDeltaR() const
Returns the minimum delta in the structure.
size_t getMinLatticeWeight() const
Returns the minimum number of nodes in the structure inside the indicator.

◆ printExtended()

template<typename T >
void olb::CuboidGeometry3D< T >::printExtended ( )

Prints cuboid geometry details plus details of all cuboids.

Definition at line 1141 of file cuboidGeometry3D.hh.

1142{
1143 clout << "Mothercuboid :" << std::endl;
1144 getMotherCuboid().print();
1145
1146 for (int iC = 0; iC < getNc(); iC++) {
1147 clout << "Cuboid #" << iC << ": " << std::endl;
1148 get(iC).print();
1149 }
1150}
Cuboid3D< T > getMotherCuboid()
Returns the smallest cuboid that includes all cuboids of the structure.

◆ refine()

template<typename T >
void olb::CuboidGeometry3D< T >::refine ( int factor)

Refines mesh by splitting each cell into factor^3 cells.

Definition at line 802 of file cuboidGeometry3D.hh.

803{
804 _motherCuboid.refine(factor);
805 for (auto& cuboid : _cuboids) {
806 cuboid.refine(factor);
807 }
808}

◆ remove() [1/2]

template<typename T >
void olb::CuboidGeometry3D< T >::remove ( IndicatorF3D< T > & indicatorF)

Removes all cuboids where indicatorF = 0.

Definition at line 685 of file cuboidGeometry3D.hh.

686{
687 std::vector<bool> allZero;
688 int latticeR[4];
689 T physR[3];
690 for (unsigned iC = 0; iC < _cuboids.size(); iC++) {
691 latticeR[0] = iC;
692 allZero.push_back(true);
693 for (int iX = 0; iX < _cuboids[iC].getNx(); iX++) {
694 for (int iY = 0; iY < _cuboids[iC].getNy(); iY++) {
695 for (int iZ = 0; iZ < _cuboids[iC].getNz(); iZ++) {
696 latticeR[1] = iX;
697 latticeR[2] = iY;
698 latticeR[3] = iZ;
699 getPhysR(physR,latticeR);
700 bool inside[1];
701 indicatorF(inside,physR);
702 if (inside[0]) {
703 allZero[iC] = 0;
704 }
705 }
706 }
707 }
708 }
709 for (int iC = _cuboids.size() - 1; iC >= 0; iC--) {
710 if (allZero[iC] ) {
711 remove(iC);
712 }
713 }
714}
void remove(int iC)
Removes the cuboid iC.

◆ remove() [2/2]

template<typename T >
void olb::CuboidGeometry3D< T >::remove ( int iC)

Removes the cuboid iC.

Definition at line 677 of file cuboidGeometry3D.hh.

678{
679
680 _cuboids.erase(_cuboids.begin() + iC);
681}
+ Here is the caller graph for this function:

◆ removeByWeight()

template<typename T >
void olb::CuboidGeometry3D< T >::removeByWeight ( )

Removes all cuboids where weight = 0.

Definition at line 717 of file cuboidGeometry3D.hh.

718{
719 std::vector<bool> allZero(_cuboids.size(), false);
720 for (unsigned iC = 0; iC < _cuboids.size(); iC++) {
721 allZero[iC] = (_cuboids[iC].getWeight() == 0);
722 }
723 for (int iC = _cuboids.size() - 1; iC >= 0; iC--) {
724 if (allZero[iC]) {
725 remove(iC);
726 }
727 }
728}

◆ replaceContainedBy()

template<typename T >
std::size_t olb::CuboidGeometry3D< T >::replaceContainedBy ( Cuboid3D< T > mother)

◆ replaceCuboids()

template<typename T >
void olb::CuboidGeometry3D< T >::replaceCuboids ( std::vector< Cuboid3D< T > > & cuboids)

Replace the vector of cuboids.

Definition at line 1048 of file cuboidGeometry3D.hh.

1049{
1050 this->_cuboids.clear();
1051 for ( unsigned iC = 0; iC < cuboids.size(); iC++) {
1052 add(cuboids[iC]);
1053 }
1054}
std::vector< Cuboid3D< T > > & cuboids()

◆ setPeriodicity()

template<typename T >
void olb::CuboidGeometry3D< T >::setPeriodicity ( bool periodicityX,
bool periodicityY,
bool periodicityZ )

Set flag to enable/disable periodicity depending of direction. Be aware that not all directions are true to ensure boundary conditions like for velocity are not disturbed.

Definition at line 161 of file cuboidGeometry3D.hh.

162{
163 _periodicityOn[0] = periodicityX;
164 _periodicityOn[1] = periodicityY;
165 _periodicityOn[2] = periodicityZ;
166}

◆ setWeights()

template<typename T >
void olb::CuboidGeometry3D< T >::setWeights ( IndicatorF3D< T > & indicatorF)

Sets the number of full cells of each cuboid.

Definition at line 1057 of file cuboidGeometry3D.hh.

1058{
1059 #ifdef PARALLEL_MODE_OMP
1060 #pragma omp parallel for schedule(dynamic,1)
1061 #endif
1062 for (int iC=0; iC < getNc(); ++iC) {
1063 int latticeR[4] { iC, 0, 0, 0 };
1064 T physR[3];
1065 int xN = get(iC).getNx();
1066 int yN = get(iC).getNy();
1067 int zN = get(iC).getNz();
1068 size_t fullCells = 0;
1069 for (int iX = 0; iX < xN; iX++) {
1070 for (int iY = 0; iY < yN; iY++) {
1071 for (int iZ = 0; iZ < zN; iZ++) {
1072 latticeR[1] = iX;
1073 latticeR[2] = iY;
1074 latticeR[3] = iZ;
1075 getPhysR(physR,latticeR);
1076 bool inside[1];
1077 indicatorF(inside,physR);
1078 if (inside[0]) {
1079 fullCells++;
1080 }
1081 }
1082 }
1083 }
1084 get(iC).setWeight(fullCells);
1085 }
1086}
+ Here is the caller graph for this function:

◆ shrink() [1/2]

template<typename T >
void olb::CuboidGeometry3D< T >::shrink ( IndicatorF3D< T > & indicatorF)

Shrink all cuboids so that no empty planes are left.

Definition at line 786 of file cuboidGeometry3D.hh.

787{
788 for (int iC = getNc() - 1; iC >= 0; iC--) {
789 shrink(iC, indicatorF);
790 }
791 // shrink mother cuboid
792 Vector<T,3> minPhysR = getMinPhysR();
793 Vector<T,3> maxPhysR = getMaxPhysR();
794 T minDelataR = getMinDeltaR();
795 _motherCuboid = Cuboid3D<T>(minPhysR[0], minPhysR[1], minPhysR[2], minDelataR,
796 (int)((maxPhysR[0]-minPhysR[0])/minDelataR + 0.5),
797 (int)((maxPhysR[1]-minPhysR[1])/minDelataR + 0.5),
798 (int)((maxPhysR[2]-minPhysR[2])/minDelataR + 0.5));
799}

◆ shrink() [2/2]

template<typename T >
void olb::CuboidGeometry3D< T >::shrink ( int iC,
IndicatorF3D< T > & indicatorF )

Shrink cuboid iC so that no empty planes are left.

Definition at line 731 of file cuboidGeometry3D.hh.

732{
733 int latticeR[4];
734 T physR[3];
735 bool inside[1];
736
737 latticeR[0] = iC;
738 size_t fullCells = 0;
739 int xN = get(iC).getNx();
740 int yN = get(iC).getNy();
741 int zN = get(iC).getNz();
742 int maxX = 0;
743 int maxY = 0;
744 int maxZ = 0;
745 int newX = xN - 1;
746 int newY = yN - 1;
747 int newZ = zN - 1;
748 for (int iX = 0; iX < xN; iX++) {
749 for (int iY = 0; iY < yN; iY++) {
750 for (int iZ = 0; iZ < zN; iZ++) {
751 latticeR[1] = iX;
752 latticeR[2] = iY;
753 latticeR[3] = iZ;
754 getPhysR(physR,latticeR);
755 indicatorF(inside,physR);
756 if (inside[0]) {
757 fullCells++;
758 maxX = util::max(maxX, iX);
759 maxY = util::max(maxY, iY);
760 maxZ = util::max(maxZ, iZ);
761 newX = util::min(newX, iX);
762 newY = util::min(newY, iY);
763 newZ = util::min(newZ, iZ);
764 }
765 }
766 }
767 }
768 // if (maxX+2 < xN) maxX+=2; else if (maxX+1 < xN) maxX+=1;
769 // if (maxY+2 < yN) maxY+=2; else if (maxY+1 < yN) maxY+=1;
770 // if (maxZ+2 < zN) maxZ+=2; else if (maxZ+1 < zN) maxZ+=1;
771 //
772 // if (newX-2 >= 0) newX-=2; else if (newX-1 >= 0) newX-=1;
773 // if (newY-2 >= 0) newY-=2; else if (newY-1 >= 0) newY-=1;
774 // if (newZ-2 >= 0) newZ-=2; else if (newZ-1 >= 0) newZ-=1;
775
776 if (fullCells > 0) {
777 get(iC).setWeight(fullCells);
778 _cuboids[iC].resize(newX, newY, newZ, maxX - newX + 1, maxY - newY + 1, maxZ - newZ + 1);
779 }
780 else {
781 remove(iC);
782 }
783}
cpu::simd::Pack< T > min(cpu::simd::Pack< T > rhs, cpu::simd::Pack< T > lhs)
Definition pack.h:124
cpu::simd::Pack< T > max(cpu::simd::Pack< T > rhs, cpu::simd::Pack< T > lhs)
Definition pack.h:130

References olb::util::max(), and olb::util::min().

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

◆ split()

template<typename T >
void olb::CuboidGeometry3D< T >::split ( int iC,
int p )

Splits cuboid iC, removes it and adds p cuboids of same volume.

Definition at line 825 of file cuboidGeometry3D.hh.

826{
827 Cuboid3D<T> temp(_cuboids[iC].getOrigin()[0], _cuboids[iC].getOrigin()[1],
828 _cuboids[iC].getOrigin()[2], _cuboids[iC].getDeltaR(),
829 _cuboids[iC].getNx(), _cuboids[iC].getNy(), _cuboids[iC].getNz());
830 temp.divide(p, _cuboids);
831 remove(iC);
832}

References olb::Cuboid3D< T >::divide().

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

◆ splitByWeight()

template<typename T >
void olb::CuboidGeometry3D< T >::splitByWeight ( int iC,
int p,
IndicatorF3D< T > & indicatorF )

Splits cuboid iC, removes it and adds p cuboids of same weight.

Definition at line 848 of file cuboidGeometry3D.hh.

849{
850 T averageWeight = get(iC).getWeight() / (T) p;
851 // clout << "Mother " << get(iC).getWeight() << " " << averageWeight << std::endl;
852 Cuboid3D<T> temp(_cuboids[iC].getOrigin()[0], _cuboids[iC].getOrigin()[1],
853 _cuboids[iC].getOrigin()[2], _cuboids[iC].getDeltaR(),
854 _cuboids[iC].getNx(), _cuboids[iC].getNy(), _cuboids[iC].getNz());
855
856 int latticeR[4];
857 T physR[3];
858 latticeR[0] = iC;
859 int xN = get(iC).getNx();
860 int yN = get(iC).getNy();
861 int zN = get(iC).getNz();
862 T deltaR = get(iC).getDeltaR();
863 int fullCells = 0;
864
865 Vector<T, 3> globPos_child = get(iC).getOrigin();
866 std::vector<int> extend_child = {xN, yN, zN};
867 int localPos_child = 0;
868
869 // looking for largest extend, because halfing the cuboid by its largest extend will result in the smallest surface and therfore in the least comminication cells
870 if ( get(iC).getNx() >= get(iC).getNy() && get(iC).getNx() >= get(iC).getNz()) {
871 // clout << "Cut in x direction!" << std::endl;
872
873 // for each child cuboid search for the optimal cutting plane
874 for ( int iChild = 0; iChild < p - 1; iChild++) {
875 fullCells = 0;
876 int fullCells_minusOne = 0;
877
878 for (int iX = localPos_child; iX < xN; iX++) {
879 fullCells_minusOne = fullCells;
880 for (int iY = 0; iY < yN; iY++) {
881 for (int iZ = 0; iZ < zN; iZ++) {
882 latticeR[1] = iX;
883 latticeR[2] = iY;
884 latticeR[3] = iZ;
885 getPhysR(physR,latticeR);
886 bool inside[1];
887 indicatorF(inside,physR);
888 if (inside[0]) {
889 fullCells++;
890 }
891 }
892 }
893 // the optimal cutting plane is determined, so that the child cuboid's cells inside the indicator are the closest to the total cells inside the indicator per number of children
894 if ( fullCells >= averageWeight ) {
895 if ( (fullCells - averageWeight) > (averageWeight - fullCells_minusOne) ) {
896 iX--;
897 }
898 // clout << "found optimal iX = " << iX << std::endl;
899 extend_child[0] = iX - localPos_child + 1;
900
901 Cuboid3D<T> child(globPos_child[0], globPos_child[1], globPos_child[2], deltaR, extend_child[0], extend_child[1], extend_child[2]);
902 _cuboids.push_back(child);
903
904 globPos_child[0] += extend_child[0]*deltaR;
905 localPos_child += extend_child[0] + 1;
906 // clout << "added child " << iChild << " of " << p << std::endl;
907
908 break;
909 }
910 }
911
912 }
913
914 extend_child[0] = xN - localPos_child + p - 1;
915
916 Cuboid3D<T> child(globPos_child[0], globPos_child[1], globPos_child[2], deltaR, extend_child[0], extend_child[1], extend_child[2]);
917 _cuboids.push_back(child);
918
919 // clout << "added last child of " << p << std::endl;
920
921 }
922 else if ( get(iC).getNy() >= get(iC).getNx() && get(iC).getNy() >= get(iC).getNz()) {
923 // clout << "Cut in y direction!" << std::endl;
924
925 for ( int iChild = 0; iChild < p - 1; iChild++) {
926 fullCells = 0;
927 int fullCells_minusOne = 0;
928
929 for (int iY = localPos_child; iY < yN; iY++) {
930 fullCells_minusOne = fullCells;
931 for (int iX = 0; iX < xN; iX++) {
932 for (int iZ = 0; iZ < zN; iZ++) {
933 latticeR[1] = iX;
934 latticeR[2] = iY;
935 latticeR[3] = iZ;
936 getPhysR(physR,latticeR);
937 bool inside[1];
938 indicatorF(inside,physR);
939 if (inside[0]) {
940 fullCells++;
941 }
942 }
943 }
944 if ( fullCells >= averageWeight ) {
945 if ( (fullCells - averageWeight) > (averageWeight - fullCells_minusOne) ) {
946 iY--;
947 }
948 // clout << "found optimal iY = " << iY << std::endl;
949 extend_child[1] = iY - localPos_child + 1;
950
951 Cuboid3D<T> child(globPos_child[0], globPos_child[1], globPos_child[2], deltaR, extend_child[0], extend_child[1], extend_child[2]);
952 _cuboids.push_back(child);
953
954 globPos_child[1] += extend_child[1]*deltaR;
955 localPos_child += extend_child[1] + 1;
956 // clout << "added child " << iChild << " of " << p << std::endl;
957
958 break;
959 }
960 }
961
962 }
963
964 extend_child[1] = yN - localPos_child + p - 1;
965
966 Cuboid3D<T> child(globPos_child[0], globPos_child[1], globPos_child[2], deltaR, extend_child[0], extend_child[1], extend_child[2]);
967 _cuboids.push_back(child);
968
969 // clout << "added last child of " << p << std::endl;
970 }
971 else {
972 // clout << "Cut in z direction!" << std::endl;
973
974 for ( int iChild = 0; iChild < p - 1; iChild++) {
975 fullCells = 0;
976 int fullCells_minusOne = 0;
977
978 for (int iZ = localPos_child; iZ < zN; iZ++) {
979 fullCells_minusOne = fullCells;
980 for (int iY = 0; iY < yN; iY++) {
981 for (int iX = 0; iX < xN; iX++) {
982 latticeR[1] = iX;
983 latticeR[2] = iY;
984 latticeR[3] = iZ;
985 getPhysR(physR,latticeR);
986 bool inside[1];
987 indicatorF(inside,physR);
988 if (inside[0]) {
989 fullCells++;
990 }
991 }
992 }
993 if ( fullCells >= averageWeight ) {
994 if ( (fullCells - averageWeight) > (averageWeight - fullCells_minusOne) ) {
995 iZ--;
996 }
997 // clout << "found optimal iZ = " << iZ << std::endl;
998 extend_child[2] = iZ - localPos_child + 1;
999
1000 Cuboid3D<T> child(globPos_child[0], globPos_child[1], globPos_child[2], deltaR, extend_child[0], extend_child[1], extend_child[2]);
1001 _cuboids.push_back(child);
1002
1003 globPos_child[2] += extend_child[2]*deltaR;
1004 localPos_child += extend_child[2] + 1;
1005 // clout << "added child " << iChild << " of " << p << std::endl;
1006
1007 break;
1008 }
1009 }
1010
1011 }
1012
1013 extend_child[2] = zN - localPos_child + p - 1;
1014
1015 Cuboid3D<T> child(globPos_child[0], globPos_child[1], globPos_child[2], deltaR, extend_child[0], extend_child[1], extend_child[2]);
1016 _cuboids.push_back(child);
1017
1018 // clout << "added last child of " << p << std::endl;
1019 }
1020}
+ Here is the caller graph for this function:

◆ splitFractional()

template<typename T >
void olb::CuboidGeometry3D< T >::splitFractional ( int iC,
int iD,
std::vector< T > fractions )

Splits cuboid iC along dimension iD into cuboids of fractions.

Definition at line 1023 of file cuboidGeometry3D.hh.

1024{
1025 Cuboid3D<T> tmp = _cuboids[iC];
1026 tmp.divideFractional(iD, fractions, _cuboids);
1027 remove(iC);
1028}

References olb::Cuboid3D< T >::divideFractional().

+ Here is the call graph for this function:

◆ splitRegular()

template<typename T >
void olb::CuboidGeometry3D< T >::splitRegular ( int iC,
int width )

Splits cuboid iC, removes it, adds approx. width^3 sized new cuboids.

Definition at line 835 of file cuboidGeometry3D.hh.

836{
837 Cuboid3D<T> temp(_cuboids[iC].getOrigin()[0], _cuboids[iC].getOrigin()[1],
838 _cuboids[iC].getOrigin()[2], _cuboids[iC].getDeltaR(),
839 _cuboids[iC].getNx(), _cuboids[iC].getNy(), _cuboids[iC].getNz());
840 const int p = std::max(1, temp.getNx() / width);
841 const int q = std::max(1, temp.getNy() / width);
842 const int r = std::max(1, temp.getNz() / width);
843 temp.divide(p, q, r, _cuboids);
844 remove(iC);
845}
constexpr int q() any_platform

References olb::Cuboid3D< T >::divide(), olb::Cuboid3D< T >::getNx(), olb::Cuboid3D< T >::getNy(), and olb::Cuboid3D< T >::getNz().

+ Here is the call graph for this function:

◆ swap()

template<typename T >
void olb::CuboidGeometry3D< T >::swap ( CuboidGeometry3D< T > & rhs)

Swaps data from input into object.

Definition at line 1031 of file cuboidGeometry3D.hh.

1032{
1033 std::swap(this->_cuboids, rhs._cuboids);
1034 std::swap(this->_motherCuboid, rhs._motherCuboid);
1035 std::swap(this->_periodicityOn[0], rhs._periodicityOn[0]);
1036 std::swap(this->_periodicityOn[1], rhs._periodicityOn[1]);
1037 std::swap(this->_periodicityOn[2], rhs._periodicityOn[2]);
1038 std::swap(this->clout, rhs.clout);
1039}

◆ swapCuboids()

template<typename T >
void olb::CuboidGeometry3D< T >::swapCuboids ( std::vector< Cuboid3D< T > > & cuboids)

Swaps the vector of cuboids.

Definition at line 1042 of file cuboidGeometry3D.hh.

1043{
1044 _cuboids.swap(cuboids);
1045}

◆ tryRefineTo()

template<typename T >
bool olb::CuboidGeometry3D< T >::tryRefineTo ( T deltaR)

Tries to refine mesh to given deltaR.

Definition at line 811 of file cuboidGeometry3D.hh.

812{
813 const T tolerance = std::numeric_limits<T>::epsilon();
814 const T currDeltaR = _motherCuboid.getDeltaR();
815 const int factor = std::ceil(currDeltaR / goalDeltaR);
816 if (util::fabs(currDeltaR / factor - goalDeltaR) < tolerance) {
817 refine(factor);
818 return true;
819 } else {
820 return false;
821 }
822}
void refine(int factor)
Refines mesh by splitting each cell into factor^3 cells.
cpu::simd::Pack< T > fabs(cpu::simd::Pack< T > value)
Definition pack.h:106

References olb::util::fabs().

+ Here is the call graph for this function:

◆ writeToExistingFile()

template<typename T >
void olb::CuboidGeometry3D< T >::writeToExistingFile ( std::string completeFileName,
LoadBalancer< T > & loadBalancer )

Save CuboidGeometry into an existing XML File.

Definition at line 1153 of file cuboidGeometry3D.hh.

1154{
1155 std::ofstream fout;
1156 if ( singleton::mpi().isMainProcessor() ) {
1157
1158 // Open File
1159 fout.open(completeFileName.c_str(), std::ios::app);
1160 if (!fout) {
1161 clout << "Error: could not open " << completeFileName << std::endl;
1162 }
1163
1164 // --- Preamble --- //
1165 fout << "<CuboidGeometry dimension=\"3\" " << _cuboidParameters(getMotherCuboid()) << ">\n";
1166
1167 // TODO: Move Cuboid XML Serialization to Cuboid3D class
1168 for (int iC = 0; iC < getNc(); ++iC) {
1169 fout << "<Cuboid " << _cuboidParameters(get(iC)) << " />\n";
1170 }
1171
1172 fout << "</CuboidGeometry>\n";
1173
1174 // Close File
1175 fout.close();
1176 }
1177}
MpiManager & mpi()

References olb::singleton::mpi().

+ Here is the call graph for this function:

◆ writeToFile()

template<typename T >
void olb::CuboidGeometry3D< T >::writeToFile ( std::string fileName,
LoadBalancer< T > & loadBalancer )

Save CuboidGeometry into XML File.

Definition at line 1181 of file cuboidGeometry3D.hh.

1182{
1183 std::string fname = singleton::directories().getLogOutDir() + fileName + ".xml";
1184 std::ofstream fout;
1185 if (singleton::mpi().isMainProcessor()) {
1186 fout.open(fname.c_str(), std::ios::trunc);
1187 fout << "<?xml version=\"1.0\"?>\n";
1188 fout << "<XMLContent>\n";
1189 fout.close();
1190 fout.clear();
1191 }
1192
1193 writeToExistingFile(fname, loadBalancer);
1194
1195 if (singleton::mpi().isMainProcessor()) {
1196 fout.open(fname.c_str(), std::ios::app);
1197 fout << "</XMLContent>\n";
1198 fout.close();
1199 }
1200}
void writeToExistingFile(std::string completeFileName, LoadBalancer< T > &loadBalancer)
Save CuboidGeometry into an existing XML File.
std::string getLogOutDir() const
Definition singleton.h:89
Directories & directories()
Definition singleton.h:150

References olb::singleton::directories(), olb::singleton::Directories::getLogOutDir(), and olb::singleton::mpi().

+ Here is the call graph for this function:

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