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

A cuboid structure represents the grid of a considered domain. More...

#include <cuboidGeometry2D.h>

+ Collaboration diagram for olb::CuboidGeometry2D< T >:

Public Member Functions

 CuboidGeometry2D ()
 Constructs empty Geometry.
 
 CuboidGeometry2D (T originX, T originY, T deltaR, int nX, int nY, int nC=1)
 Constructs a cuboid geometry with a cubic shape of size nX times nY with origin originR=(originX, originY) that consits of nC cuboids.
 
 CuboidGeometry2D (IndicatorF2D< T > &indicatorF, T voxelSize, int nC=1)
 Constructs a cuboid structure with a uniform spacing of voxelsize which consits of nC cuboids, the cuboids not needed are removed and too big ones are shrinked.
 
void reInit (T globPosX, T globPosY, T delta, int nX, int nY, int nC=1)
 Re init.
 
Cuboid2D< T > & get (int i)
 Read and write access to the cuboids.
 
Cuboid2D< T > const & get (int i) const
 Read access to the cuboids.
 
void setPeriodicity (bool periodicityX, bool periodicityY)
 Set flag to enable/disable periodicity.
 
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, 2 > &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 (std::vector< T > physR, std::vector< int > &latticeR) 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 getLatticeR (int latticeR[], const T physR[]) const
 
bool getLatticeR (const Vector< T, 2 > &physR, Vector< int, 3 > &latticeR) const
 
bool getFloorLatticeR (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, 2 > &physR, Vector< int, 3 > &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.
 
std::vector< T > getPhysR (int iCglob, int iX, int iY) 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.
 
std::vector< T > getPhysR (std::vector< int > latticeR) 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 output[2], const int latticeR[3]) const
 
void getPhysR (T output[2], const int iCglob, const int iX, const int iY) const
 
void getPhysR (T output[2], const int iCglob, LatticeR< 2 > latticeR) const
 
void getPhysR (T output[3], LatticeR< 3 > latticeR) const
 
int getNc () const
 Returns the number of cuboids in t < 2he structure.
 
getMinRatio () const
 Returns the maximum/minimum of the ratio nX/NY in the structure.
 
getMaxRatio () const
 
std::vector< T > getMinPhysR () const
 Returns the minimum coordinate in the structure.
 
std::vector< T > getMaxPhysR () const
 Returns the maximum coordinate in the structure.
 
getMinPhysVolume () const
 Returns the maximum/minimum volume in the structure.
 
getMaxPhysVolume () const
 
size_t getMinLatticeVolume () const
 Returns the maximum/minimum number of nodes in the structure.
 
size_t getMaxLatticeVolume () const
 
getMinDeltaR () const
 Returns the maximum/minimum delata in the structure.
 
getMaxDeltaR () const
 
Cuboid2D< T > getMotherCuboid () const
 Returns the smallest cuboid that includes all cuboids of the structure.
 
int get_iC (T globX, T globY, int offset=0) const
 for a given point (globX/globY), returns the related cuboidID and _p if the point is not in any of the cuboid _childrenQ
 
int get_iC (T globX, T globY, int orientationX, int orientationY) const
 This function checks if the points (globX/globY) and (globX + orientationX/delta /globY + orientationY/delta) is in a cuboid.
 
void add (Cuboid2D< T > cuboid)
 Adds a cuboid.
 
void remove (int iC)
 Removes the cuboid iC.
 
void split (int iC, int p)
 Removes all cuboids where geometryData = 0.
 
void shrink (IndicatorF2D< T > &indicatorF)
 Shrink all cuboids so that no empty planes are left.
 
void getNeighbourhood (int cuboid, std::vector< int > &neighbours, int offset=0)
 stores the neighbouring cuboids in array neighbours;
 
void print () const
 Prints cuboid geometry details.
 
void printExtended ()
 Prints cuboid geometry details plus details of all cuboids.
 

Detailed Description

template<typename T>
class olb::CuboidGeometry2D< T >

A cuboid structure represents the grid of a considered domain.

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

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

This class is not intended to be derived from.

Definition at line 56 of file cuboidGeometry2D.h.

Constructor & Destructor Documentation

◆ CuboidGeometry2D() [1/3]

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

Constructs empty Geometry.

Definition at line 44 of file cuboidGeometry2D.hh.

45 : _motherCuboid(0,0,0,0,0), _periodicityOn(3, bool(false)), clout(std::cout, "CuboidGeometry3D")
46{
47 add(_motherCuboid);
48 split(0, 1);
49}
void add(Cuboid2D< T > cuboid)
Adds a cuboid.
void split(int iC, int p)
Removes all cuboids where geometryData = 0.

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

+ Here is the call graph for this function:

◆ CuboidGeometry2D() [2/3]

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

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

Definition at line 52 of file cuboidGeometry2D.hh.

53 : _motherCuboid(originX, originY, deltaR, nX, nY), _periodicityOn(2, bool(false)),
54 clout(std::cout, "CuboidGeometry2D")
55{
56 add(_motherCuboid);
57 split(0, nC);
58}

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

+ Here is the call graph for this function:

◆ CuboidGeometry2D() [3/3]

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

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

Definition at line 61 of file cuboidGeometry2D.hh.

62 : _motherCuboid(indicatorF.getMin()[0], indicatorF.getMin()[1], voxelSize,
63 (int)((indicatorF.getMax()[0] - indicatorF.getMin()[0]) / voxelSize + 1.5),
64 (int)((indicatorF.getMax()[1] - indicatorF.getMin()[1]) / voxelSize + 1.5)),
65 _periodicityOn(2, bool(false)), clout(std::cout, "CuboidGeometry2D")
66{
67
68 add(_motherCuboid);
69 split(0, nC);
70 shrink(indicatorF);
71}
void shrink(IndicatorF2D< T > &indicatorF)
Shrink all cuboids so that no empty planes are left.
virtual Vector< S, 2 > & getMin()
virtual Vector< S, 2 > & getMax()

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

+ Here is the call graph for this function:

Member Function Documentation

◆ add()

template<typename T >
void olb::CuboidGeometry2D< T >::add ( Cuboid2D< T > cuboid)

Adds a cuboid.

Definition at line 495 of file cuboidGeometry2D.hh.

496{
497
498 _cuboids.push_back(cuboid);
499}
+ Here is the caller graph for this function:

◆ get() [1/2]

template<typename T >
Cuboid2D< T > & olb::CuboidGeometry2D< T >::get ( int i)

Read and write access to the cuboids.

Definition at line 89 of file cuboidGeometry2D.hh.

90{
91 return _cuboids[i];
92}
+ Here is the caller graph for this function:

◆ get() [2/2]

template<typename T >
Cuboid2D< T > const & olb::CuboidGeometry2D< T >::get ( int i) const

Read access to the cuboids.

Definition at line 95 of file cuboidGeometry2D.hh.

96{
97 return _cuboids[i];
98}

◆ get_iC() [1/2]

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

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

Definition at line 468 of file cuboidGeometry2D.hh.

469{
470 unsigned i;
471 for (i = 0; i < _cuboids.size(); i++) {
472 if (_cuboids[i].checkPoint(globX, globY, offset)) {
473 return (int)i;
474 }
475 }
476 return (int)i;
477}

◆ get_iC() [2/2]

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

This function checks if the points (globX/globY) and (globX + orientationX/delta /globY + orientationY/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) = 1 must be satisfied

Definition at line 480 of file cuboidGeometry2D.hh.

481{
482 unsigned i;
483 for (i = 0; i < _cuboids.size(); i++) {
484 if (_cuboids[i].checkPoint(globX, globY) &&
485 _cuboids[i].checkPoint(globX + orientationX / _cuboids[i].getDeltaR(),
486 globY + orientationY / _cuboids[i].getDeltaR())) {
487 return (int)i;
488 }
489 }
490 return (int)i;
491}

◆ getC() [1/2]

template<typename T >
bool olb::CuboidGeometry2D< T >::getC ( const Vector< T, 2 > & 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 123 of file cuboidGeometry2D.hh.

124{
125 int iCtmp = get_iC(physR[0], physR[1]);
126 if (iCtmp < getNc()) {
127 iC = iCtmp;
128 return true;
129 }
130 else {
131 return false;
132 }
133}
int getNc() const
Returns the number of cuboids in t < 2he structure.
int get_iC(T globX, T globY, int offset=0) const
for a given point (globX/globY), returns the related cuboidID and _p if the point is not in any of th...

◆ getC() [2/2]

template<typename T >
bool olb::CuboidGeometry2D< 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 110 of file cuboidGeometry2D.hh.

111{
112 int iCtmp = get_iC(physR[0], physR[1]);
113 if (iCtmp < getNc()) {
114 iC = iCtmp;
115 return true;
116 }
117 else {
118 return false;
119 }
120}
+ Here is the caller graph for this function:

◆ getFloorLatticeR() [1/2]

template<typename T >
bool olb::CuboidGeometry2D< T >::getFloorLatticeR ( const Vector< T, 2 > & physR,
Vector< int, 3 > & 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 197 of file cuboidGeometry2D.hh.

199{
200 int iCtmp = get_iC(physR[0], physR[1]);
201 if (iCtmp < getNc()) {
202 latticeR[0] = iCtmp;
203 latticeR[1] = (int)util::floor( (physR[0] - _cuboids[latticeR[0]].getOrigin()[0] ) / _cuboids[latticeR[0]].getDeltaR() );
204 latticeR[2] = (int)util::floor( (physR[1] - _cuboids[latticeR[0]].getOrigin()[1] ) / _cuboids[latticeR[0]].getDeltaR() );
205 return true;
206 }
207 else {
208 return false;
209 }
210}
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::CuboidGeometry2D< T >::getFloorLatticeR ( 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 182 of file cuboidGeometry2D.hh.

183{
184 int iCtmp = get_iC(physR[0], physR[1]);
185 if (iCtmp < getNc()) {
186 latticeR[0] = iCtmp;
187 latticeR[1] = (int)util::floor( (physR[0] - _cuboids[latticeR[0]].getOrigin()[0] ) / _cuboids[latticeR[0]].getDeltaR() );
188 latticeR[2] = (int)util::floor( (physR[1] - _cuboids[latticeR[0]].getOrigin()[1] ) / _cuboids[latticeR[0]].getDeltaR() );
189 return true;
190 }
191 else {
192 return false;
193 }
194}

References olb::util::floor().

+ Here is the call graph for this function:

◆ getLatticeR() [1/3]

template<typename T >
bool olb::CuboidGeometry2D< T >::getLatticeR ( const Vector< T, 2 > & physR,
Vector< int, 3 > & latticeR ) const

Definition at line 166 of file cuboidGeometry2D.hh.

168{
169 int iCtmp = get_iC(physR[0], physR[1]);
170 if (iCtmp < getNc()) {
171 latticeR[0] = iCtmp;
172 latticeR[1] = (int)util::floor( (physR[0] - _cuboids[latticeR[0]].getOrigin()[0] ) / _cuboids[latticeR[0]].getDeltaR() + .5);
173 latticeR[2] = (int)util::floor( (physR[1] - _cuboids[latticeR[0]].getOrigin()[1] ) / _cuboids[latticeR[0]].getDeltaR() + .5);
174 return true;
175 }
176 else {
177 return false;
178 }
179}

References olb::util::floor().

+ Here is the call graph for this function:

◆ getLatticeR() [2/3]

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

Definition at line 151 of file cuboidGeometry2D.hh.

152{
153 int iCtmp = get_iC(physR[0], physR[1]);
154 if (iCtmp < getNc()) {
155 latticeR[0] = iCtmp;
156 latticeR[1] = (int)util::floor( (physR[0] - _cuboids[latticeR[0]].getOrigin()[0] ) / _cuboids[latticeR[0]].getDeltaR() + .5);
157 latticeR[2] = (int)util::floor( (physR[1] - _cuboids[latticeR[0]].getOrigin()[1] ) / _cuboids[latticeR[0]].getDeltaR() + .5);
158 return true;
159 }
160 else {
161 return false;
162 }
163}

References olb::util::floor().

+ Here is the call graph for this function:

◆ getLatticeR() [3/3]

template<typename T >
bool olb::CuboidGeometry2D< T >::getLatticeR ( std::vector< T > physR,
std::vector< int > & latticeR ) 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 136 of file cuboidGeometry2D.hh.

137{
138 return getLatticeR(&latticeR[0], &physR[0]);
139 /* int iCtmp = get_iC(physR[0], physR[1]);
140 if (iCtmp < getNc()) {
141 latticeR[0] = iCtmp;
142 latticeR[1] = (int)util::floor( (physR[0] - _cuboids[latticeR[0]].getOrigin()[0] ) / _cuboids[latticeR[0]].getDeltaR() + .5);
143 latticeR[2] = (int)util::floor( (physR[1] - _cuboids[latticeR[0]].getOrigin()[1] ) / _cuboids[latticeR[0]].getDeltaR() + .5);
144 return true;
145 } else {
146 return false;
147 }*/
148}
bool getLatticeR(std::vector< T > physR, std::vector< int > &latticeR) const
Returns true and the nearest lattice position to the given physical position if the physical position...

◆ getMaxDeltaR()

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

Definition at line 410 of file cuboidGeometry2D.hh.

411{
412 T maxDelta = _cuboids[0].getDeltaR();
413 for (unsigned i = 0; i < _cuboids.size(); i++) {
414 if (_cuboids[i].getDeltaR() > maxDelta) {
415 maxDelta = _cuboids[i].getDeltaR();
416 }
417 }
418 return maxDelta;
419}

◆ getMaxLatticeVolume()

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

Definition at line 386 of file cuboidGeometry2D.hh.

387{
388 size_t maxNodes = _cuboids[0].getLatticeVolume();
389 for (unsigned i = 0; i < _cuboids.size(); i++) {
390 if (_cuboids[i].getLatticeVolume() > maxNodes) {
391 maxNodes = _cuboids[i].getLatticeVolume();
392 }
393 }
394 return maxNodes;
395}

◆ getMaxPhysR()

template<typename T >
std::vector< T > olb::CuboidGeometry2D< T >::getMaxPhysR ( ) const

Returns the maximum coordinate in the structure.

Definition at line 333 of file cuboidGeometry2D.hh.

334{
335 Vector<T,2> output(_cuboids[0].getOrigin());
336 output[0] += _cuboids[0].getNx()*_cuboids[0].getDeltaR();
337 output[1] += _cuboids[0].getNy()*_cuboids[0].getDeltaR();
338 for (unsigned i = 0; i < _cuboids.size(); i++) {
339 if (_cuboids[i].getOrigin()[0] + _cuboids[i].getNx()*_cuboids[i].getDeltaR() > output[0]) {
340 output[0] = _cuboids[i].getOrigin()[0] + _cuboids[i].getNx()*_cuboids[i].getDeltaR();
341 }
342 if (_cuboids[i].getOrigin()[1] + _cuboids[i].getNy()*_cuboids[i].getDeltaR() > output[1]) {
343 output[1] = _cuboids[i].getOrigin()[1] + _cuboids[i].getNy()*_cuboids[i].getDeltaR();
344 }
345 }
346 return std::vector<T> {output[0],output[1]};
347}

◆ getMaxPhysVolume()

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

Definition at line 362 of file cuboidGeometry2D.hh.

363{
364 T maxVolume = _cuboids[0].getPhysVolume();
365 for (unsigned i = 0; i < _cuboids.size(); i++) {
366 if (_cuboids[i].getPhysVolume() > maxVolume) {
367 maxVolume = _cuboids[i].getPhysVolume();
368 }
369 }
370 return maxVolume;
371}

◆ getMaxRatio()

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

Definition at line 306 of file cuboidGeometry2D.hh.

307{
308 T maxRatio = 1.;
309 for (unsigned i = 0; i < _cuboids.size(); i++) {
310 if ((T)_cuboids[i].getNx() / (T)_cuboids[i].getNy() > maxRatio) {
311 maxRatio = (T)_cuboids[i].getNx() / (T)_cuboids[i].getNy();
312 }
313 }
314 return maxRatio;
315}

◆ getMinDeltaR()

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

Returns the maximum/minimum delata in the structure.

Definition at line 398 of file cuboidGeometry2D.hh.

399{
400 T minDelta = _cuboids[0].getDeltaR();
401 for (unsigned i = 0; i < _cuboids.size(); i++) {
402 if (_cuboids[i].getDeltaR() < minDelta) {
403 minDelta = _cuboids[i].getDeltaR();
404 }
405 }
406 return minDelta;
407}
+ Here is the caller graph for this function:

◆ getMinLatticeVolume()

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

Returns the maximum/minimum number of nodes in the structure.

Definition at line 374 of file cuboidGeometry2D.hh.

375{
376 size_t minNodes = _cuboids[0].getLatticeVolume();
377 for (unsigned i = 0; i < _cuboids.size(); i++) {
378 if (_cuboids[i].getLatticeVolume() < minNodes) {
379 minNodes = _cuboids[i].getLatticeVolume();
380 }
381 }
382 return minNodes;
383}

◆ getMinPhysR()

template<typename T >
std::vector< T > olb::CuboidGeometry2D< T >::getMinPhysR ( ) const

Returns the minimum coordinate in the structure.

Definition at line 318 of file cuboidGeometry2D.hh.

319{
320 Vector<T,2> output(_cuboids[0].getOrigin());
321 for (unsigned i = 0; i < _cuboids.size(); i++) {
322 if (_cuboids[i].getOrigin()[0] < output[0]) {
323 output[0] = _cuboids[i].getOrigin()[0];
324 }
325 if (_cuboids[i].getOrigin()[1] < output[1]) {
326 output[1] = _cuboids[i].getOrigin()[1];
327 }
328 }
329 return std::vector<T> {output[0],output[1]};
330}

◆ getMinPhysVolume()

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

Returns the maximum/minimum volume in the structure.

Definition at line 350 of file cuboidGeometry2D.hh.

351{
352 T minVolume = _cuboids[0].getPhysVolume();
353 for (unsigned i = 0; i < _cuboids.size(); i++) {
354 if (_cuboids[i].getPhysVolume() < minVolume) {
355 minVolume = _cuboids[i].getPhysVolume();
356 }
357 }
358 return minVolume;
359}

◆ getMinRatio()

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

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

Definition at line 294 of file cuboidGeometry2D.hh.

295{
296 T minRatio = 1.;
297 for ( auto& cuboid : _cuboids ) {
298 if ((T)cuboid.getNx() / (T)cuboid.getNy() < minRatio) {
299 minRatio = (T)cuboid.getNx() / (T)cuboid.getNy();
300 }
301 }
302 return minRatio;
303}

◆ getMotherCuboid()

template<typename T >
Cuboid2D< T > olb::CuboidGeometry2D< T >::getMotherCuboid ( ) const

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

Definition at line 422 of file cuboidGeometry2D.hh.

423{
424
425 /*Cuboid2D<T> found;
426 if(_cuboids.size()==0) {
427 found.init(0, 0, 0, 0, 0);
428 return found;
429 }
430
431 T delta = _cuboids[0].getDeltaR();
432 T globPosXmin = _cuboids[0].get_globPosX();
433 T globPosYmin = _cuboids[0].get_globPosY();
434 T globPosXmax = _cuboids[0].get_globPosX() + delta*(_cuboids[0].getNx()-1);
435 T globPosYmax = _cuboids[0].get_globPosY() + delta*(_cuboids[0].getNy()-1);
436
437 for (unsigned i=1; i<_cuboids.size(); i++) {
438 if(delta > _cuboids[i].getDeltaR() ) {
439 delta = _cuboids[i].getDeltaR();
440 }
441 if(globPosXmin > _cuboids[i].get_globPosX() ) {
442 globPosXmin = _cuboids[i].get_globPosX();
443 }
444 if(globPosYmin > _cuboids[i].get_globPosY() ) {
445 globPosYmin = _cuboids[i].get_globPosY();
446 }
447 if(globPosXmax < _cuboids[i].get_globPosX()
448 + delta*(_cuboids[i].getNx()-1)) {
449 globPosXmax = _cuboids[i].get_globPosX()
450 + delta*(_cuboids[i].getNx()-1);
451 }
452 if(globPosYmax < _cuboids[i].get_globPosY()
453 + delta*(_cuboids[i].getNy()-1)) {
454 globPosYmax = _cuboids[i].get_globPosY()
455 + delta*(_cuboids[i].getNy()-1);
456 }
457 }
458 int nX = int(util::ceil((globPosXmax - globPosXmin)/delta))+1;
459 int nY = int(util::ceil((globPosYmax - globPosYmin)/delta))+1;
460
461 found.init(globPosXmin, globPosYmin, delta, nX, nY);
462
463 return found;*/
464 return _motherCuboid;
465}
+ Here is the caller graph for this function:

◆ getNc()

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

Returns the number of cuboids in t < 2he structure.

Definition at line 288 of file cuboidGeometry2D.hh.

289{
290 return _cuboids.size();
291}
+ Here is the caller graph for this function:

◆ getNeighbourhood()

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

stores the neighbouring cuboids in array neighbours;

Definition at line 597 of file cuboidGeometry2D.hh.

598{
599 for (int iC = 0; iC < getNc(); iC++) {
600 if (cuboid == iC) {
601 continue;
602 }
603 T globX = get(iC).get_globPosX();
604 T globY = get(iC).get_globPosY();
605 T nX = get(iC).getNx();
606 T nY = get(iC).getNy();
607 if (get(cuboid).checkInters(globX, globX + nX, globY, globY + nY, offset)) {
608 neighbours.push_back(iC);
609 }
610 }
611}
Cuboid2D< T > & get(int i)
Read and write access to the cuboids.
+ Here is the caller graph for this function:

◆ getPhysR() [1/6]

template<typename T >
std::vector< T > olb::CuboidGeometry2D< T >::getPhysR ( int iCglob,
int iX,
int iY ) 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 213 of file cuboidGeometry2D.hh.

214{
215 std::vector<T> physR(2,T());
216 _cuboids[iCglob].getPhysR(&(physR[0]), iX, iY);
217 for (int iDim = 0; iDim < 2; iDim++) {
218 if (_periodicityOn[iDim]) {
219 //std::cout << iDim << _periodicityOn[iDim] <<":"<< _motherCuboid.getDeltaR()*(_motherCuboid.getExtent()[iDim]) << std::endl;
220 physR[iDim] = remainder( physR[iDim] - _motherCuboid.getOrigin()[iDim]
221 + _motherCuboid.getDeltaR() * (_motherCuboid.getExtent()[iDim]),
222 _motherCuboid.getDeltaR() * (_motherCuboid.getExtent()[iDim]));
223 // solving the rounding error problem for double
224 if ( physR[iDim]*physR[iDim] < 0.001 * _motherCuboid.getDeltaR()*_motherCuboid.getDeltaR() ) {
225 physR[iDim] = T();
226 }
227 // make it to mod instead remainer
228 if ( physR[iDim] < 0 ) {
229 physR[iDim] += _motherCuboid.getDeltaR() * _motherCuboid.getExtent()[iDim];
230 }
231 // add origin
232 physR[iDim] += _motherCuboid.getOrigin()[iDim];
233 }
234 }
235 return physR;
236}
+ Here is the caller graph for this function:

◆ getPhysR() [2/6]

template<typename T >
std::vector< T > olb::CuboidGeometry2D< T >::getPhysR ( std::vector< int > latticeR) 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 239 of file cuboidGeometry2D.hh.

240{
241 return getPhysR(latticeR[0], latticeR[1], latticeR[2]);
242}
std::vector< T > getPhysR(int iCglob, int iX, int iY) const
Returns the physical position to the given lattice position respecting periodicity for the overlap no...

◆ getPhysR() [3/6]

template<typename T >
void olb::CuboidGeometry2D< T >::getPhysR ( T output[2],
const int iCglob,
const int iX,
const int iY ) const

Definition at line 264 of file cuboidGeometry2D.hh.

265{
266 _cuboids[iCglob].getPhysR(output, iX, iY);
267 for (int iDim = 0; iDim < 2; iDim++) {
268 if (_periodicityOn[iDim]) {
269 //std::cout << iDim << _periodicityOn[iDim] <<":"<< _motherCuboid.getDeltaR()*(_motherCuboid.getExtent()[iDim]) << std::endl;
270 output[iDim] = remainder( output[iDim] - _motherCuboid.getOrigin()[iDim]
271 + _motherCuboid.getDeltaR() * (_motherCuboid.getExtent()[iDim]),
272 _motherCuboid.getDeltaR() * (_motherCuboid.getExtent()[iDim]));
273 // solving the rounding error problem for double
274 if ( output[iDim]*output[iDim] < 0.001 * _motherCuboid.getDeltaR()*_motherCuboid.getDeltaR() ) {
275 output[iDim] = T();
276 }
277 // make it to mod instead remainer
278 if ( output[iDim] < 0 ) {
279 output[iDim] += _motherCuboid.getDeltaR() * _motherCuboid.getExtent()[iDim];
280 }
281 // add origin
282 output[iDim] += _motherCuboid.getOrigin()[iDim];
283 }
284 }
285}

◆ getPhysR() [4/6]

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

Definition at line 257 of file cuboidGeometry2D.hh.

258{
259 getPhysR(output, iCglob, latticeR[0], latticeR[1]);
260}

◆ getPhysR() [5/6]

template<typename T >
void olb::CuboidGeometry2D< T >::getPhysR ( T output[2],
const int latticeR[3] ) const

Definition at line 245 of file cuboidGeometry2D.hh.

246{
247 getPhysR(output, latticeR[0], latticeR[1], latticeR[2]);
248}

◆ getPhysR() [6/6]

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

◆ print()

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

Prints cuboid geometry details.

Definition at line 614 of file cuboidGeometry2D.hh.

615{
616 clout << "---Cuboid Stucture Statistics---" << std::endl;
617 clout << " Number of Cuboids: " << "\t" << getNc() << std::endl;
618 clout << " Delta (min): " << "\t" << "\t" << getMinDeltaR() << std::endl;
619 clout << " (max): " << "\t" << "\t" << getMaxDeltaR() << std::endl;
620 clout << " Ratio (min): " << "\t" << "\t" << getMinRatio() << std::endl;
621 clout << " (max): " << "\t" << "\t" << getMaxRatio() << std::endl;
622 clout << " Nodes (min): " << "\t" << "\t" << getMinLatticeVolume() << std::endl;
623 clout << " (max): " << "\t" << "\t" << getMaxLatticeVolume() << std::endl;
624 clout << "--------------------------------" << std::endl;
625}
size_t getMinLatticeVolume() const
Returns the maximum/minimum number of nodes in the structure.
size_t getMaxLatticeVolume() const
T getMinRatio() const
Returns the maximum/minimum of the ratio nX/NY in the structure.
T getMinDeltaR() const
Returns the maximum/minimum delata in the structure.

◆ printExtended()

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

Prints cuboid geometry details plus details of all cuboids.

Definition at line 628 of file cuboidGeometry2D.hh.

629{
630 clout << "Mothercuboid :" << std::endl;
631 getMotherCuboid().print();
632
633 for (int iC = 0; iC < getNc(); iC++) {
634 clout << "Cuboid #" << iC << ": " << std::endl;
635 get(iC).print();
636 }
637}
Cuboid2D< T > getMotherCuboid() const
Returns the smallest cuboid that includes all cuboids of the structure.

◆ reInit()

template<typename T >
void olb::CuboidGeometry2D< T >::reInit ( T globPosX,
T globPosY,
T delta,
int nX,
int nY,
int nC = 1 )

Re init.

Definition at line 75 of file cuboidGeometry2D.hh.

76{
77 _cuboids.clear();
78 _motherCuboid = Cuboid2D<T>(globPosX, globPosY, delta, nX, nY);
79 Cuboid2D<T> cuboid(globPosX, globPosY, delta, nX, nY);
80 if (_oldApproach) {
81 cuboid.init(0, 0, 1, nX, nY);
82 }
83
84 add(cuboid);
85 split(0, nC);
86}

References olb::Cuboid2D< T >::init().

+ Here is the call graph for this function:

◆ remove()

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

Removes the cuboid iC.

Definition at line 502 of file cuboidGeometry2D.hh.

503{
504
505 _cuboids.erase(_cuboids.begin() + iC);
506}

◆ setPeriodicity()

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

Set flag to enable/disable periodicity.

Definition at line 101 of file cuboidGeometry2D.hh.

102{
103 _periodicityOn.resize(2);
104 _periodicityOn[0] = periodicityX;
105 _periodicityOn[1] = periodicityY;
106}

References olb::Cuboid2D< T >::resize().

+ Here is the call graph for this function:

◆ shrink()

template<typename T >
void olb::CuboidGeometry2D< T >::shrink ( IndicatorF2D< T > & indicatorF)

Shrink all cuboids so that no empty planes are left.

Definition at line 539 of file cuboidGeometry2D.hh.

540{
541 //IndicatorIdentity3D<T> tmpIndicatorF(indicatorF);
542 int newX, newY, maxX, maxY;
543 int nC = getNc();
544 std::vector<int> latticeR(3, 0);
545 std::vector<T> physR(2, T());
546 bool inside[1];
547 for (int iC = nC - 1; iC >= 0; iC--) {
548 latticeR[0] = iC;
549 int fullCells = 0;
550 int xN = get(iC).getNx();
551 int yN = get(iC).getNy();
552 maxX = 0;
553 maxY = 0;
554 newX = xN - 1;
555 newY = yN - 1;
556 for (int iX = 0; iX < xN; iX++) {
557 for (int iY = 0; iY < yN; iY++) {
558 latticeR[1] = iX;
559 latticeR[2] = iY;
560 physR = getPhysR(latticeR);
561 indicatorF(inside,&physR[0]);
562 if (inside[0]) {
563 fullCells++;
564 maxX = util::max(maxX, iX);
565 maxY = util::max(maxY, iY);
566 newX = util::min(newX, iX);
567 newY = util::min(newY, iY);
568 }
569 }
570 }
571 if (fullCells > 0) {
572 get(iC).setWeight(fullCells);
573 _cuboids[iC].resize(newX, newY, maxX - newX + 1, maxY - newY + 1);
574 }
575 else {
576 remove(iC);
577 }
578 }
579 // shrink mother cuboid
580 std::vector<T> minPhysR = getMinPhysR();
581 std::vector<T> maxPhysR = getMaxPhysR();
582 T minDelataR = getMinDeltaR();
583 _motherCuboid = Cuboid2D<T>(minPhysR[0], minPhysR[1], minDelataR, (int)((maxPhysR[0]-minPhysR[0])/minDelataR + 0.5), (int)((maxPhysR[1]-minPhysR[1])/minDelataR + 0.5));
584}
void remove(int iC)
Removes the cuboid iC.
std::vector< T > getMinPhysR() const
Returns the minimum coordinate in the structure.
std::vector< T > getMaxPhysR() const
Returns the maximum coordinate in the structure.
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::CuboidGeometry2D< T >::split ( int iC,
int p )

Removes all cuboids where geometryData = 0.

Splits cuboid iC, removes it and add p cuboids

Definition at line 587 of file cuboidGeometry2D.hh.

588{
589
590 Cuboid2D<T> temp(_cuboids[iC].get_globPosX(), _cuboids[iC].get_globPosY(),
591 _cuboids[iC].getDeltaR(), _cuboids[iC].getNx(), _cuboids[iC].getNy());
592 temp.divide(p, _cuboids);
593 remove(iC);
594}

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

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

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