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

A regular single 3D cuboid is the basic component of a 3D cuboid structure which defines the grid. More...

#include <cuboid3D.h>

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

Public Member Functions

 Cuboid3D ()
 Construction of an empty cuboid at position 0, 0, 0 with delta 0 and nX = nY = nZ = 0.
 
 Cuboid3D (T globPosX, T globPosY, T globPosZ, T delta, int nX, int nY, int nZ)
 Construction of a cuboid.
 
 Cuboid3D (std::vector< T > origin, T delta, std::vector< int > extend)
 Construction of a cuboid vector version.
 
 Cuboid3D (Vector< T, 3 > origin, T delta, Vector< int, 3 > extend)
 
 Cuboid3D (IndicatorF3D< T > &indicatorF, T voxelSize)
 Construction of a cuboid using indicator.
 
 Cuboid3D (Cuboid3D< T > const &rhs, int overlap=0)
 Copy constructor.
 
Cuboid3Doperator= (Cuboid3D const &rhs)
 Copy assignment.
 
void init (T globPosX, T globPosY, T globPosZ, T delta, int nX, int nY, int nZ)
 Initializes the cuboid.
 
Vector< T, 3 > getOrigin () const
 Read only access to left lower corner coordinates.
 
getDeltaR () const
 Read only access to the distance of cuboid nodes.
 
int getNx () const
 Read access to cuboid width.
 
int getNy () const
 Read access to cuboid height.
 
int getNz () const
 Read access to cuboid depth.
 
Vector< int, 3 > const getExtent () const
 Read only access to the number of voxels in every dimension.
 
getPhysVolume () const
 Returns the volume of the cuboid.
 
int getWeightValue () const
 Returns the actual value of weight (-1 for getLatticeVolume())
 
std::size_t getWeight () const
 Returns the number of full cells.
 
std::size_t getWeightIn (IndicatorF3D< T > &indicator) const
 Returns the number of full cells w.r.t. indicator.
 
void setWeight (size_t fullCells)
 Sets the number of full cells.
 
getFraction () const
 Returns fraction of full cells (weight / volume)
 
size_t getLatticeVolume () const
 Returns the number of Nodes in the volume.
 
getPhysPerimeter () const
 Returns the perimeter of the cuboid.
 
int getLatticePerimeter () const
 Returns the number of Nodes at the perimeter.
 
void refine (int factor)
 Refines by splitting each cell into factor^3 cells.
 
bool getLatticeR (Vector< T, 3 > physR, Vector< int, 3 > &latticeR, T eps=1e-5)
 
bool operator== (const Cuboid3D< T > &rhs) const
 equal operator
 
std::size_t getNblock () const override
 Number of data blocks for the serializable interface.
 
std::size_t getSerializableSize () const override
 Binary size for the serializer interface.
 
bool * getBlock (std::size_t iBlock, std::size_t &sizeBlock, bool loadingMode) override
 
void print () const
 Prints cuboid details.
 
void getPhysR (T physR[3], const int latticeR[3]) const
 
void getPhysR (T physR[3], const int &iX, const int &iY, const int &iZ) const
 
void getPhysR (T physR[3], LatticeR< 3 > latticeR) const
 
void getLatticeR (int latticeR[3], const T physR[3]) const
 
void getLatticeR (int latticeR[3], const Vector< T, 3 > &physR) const
 
void getFloorLatticeR (const std::vector< T > &physR, std::vector< int > &latticeR) const
 
void getFloorLatticeR (int latticeR[3], const T physR[3]) const
 
bool checkPoint (T globX, T globY, T globZ, int overlap=0) const
 Checks whether a point (globX/gloxY/globZ) is contained in the cuboid extended with an layer of size overlap*delta.
 
bool checkPoint (Vector< T, 3 > &globXYZ, int overlap=0) const
 
bool physCheckPoint (T globX, T globY, T globZ, double overlap=0) const
 Same for physical overlap.
 
bool checkPoint (T globX, T globY, T globZ, int &locX, int &locY, int &locZ, int overlap=0) const
 Checks whether a point (globX/gloxY/globZ) is contained and is a node in the cuboid extended with an layer of size overlap*delta and returns the local active node.
 
bool checkInters (T globX0, T globX1, T globY0, T globY1, T globZ0, T globZ1, int overlap=0) const
 Checks whether there is an intersection with the cuboid extended with an layer of size overlap*delta.
 
bool checkInters (T globX, T globY, T globZ, int overlap=0) const
 Checks whether a given point intersects the cuboid extended by a layer of size overlap*delta.
 
bool checkInters (T globX0, T globX1, T globY0, T globY1, T globZ0, T globZ1, int &locX0, int &locX1, int &locY0, int &locY1, int &locZ0, int &locZ1, int overlap=0) const
 Checks whether there is an intersection and returns the local active node range which can be empty by means of locX0=1, locX1=0, locY0=1, locY1=0, locZ0=1; locZ1=0 of the cuboid extended with an layer of size overlap*delta.
 
bool checkInters (Cuboid3D< T > &child) const
 Returns true iff cuboid intersects child.
 
void divide (int p, int q, int r, std::vector< Cuboid3D< T > > &childrenC) const
 Divides the cuboid in p*q*r cuboids of equal volume and add them to the given vector.
 
void divide (int p, std::vector< Cuboid3D< T > > &childrenC) const
 Divides the cuboid in p cuboids of equal volume and add them to the given vector.
 
void divideFractional (int iD, std::vector< T > fractions, std::vector< Cuboid3D< T > > &childrenC) const
 Divides the cuboid into fractions along the iDth dimension.
 
void resize (int X, int Y, int Z, int nX, int nY, int nZ)
 resize the cuboid to the passed size
 
- Public Member Functions inherited from olb::Serializable
virtual ~Serializable ()=default
 
template<bool includeLogOutputDir = true>
bool save (std::string fileName="", const bool enforceUint=false)
 Save Serializable into file fileName
 
template<bool includeLogOutputDir = true>
bool load (std::string fileName="", const bool enforceUint=false)
 Load Serializable from file fileName
 
bool save (std::uint8_t *buffer)
 Save Serializable into buffer of length getSerializableSize
 
bool load (const std::uint8_t *buffer)
 Load Serializable from buffer of length getSerializableSize
 
virtual void postLoad ()
 

Static Public Member Functions

static Cuboid3D< T > motherOf (Cuboid3D< T > a, Cuboid3D< T > b)
 Return minimum bounding cuboid encompassing both a and b.
 

Additional Inherited Members

- 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.
 

Detailed Description

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

A regular single 3D cuboid is the basic component of a 3D cuboid structure which defines the grid.

A cuboid is given with its left lower corner, the number of nodes in the direction x, y and z and the distance between two nodes. Among after useful methods a cuboid can divide itself in a given number of disjoint subcuboids. The number of nodes at the boundary is minimized.

This class is not intended to be derived from.

Definition at line 58 of file cuboid3D.h.

Constructor & Destructor Documentation

◆ Cuboid3D() [1/6]

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

Construction of an empty cuboid at position 0, 0, 0 with delta 0 and nX = nY = nZ = 0.

Definition at line 50 of file cuboid3D.hh.

50 : Cuboid3D<T>(0, 0, 0, 0, 0, 0, 0)
51{
52}

◆ Cuboid3D() [2/6]

template<typename T >
olb::Cuboid3D< T >::Cuboid3D ( T globPosX,
T globPosY,
T globPosZ,
T delta,
int nX,
int nY,
int nZ )

Construction of a cuboid.

Definition at line 55 of file cuboid3D.hh.

57 : _weight(std::numeric_limits<size_t>::max()), clout(std::cout,"Cuboid3D")
58{
59 init(globPosX, globPosY, globPosZ, delta, nX, nY, nZ);
60}
void init(T globPosX, T globPosY, T globPosZ, T delta, int nX, int nY, int nZ)
Initializes the cuboid.
Definition cuboid3D.hh:111

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

+ Here is the call graph for this function:

◆ Cuboid3D() [3/6]

template<typename T >
olb::Cuboid3D< T >::Cuboid3D ( std::vector< T > origin,
T delta,
std::vector< int > extend )

Construction of a cuboid vector version.

Definition at line 63 of file cuboid3D.hh.

64 : clout(std::cout,"Cuboid3D")
65{
66 _weight = std::numeric_limits<size_t>::max();
67 init(origin[0], origin[1], origin[2], delta, extend[0], extend[1], extend[2]);
68}

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

+ Here is the call graph for this function:

◆ Cuboid3D() [4/6]

template<typename T >
olb::Cuboid3D< T >::Cuboid3D ( Vector< T, 3 > origin,
T delta,
Vector< int, 3 > extend )

Definition at line 71 of file cuboid3D.hh.

72 : clout(std::cout,"Cuboid3D")
73{
74 _weight = std::numeric_limits<size_t>::max();
75 init(origin[0], origin[1], origin[2], delta, extend[0], extend[1], extend[2]);
76}

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

+ Here is the call graph for this function:

◆ Cuboid3D() [5/6]

template<typename T >
olb::Cuboid3D< T >::Cuboid3D ( IndicatorF3D< T > & indicatorF,
T voxelSize )

Construction of a cuboid using indicator.

Definition at line 79 of file cuboid3D.hh.

80 : clout(std::cout,"Cuboid3D")
81{
82 _weight = std::numeric_limits<size_t>::max();
83 init(indicatorF.getMin()[0], indicatorF.getMin()[1], indicatorF.getMin()[2], voxelSize,
84 (int)((indicatorF.getMax()[0]-indicatorF.getMin()[0])/voxelSize+1.5),
85 (int)((indicatorF.getMax()[1]-indicatorF.getMin()[1])/voxelSize+1.5),
86 (int)((indicatorF.getMax()[2]-indicatorF.getMin()[2])/voxelSize+1.5));
87}
virtual Vector< S, 3 > & getMax()
virtual Vector< S, 3 > & getMin()

◆ Cuboid3D() [6/6]

template<typename T >
olb::Cuboid3D< T >::Cuboid3D ( Cuboid3D< T > const & rhs,
int overlap = 0 )

Copy constructor.

Definition at line 91 of file cuboid3D.hh.

91 : clout(std::cout,"Cuboid3D")
92{
93 init( rhs._globPosX-rhs._delta*overlap, rhs._globPosY-rhs._delta*overlap,
94 rhs._globPosZ-rhs._delta*overlap, rhs._delta, rhs._nX+2*overlap,
95 rhs._nY+2*overlap, rhs._nZ+2*overlap);
96 _weight = rhs._weight;
97}

Member Function Documentation

◆ checkInters() [1/4]

template<typename T >
bool olb::Cuboid3D< T >::checkInters ( Cuboid3D< T > & child) const

Returns true iff cuboid intersects child.

Definition at line 431 of file cuboid3D.hh.

432{
433 return checkInters(child.getOrigin()[0], child.getOrigin()[0] + child.getDeltaR()*(child.getExtent()[0]-1),
434 child.getOrigin()[1], child.getOrigin()[1] + child.getDeltaR()*(child.getExtent()[1]-1),
435 child.getOrigin()[2], child.getOrigin()[2] + child.getDeltaR()*(child.getExtent()[2]-1),
436 0);
437}
bool checkInters(T globX0, T globX1, T globY0, T globY1, T globZ0, T globZ1, int overlap=0) const
Checks whether there is an intersection with the cuboid extended with an layer of size overlap*delta.
Definition cuboid3D.hh:409

References olb::Cuboid3D< T >::getDeltaR(), olb::Cuboid3D< T >::getExtent(), and olb::Cuboid3D< T >::getOrigin().

+ Here is the call graph for this function:

◆ checkInters() [2/4]

template<typename T >
bool olb::Cuboid3D< T >::checkInters ( T globX,
T globY,
T globZ,
int overlap = 0 ) const

Checks whether a given point intersects the cuboid extended by a layer of size overlap*delta.

Definition at line 425 of file cuboid3D.hh.

426{
427 return checkInters(globX, globX, globY, globY, globZ, globZ, overlap);
428}

◆ checkInters() [3/4]

template<typename T >
bool olb::Cuboid3D< T >::checkInters ( T globX0,
T globX1,
T globY0,
T globY1,
T globZ0,
T globZ1,
int & locX0,
int & locX1,
int & locY0,
int & locY1,
int & locZ0,
int & locZ1,
int overlap = 0 ) const

Checks whether there is an intersection and returns the local active node range which can be empty by means of locX0=1, locX1=0, locY0=1, locY1=0, locZ0=1; locZ1=0 of the cuboid extended with an layer of size overlap*delta.

Definition at line 440 of file cuboid3D.hh.

442{
443 if (overlap!=0) {
444 Cuboid3D tmp(_globPosX - overlap*_delta, _globPosY - overlap*_delta, _globPosZ - overlap*_delta,
445 _delta, _nX + overlap*2, _nY + overlap*2, _nZ + overlap*2);
446 return tmp.checkInters(globX0, globX1, globY0, globY1, globZ0, globZ1,
447 locX0, locX1, locY0, locY1, locZ0, locZ1);
448 }
449 else if (!checkInters(globX0, globX1, globY0, globY1, globZ0, globZ1)) {
450 locX0 = 1;
451 locX1 = 0;
452 locY0 = 1;
453 locY1 = 0;
454 locZ0 = 1;
455 locZ1 = 0;
456 return false;
457 }
458 else {
459 locX0 = 0;
460 for (int i=0; _globPosX + i*_delta < globX0; i++) {
461 locX0 = i+1;
462 }
463 locX1 = _nX-1;
464 for (int i=_nX-1; _globPosX + i*_delta > globX1; i--) {
465 locX1 = i-1;
466 }
467 locY0 = 0;
468 for (int i=0; _globPosY + i*_delta < globY0; i++) {
469 locY0 = i+1;
470 }
471 locY1 = _nY-1;
472 for (int i=_nY-1; _globPosY + i*_delta > globY1; i--) {
473 locY1 = i-1;
474 }
475 locZ0 = 0;
476 for (int i=0; _globPosZ + i*_delta < globZ0; i++) {
477 locZ0 = i+1;
478 }
479 locZ1 = _nZ-1;
480 for (int i=_nZ-1; _globPosZ + i*_delta > globZ1; i--) {
481 locZ1 = i-1;
482 }
483 return true;
484 }
485}
Cuboid3D()
Construction of an empty cuboid at position 0, 0, 0 with delta 0 and nX = nY = nZ = 0.
Definition cuboid3D.hh:50

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

+ Here is the call graph for this function:

◆ checkInters() [4/4]

template<typename T >
bool olb::Cuboid3D< T >::checkInters ( T globX0,
T globX1,
T globY0,
T globY1,
T globZ0,
T globZ1,
int overlap = 0 ) const

Checks whether there is an intersection with the cuboid extended with an layer of size overlap*delta.

Definition at line 409 of file cuboid3D.hh.

411{
412 T locX0d = util::max(_globPosX-overlap*_delta,globX0);
413 T locY0d = util::max(_globPosY-overlap*_delta,globY0);
414 T locZ0d = util::max(_globPosZ-overlap*_delta,globZ0);
415 T locX1d = util::min(_globPosX+(_nX+overlap-1)*_delta,globX1);
416 T locY1d = util::min(_globPosY+(_nY+overlap-1)*_delta,globY1);
417 T locZ1d = util::min(_globPosZ+(_nZ+overlap-1)*_delta,globZ1);
418
419 return locX1d >= locX0d
420 && locY1d >= locY0d
421 && locZ1d >= locZ0d;
422}
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:

◆ checkPoint() [1/3]

template<typename T >
bool olb::Cuboid3D< T >::checkPoint ( T globX,
T globY,
T globZ,
int & locX,
int & locY,
int & locZ,
int overlap = 0 ) const

Checks whether a point (globX/gloxY/globZ) is contained and is a node in the cuboid extended with an layer of size overlap*delta and returns the local active node.

Definition at line 389 of file cuboid3D.hh.

391{
392 if (overlap!=0) {
393 Cuboid3D tmp(_globPosX - overlap*_delta, _globPosY - overlap*_delta, _globPosZ - overlap*_delta,
394 _delta, _nX + overlap*2, _nY + overlap*2, _nZ + overlap*2);
395 return tmp.checkPoint(globX, globY, globZ, locX, locY, locZ);
396 }
397 else if (!checkPoint(globX, globY, globZ)) {
398 return false;
399 }
400 else {
401 locX = (int)util::floor((globX - (T)_globPosX)/_delta + .5);
402 locY = (int)util::floor((globY - (T)_globPosY)/_delta + .5);
403 locZ = (int)util::floor((globZ - (T)_globPosZ)/_delta + .5);
404 return true;
405 }
406}
bool checkPoint(T globX, T globY, T globZ, int overlap=0) const
Checks whether a point (globX/gloxY/globZ) is contained in the cuboid extended with an layer of size ...
Definition cuboid3D.hh:361
ADf< T, DIM > floor(const ADf< T, DIM > &a)
Definition aDiff.h:869

References olb::Cuboid3D< T >::checkPoint(), and olb::util::floor().

+ Here is the call graph for this function:

◆ checkPoint() [2/3]

template<typename T >
bool olb::Cuboid3D< T >::checkPoint ( T globX,
T globY,
T globZ,
int overlap = 0 ) const

Checks whether a point (globX/gloxY/globZ) is contained in the cuboid extended with an layer of size overlap*delta.

Definition at line 361 of file cuboid3D.hh.

362{
363 return _globPosX <= globX + overlap * _delta + _delta / 2. &&
364 _globPosX + T(_nX+overlap) * _delta > globX + _delta / 2. &&
365 _globPosY <= globY + overlap * _delta + _delta/2. &&
366 _globPosY + T(_nY+overlap) * _delta > globY + _delta / 2. &&
367 _globPosZ <= globZ + overlap * _delta + _delta/2. &&
368 _globPosZ + T(_nZ+overlap) * _delta > globZ + _delta / 2.;
369}
+ Here is the caller graph for this function:

◆ checkPoint() [3/3]

template<typename T >
bool olb::Cuboid3D< T >::checkPoint ( Vector< T, 3 > & globXYZ,
int overlap = 0 ) const

Definition at line 372 of file cuboid3D.hh.

373{
374 return checkPoint(globXYZ[0], globXYZ[1], globXYZ[2], overlap);
375}

◆ divide() [1/2]

template<typename T >
void olb::Cuboid3D< T >::divide ( int p,
int q,
int r,
std::vector< Cuboid3D< T > > & childrenC ) const

Divides the cuboid in p*q*r cuboids of equal volume and add them to the given vector.

Definition at line 488 of file cuboid3D.hh.

489{
490 int xN_child = 0;
491 int yN_child = 0;
492 int zN_child = 0;
493
494 T globPosX_child = _globPosX;
495 T globPosY_child = _globPosY;
496 T globPosZ_child = _globPosZ;
497
498 for (int iX=0; iX<nX; iX++) {
499 for (int iY=0; iY<nY; iY++) {
500 for (int iZ=0; iZ<nZ; iZ++) {
501 xN_child = (_nX+nX-iX-1)/nX;
502 yN_child = (_nY+nY-iY-1)/nY;
503 zN_child = (_nZ+nZ-iZ-1)/nZ;
504 Cuboid3D<T> child(globPosX_child, globPosY_child, globPosZ_child,
505 _delta, xN_child, yN_child, zN_child);
506 childrenC.push_back(child);
507 globPosZ_child += zN_child*_delta;
508 }
509 globPosZ_child = _globPosZ;
510 globPosY_child += yN_child*_delta;
511 }
512 globPosY_child = _globPosY;
513 globPosX_child += xN_child*_delta;
514 }
515}
+ Here is the caller graph for this function:

◆ divide() [2/2]

template<typename T >
void olb::Cuboid3D< T >::divide ( int p,
std::vector< Cuboid3D< T > > & childrenC ) const

Divides the cuboid in p cuboids of equal volume and add them to the given vector.

Definition at line 561 of file cuboid3D.hh.

562{
563
564 OLB_PRECONDITION(p>0);
565
566 int iXX = 1;
567 int iYY = 1;
568 int iZZ = p;
569 int nX = _nX/iXX;
570 int bestIx = iXX;
571 int nY = _nY/iYY;
572 int bestIy = iYY;
573 int nZ = _nZ/iZZ;
574 int bestIz = iZZ;
575 T bestRatio = ((T)(_nX/iXX)/(T)(_nY/iYY)-1)*((T)(_nX/iXX)/(T)(_nY/iYY)-1)
576 + ((T)(_nY/iYY)/(T)(_nZ/iZZ)-1)*((T)(_nY/iYY)/(T)(_nZ/iZZ)-1)
577 + ((T)(_nZ/iZZ)/(T)(_nX/iXX)-1)*((T)(_nZ/iZZ)/(T)(_nX/iXX)-1);
578
579 for (int iX=1; iX<=p; iX++) {
580 for (int iY=1; iY*iX<=p; iY++) {
581 for (int iZ=p/(iX*iY); iZ*iY*iX<=p; iZ++) {
582 if ((iX+1)*iY*iZ>p && iX*(iY+1)*iZ>p ) {
583 T ratio = ((T)(_nX/iX)/(T)(_nY/iY)-1)*((T)(_nX/iX)/(T)(_nY/iY)-1)
584 + ((T)(_nY/iY)/(T)(_nZ/iZ)-1)*((T)(_nY/iY)/(T)(_nZ/iZ)-1)
585 + ((T)(_nZ/iZ)/(T)(_nX/iX)-1)*((T)(_nZ/iZ)/(T)(_nX/iX)-1);
586 if (ratio<bestRatio) {
587 bestRatio = ratio;
588 bestIx = iX;
589 bestIy = iY;
590 bestIz = iZ;
591 nX = _nX/iX;
592 nY = _nY/iY;
593 nZ = _nZ/iZ;
594 }
595 }
596 }
597 }
598 }
599
600 int rest = p - bestIx*bestIy*bestIz;
601
602 // split in one cuboid
603 if (rest==0) {
604 divide(bestIx, bestIy, bestIz, childrenC);
605 return;
606 }
607 else {
608
609 // add in z than in y direction
610 if (nZ>nY && nZ>nX) {
611
612 int restY = rest%bestIy;
613 // split in two cuboid
614 if (restY==0) {
615 int restX = rest/bestIy;
616 CuboidGeometry2D<T> helpG(_globPosX, _globPosZ, _delta, _nX, _nZ, bestIx*bestIz+restX);
617
618 int yN_child = 0;
619 T globPosY_child = _globPosY;
620
621 for (int iY=0; iY<bestIy; iY++) {
622 yN_child = (_nY+bestIy-iY-1)/bestIy;
623 for (int iC=0; iC<helpG.getNc(); iC++) {
624 int xN_child = helpG.get(iC).getNx();
625 int zN_child = helpG.get(iC).getNy();
626 T globPosX_child = helpG.get(iC).get_globPosX();
627 T globPosZ_child = helpG.get(iC).get_globPosY();
628
629 Cuboid3D<T> child(globPosX_child, globPosY_child, globPosZ_child,
630 _delta, xN_child, yN_child, zN_child);
631 childrenC.push_back(child);
632
633 }
634 globPosY_child += yN_child*_delta;
635 }
636 return;
637 }
638
639 // split in four cuboid
640
641 int restX = rest/bestIy+1;
642 int yN_child = 0;
643 T globPosY_child = _globPosY;
644 int splited_nY = (int) (_nY * (T)((bestIx*bestIz+restX)*restY)/(T)p);
645 CuboidGeometry2D<T> helpG0(_globPosX, _globPosZ, _delta, _nX, _nZ, bestIx*bestIz+restX);
646
647 for (int iY=0; iY<restY; iY++) {
648 yN_child = (splited_nY+restY-iY-1)/restY;
649 for (int iC=0; iC<helpG0.getNc(); iC++) {
650 int xN_child = helpG0.get(iC).getNx();
651 int zN_child = helpG0.get(iC).getNy();
652 T globPosX_child = helpG0.get(iC).get_globPosX();
653 T globPosZ_child = helpG0.get(iC).get_globPosY();
654
655 Cuboid3D<T> child(globPosX_child, globPosY_child, globPosZ_child,
656 _delta, xN_child, yN_child, zN_child);
657 childrenC.push_back(child);
658 }
659 globPosY_child += yN_child*_delta;
660 }
661
662 splited_nY = _nY - splited_nY;
663 restX = rest/bestIy;
664 CuboidGeometry2D<T> helpG1(_globPosX, _globPosZ, _delta, _nX, _nZ, bestIx*bestIz+restX);
665 yN_child = 0;
666
667 for (int iY=0; iY<bestIy-restY; iY++) {
668 yN_child = (splited_nY+bestIy-restY-iY-1)/(bestIy-restY);
669 for (int iC=0; iC<helpG1.getNc(); iC++) {
670 int xN_child = helpG1.get(iC).getNx();
671 int zN_child = helpG1.get(iC).getNy();
672 T globPosX_child = helpG1.get(iC).get_globPosX();
673 T globPosZ_child = helpG1.get(iC).get_globPosY();
674
675 Cuboid3D<T> child(globPosX_child, globPosY_child, globPosZ_child,
676 _delta, xN_child, yN_child, zN_child);
677 childrenC.push_back(child);
678 }
679 globPosY_child += yN_child*_delta;
680 }
681 return;
682 }
683
684 // add in x than in y direction
685 else if (nX>nY && nX>nZ) {
686 int restY = rest%bestIy;
687 // split in two cuboid
688 if (restY==0) {
689 int restZ = rest/bestIy;
690 CuboidGeometry2D<T> helpG(_globPosX, _globPosZ, _delta, _nX, _nZ, bestIx*bestIz+restZ);
691
692 int yN_child = 0;
693 T globPosY_child = _globPosY;
694
695 for (int iY=0; iY<bestIy; iY++) {
696 yN_child = (_nY+bestIy-iY-1)/bestIy;
697 for (int iC=0; iC<helpG.getNc(); iC++) {
698 int xN_child = helpG.get(iC).getNx();
699 int zN_child = helpG.get(iC).getNy();
700 T globPosX_child = helpG.get(iC).get_globPosX();
701 T globPosZ_child = helpG.get(iC).get_globPosY();
702
703 Cuboid3D<T> child(globPosX_child, globPosY_child, globPosZ_child,
704 _delta, xN_child, yN_child, zN_child);
705 childrenC.push_back(child);
706
707 }
708 globPosY_child += yN_child*_delta;
709 }
710 return;
711 }
712
713 // split in four cuboid
714
715 int restZ = rest/bestIy+1;
716
717 int yN_child = 0;
718 T globPosY_child = _globPosY;
719 int splited_nY = (int) (_nY * (T)((bestIx*bestIz+restZ)*restY)/(T)p);
720 CuboidGeometry2D<T> helpG0(_globPosX, _globPosZ, _delta, _nX, _nZ, bestIx*bestIz+restZ);
721
722 for (int iY=0; iY<restY; iY++) {
723 yN_child = (splited_nY+restY-iY-1)/restY;
724 for (int iC=0; iC<helpG0.getNc(); iC++) {
725 int xN_child = helpG0.get(iC).getNx();
726 int zN_child = helpG0.get(iC).getNy();
727 T globPosX_child = helpG0.get(iC).get_globPosX();
728 T globPosZ_child = helpG0.get(iC).get_globPosY();
729
730 Cuboid3D<T> child(globPosX_child, globPosY_child, globPosZ_child,
731 _delta, xN_child, yN_child, zN_child);
732 childrenC.push_back(child);
733 }
734 globPosY_child += yN_child*_delta;
735 }
736
737 splited_nY = _nY - splited_nY;
738 restZ = rest/bestIy;
739
740 CuboidGeometry2D<T> helpG1(_globPosX, _globPosZ, _delta, _nX, _nZ, bestIx*bestIz+restZ);
741 yN_child = 0;
742
743 for (int iY=0; iY<bestIy-restY; iY++) {
744 yN_child = (splited_nY+bestIy-restY-iY-1)/(bestIy-restY);
745 for (int iC=0; iC<helpG1.getNc(); iC++) {
746 int xN_child = helpG1.get(iC).getNx();
747 int zN_child = helpG1.get(iC).getNy();
748 T globPosX_child = helpG1.get(iC).get_globPosX();
749 T globPosZ_child = helpG1.get(iC).get_globPosY();
750
751 Cuboid3D<T> child(globPosX_child, globPosY_child, globPosZ_child,
752 _delta, xN_child, yN_child, zN_child);
753 childrenC.push_back(child);
754 }
755 globPosY_child += yN_child*_delta;
756 }
757 return;
758 }
759
760 // add in y than in x direction
761 else {
762 int restX = rest%bestIx;
763 // split in two cuboid
764 if (restX==0) {
765 int restZ = rest/bestIx;
766 CuboidGeometry2D<T> helpG(_globPosZ, _globPosY, _delta, _nZ, _nY, bestIz*bestIy+restZ);
767
768
769 int xN_child = 0;
770 T globPosX_child = _globPosX;
771
772 for (int iX=0; iX<bestIx; iX++) {
773 xN_child = (_nX+bestIx-iX-1)/bestIx;
774 for (int iC=0; iC<helpG.getNc(); iC++) {
775 int zN_child = helpG.get(iC).getNx();
776 int yN_child = helpG.get(iC).getNy();
777 T globPosZ_child = helpG.get(iC).get_globPosX();
778 T globPosY_child = helpG.get(iC).get_globPosY();
779
780 Cuboid3D<T> child(globPosX_child, globPosY_child, globPosZ_child,
781 _delta, xN_child, yN_child, zN_child);
782 childrenC.push_back(child);
783 }
784 globPosX_child += xN_child*_delta;
785 }
786 return;
787 }
788
789 // split in four cuboid
790
791 int restZ = rest/bestIx+1;
792 int xN_child = 0;
793 T globPosX_child = _globPosX;
794 int splited_nX = (int) (_nX * (T)((bestIz*bestIy+restZ)*restX)/(T)p);
795 CuboidGeometry2D<T> helpG0(_globPosZ, _globPosY, _delta, _nZ, _nY, bestIz*bestIy+restZ);
796
797 for (int iX=0; iX<restX; iX++) {
798 xN_child = (splited_nX+restX-iX-1)/restX;
799 for (int iC=0; iC<helpG0.getNc(); iC++) {
800 int zN_child = helpG0.get(iC).getNx();
801 int yN_child = helpG0.get(iC).getNy();
802 T globPosZ_child = helpG0.get(iC).get_globPosX();
803 T globPosY_child = helpG0.get(iC).get_globPosY();
804
805 Cuboid3D<T> child(globPosX_child, globPosY_child, globPosZ_child,
806 _delta, xN_child, yN_child, zN_child);
807 childrenC.push_back(child);
808 }
809 globPosX_child += xN_child*_delta;
810 }
811
812 splited_nX = _nX - splited_nX;
813 restZ = rest/bestIx;
814 CuboidGeometry2D<T> helpG1(_globPosZ, _globPosY, _delta, _nZ, _nY, bestIz*bestIy+restZ);
815 xN_child = 0;
816
817 for (int iX=0; iX<bestIx-restX; iX++) {
818 xN_child = (splited_nX+bestIx-restX-iX-1)/(bestIx-restX);
819 for (int iC=0; iC<helpG1.getNc(); iC++) {
820 int zN_child = helpG1.get(iC).getNx();
821 int yN_child = helpG1.get(iC).getNy();
822 T globPosZ_child = helpG1.get(iC).get_globPosX();
823 T globPosY_child = helpG1.get(iC).get_globPosY();
824
825 Cuboid3D<T> child(globPosX_child, globPosY_child, globPosZ_child,
826 _delta, xN_child, yN_child, zN_child);
827 childrenC.push_back(child);
828 }
829 globPosX_child += xN_child*_delta;
830 }
831 return;
832 }
833 }
834}
void divide(int p, int q, int r, std::vector< Cuboid3D< T > > &childrenC) const
Divides the cuboid in p*q*r cuboids of equal volume and add them to the given vector.
Definition cuboid3D.hh:488
#define OLB_PRECONDITION(COND)
Definition olbDebug.h:46

References olb::CuboidGeometry2D< T >::get(), olb::CuboidGeometry2D< T >::getNc(), and OLB_PRECONDITION.

+ Here is the call graph for this function:

◆ divideFractional()

template<typename T >
void olb::Cuboid3D< T >::divideFractional ( int iD,
std::vector< T > fractions,
std::vector< Cuboid3D< T > > & childrenC ) const

Divides the cuboid into fractions along the iDth dimension.

Definition at line 530 of file cuboid3D.hh.

531{
532 auto delta = Vector<T,3>([&](int i) -> T {
533 return i == iD ? _delta : 0;
534 });
535 auto base = Vector<int,3>([&](int i) -> T {
536 return i == iD ? 1 : 0;
537 });
538
539 std::vector<int> fractionWidths;
540 int totalWidth = 0;
541 for (T f : fractions) {
542 fractionWidths.emplace_back(f * (getExtent()*base));
543 totalWidth += fractionWidths.back();
544 }
545 fractionWidths.back() += getExtent()*base - totalWidth;
546
547 auto origin = getOrigin();
548 auto extent = Vector<int,3>([&](int i) -> T {
549 return i == iD ? 0 : getExtent()[i];
550 });
551
552 for (int width : fractionWidths) {
553 Cuboid3D<T> child(origin, _delta, extent + (width)*base);
554 child.print();
555 origin += width*delta;
556 childrenC.push_back(child);
557 }
558}
Vector< T, 3 > getOrigin() const
Read only access to left lower corner coordinates.
Definition cuboid3D.hh:135
Vector< int, 3 > const getExtent() const
Read only access to the number of voxels in every dimension.
Definition cuboid3D.hh:165

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

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

◆ getBlock()

template<typename T >
bool * olb::Cuboid3D< T >::getBlock ( std::size_t iBlock,
std::size_t & sizeBlock,
bool loadingMode )
overridevirtual
Returns
a pointer to the memory of the current block and its size for the serializable interface

Implements olb::Serializable.

Definition at line 266 of file cuboid3D.hh.

267{
268 std::size_t currentBlock = 0;
269 bool* dataPtr = nullptr;
270
271 registerVar(iBlock, sizeBlock, currentBlock, dataPtr, _globPosX);
272 registerVar(iBlock, sizeBlock, currentBlock, dataPtr, _globPosY);
273 registerVar(iBlock, sizeBlock, currentBlock, dataPtr, _globPosZ);
274 registerVar(iBlock, sizeBlock, currentBlock, dataPtr, _delta);
275 registerVar(iBlock, sizeBlock, currentBlock, dataPtr, _nX);
276 registerVar(iBlock, sizeBlock, currentBlock, dataPtr, _nY);
277 registerVar(iBlock, sizeBlock, currentBlock, dataPtr, _nZ);
278 registerVar(iBlock, sizeBlock, currentBlock, dataPtr, _weight);
279
280 return dataPtr;
281}
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.
Definition serializer.h:212

◆ getDeltaR()

template<typename T >
T olb::Cuboid3D< T >::getDeltaR ( ) const

Read only access to the distance of cuboid nodes.

Definition at line 141 of file cuboid3D.hh.

142{
143 return _delta;
144}
+ Here is the caller graph for this function:

◆ getExtent()

template<typename T >
Vector< int, 3 > const olb::Cuboid3D< T >::getExtent ( ) const

Read only access to the number of voxels in every dimension.

Definition at line 165 of file cuboid3D.hh.

166{
167 return Vector<int,3> (_nX, _nY, _nZ);
168}
+ Here is the caller graph for this function:

◆ getFloorLatticeR() [1/2]

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

Definition at line 347 of file cuboid3D.hh.

348{
349 getFloorLatticeR(&latticeR[0], &physR[0]);
350}
void getFloorLatticeR(const std::vector< T > &physR, std::vector< int > &latticeR) const
Definition cuboid3D.hh:347

◆ getFloorLatticeR() [2/2]

template<typename T >
void olb::Cuboid3D< T >::getFloorLatticeR ( int latticeR[3],
const T physR[3] ) const

Definition at line 353 of file cuboid3D.hh.

354{
355 latticeR[0] = (int)util::floor( (physR[0] - _globPosX)/_delta);
356 latticeR[1] = (int)util::floor( (physR[1] - _globPosY)/_delta);
357 latticeR[2] = (int)util::floor( (physR[2] - _globPosZ)/_delta);
358}

References olb::util::floor().

+ Here is the call graph for this function:

◆ getFraction()

template<typename T >
T olb::Cuboid3D< T >::getFraction ( ) const
inline

Returns fraction of full cells (weight / volume)

Definition at line 115 of file cuboid3D.h.

115 {
116 return T(getWeight()) / getLatticeVolume();
117 }
size_t getLatticeVolume() const
Returns the number of Nodes in the volume.
Definition cuboid3D.hh:221
std::size_t getWeight() const
Returns the number of full cells.
Definition cuboid3D.hh:183

References olb::Cuboid3D< T >::getLatticeVolume(), and olb::Cuboid3D< T >::getWeight().

+ Here is the call graph for this function:

◆ getLatticePerimeter()

template<typename T >
int olb::Cuboid3D< T >::getLatticePerimeter ( ) const

Returns the number of Nodes at the perimeter.

Definition at line 233 of file cuboid3D.hh.

234{
235 return 2*((_nX-1)*(_nY-1) + (_nY-1)*(_nZ-1) + (_nZ-1)*(_nX-1));
236}

◆ getLatticeR() [1/3]

template<typename T >
void olb::Cuboid3D< T >::getLatticeR ( int latticeR[3],
const T physR[3] ) const

Definition at line 331 of file cuboid3D.hh.

332{
333 latticeR[0] = (int)util::floor( (physR[0] - _globPosX )/_delta +.5);
334 latticeR[1] = (int)util::floor( (physR[1] - _globPosY )/_delta +.5);
335 latticeR[2] = (int)util::floor( (physR[2] - _globPosZ )/_delta +.5);
336}

References olb::util::floor().

+ Here is the call graph for this function:

◆ getLatticeR() [2/3]

template<typename T >
void olb::Cuboid3D< T >::getLatticeR ( int latticeR[3],
const Vector< T, 3 > & physR ) const

Definition at line 339 of file cuboid3D.hh.

340{
341 latticeR[0] = (int)util::floor( (physR[0] - _globPosX )/_delta +.5);
342 latticeR[1] = (int)util::floor( (physR[1] - _globPosY )/_delta +.5);
343 latticeR[2] = (int)util::floor( (physR[2] - _globPosZ )/_delta +.5);
344}

References olb::util::floor().

+ Here is the call graph for this function:

◆ getLatticeR() [3/3]

template<typename T >
bool olb::Cuboid3D< T >::getLatticeR ( Vector< T, 3 > physR,
Vector< int, 3 > & latticeR,
T eps = 1e-5 )
inline

Definition at line 128 of file cuboid3D.h.

128 {
129 auto globR = Vector<T,3>{_globPosX, _globPosY, _globPosZ};
130 auto physLatticeR = (physR - globR) / _delta;
131 if ( std::fabs(std::roundf(physLatticeR[0]) - physLatticeR[0]) <= eps
132 && std::fabs(std::roundf(physLatticeR[1]) - physLatticeR[1]) <= eps
133 && std::fabs(std::roundf(physLatticeR[2]) - physLatticeR[2]) <= eps) {
134 latticeR[0] = std::roundf(physLatticeR[0]);
135 latticeR[1] = std::roundf(physLatticeR[1]);
136 latticeR[2] = std::roundf(physLatticeR[2]);
137 return true;
138 } else {
139 return false;
140 }
141 }
+ Here is the caller graph for this function:

◆ getLatticeVolume()

template<typename T >
size_t olb::Cuboid3D< T >::getLatticeVolume ( ) const

Returns the number of Nodes in the volume.

Definition at line 221 of file cuboid3D.hh.

222{
223 return static_cast<size_t>(_nY)*static_cast<size_t>(_nX)*static_cast<size_t>(_nZ);
224}
+ Here is the caller graph for this function:

◆ getNblock()

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

Number of data blocks for the serializable interface.

Implements olb::Serializable.

Definition at line 123 of file cuboid3D.hh.

124{
125 return 9;
126}

◆ getNx()

template<typename T >
int olb::Cuboid3D< T >::getNx ( ) const

Read access to cuboid width.

Definition at line 147 of file cuboid3D.hh.

148{
149 return _nX;
150}
+ Here is the caller graph for this function:

◆ getNy()

template<typename T >
int olb::Cuboid3D< T >::getNy ( ) const

Read access to cuboid height.

Definition at line 153 of file cuboid3D.hh.

154{
155 return _nY;
156}
+ Here is the caller graph for this function:

◆ getNz()

template<typename T >
int olb::Cuboid3D< T >::getNz ( ) const

Read access to cuboid depth.

Definition at line 159 of file cuboid3D.hh.

160{
161 return _nZ;
162}
+ Here is the caller graph for this function:

◆ getOrigin()

template<typename T >
Vector< T, 3 > olb::Cuboid3D< T >::getOrigin ( ) const

Read only access to left lower corner coordinates.

Definition at line 135 of file cuboid3D.hh.

136{
137 return Vector<T,3> (_globPosX, _globPosY, _globPosZ);
138}
+ Here is the caller graph for this function:

◆ getPhysPerimeter()

template<typename T >
T olb::Cuboid3D< T >::getPhysPerimeter ( ) const

Returns the perimeter of the cuboid.

Definition at line 227 of file cuboid3D.hh.

228{
229 return 2*_delta*_delta*(_nX*_nY + _nY*_nZ + _nZ*_nX);
230}

◆ getPhysR() [1/3]

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

Definition at line 323 of file cuboid3D.hh.

324{
325 physR[0] = _globPosX + iX*_delta;
326 physR[1] = _globPosY + iY*_delta;
327 physR[2] = _globPosZ + iZ*_delta;
328}

◆ getPhysR() [2/3]

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

Definition at line 307 of file cuboid3D.hh.

308{
309 physR[0] = _globPosX + latticeR[0]*_delta;
310 physR[1] = _globPosY + latticeR[1]*_delta;
311 physR[2] = _globPosZ + latticeR[2]*_delta;
312}

◆ getPhysR() [3/3]

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

Definition at line 315 of file cuboid3D.hh.

316{
317 physR[0] = _globPosX + latticeR[0]*_delta;
318 physR[1] = _globPosY + latticeR[1]*_delta;
319 physR[2] = _globPosZ + latticeR[2]*_delta;
320}

◆ getPhysVolume()

template<typename T >
T olb::Cuboid3D< T >::getPhysVolume ( ) const

Returns the volume of the cuboid.

Definition at line 171 of file cuboid3D.hh.

172{
173 return _nY*_nX*_nZ*_delta*_delta*_delta;
174}

◆ getSerializableSize()

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

Binary size for the serializer interface.

Implements olb::Serializable.

Definition at line 129 of file cuboid3D.hh.

130{
131 return ( 4 * sizeof(T) ) + ( 5 * sizeof(int) );
132}

◆ getWeight()

template<typename T >
size_t olb::Cuboid3D< T >::getWeight ( ) const

Returns the number of full cells.

Definition at line 183 of file cuboid3D.hh.

184{
185 if (_weight == std::numeric_limits<size_t>::max()) {
186 return getLatticeVolume();
187 }
188 else {
189 return _weight;
190 }
191}
+ Here is the caller graph for this function:

◆ getWeightIn()

template<typename T >
std::size_t olb::Cuboid3D< T >::getWeightIn ( IndicatorF3D< T > & indicator) const

Returns the number of full cells w.r.t. indicator.

Definition at line 194 of file cuboid3D.hh.

195{
196 std::size_t weight = 0;
197 T physR[3] { };
198 int latticeR[3] { };
199 for (latticeR[0] = 0; latticeR[0] < getNx(); ++latticeR[0]) {
200 for (latticeR[1] = 0; latticeR[1] < getNy(); ++latticeR[1]) {
201 for (latticeR[2] = 0; latticeR[2] < getNz(); ++latticeR[2]) {
202 getPhysR(physR, latticeR);
203 bool inside;
204 indicatorF(&inside, physR);
205 if (inside) {
206 weight += 1;
207 }
208 }
209 }
210 }
211 return weight;
212}
int getNz() const
Read access to cuboid depth.
Definition cuboid3D.hh:159
int getNy() const
Read access to cuboid height.
Definition cuboid3D.hh:153
int getNx() const
Read access to cuboid width.
Definition cuboid3D.hh:147
void getPhysR(T physR[3], const int latticeR[3]) const
Definition cuboid3D.hh:307

◆ getWeightValue()

template<typename T >
int olb::Cuboid3D< T >::getWeightValue ( ) const

Returns the actual value of weight (-1 for getLatticeVolume())

Definition at line 177 of file cuboid3D.hh.

178{
179 return _weight;
180}

◆ init()

template<typename T >
void olb::Cuboid3D< T >::init ( T globPosX,
T globPosY,
T globPosZ,
T delta,
int nX,
int nY,
int nZ )

Initializes the cuboid.

Definition at line 111 of file cuboid3D.hh.

112{
113 _globPosX = globPosX;
114 _globPosY = globPosY;
115 _globPosZ = globPosZ;
116 _delta = delta;
117 _nX = nX;
118 _nY = nY;
119 _nZ = nZ;
120}
+ Here is the caller graph for this function:

◆ motherOf()

template<typename T >
static Cuboid3D< T > olb::Cuboid3D< T >::motherOf ( Cuboid3D< T > a,
Cuboid3D< T > b )
static

Return minimum bounding cuboid encompassing both a and b.

◆ operator=()

template<typename T >
Cuboid3D< T > & olb::Cuboid3D< T >::operator= ( Cuboid3D< T > const & rhs)

Copy assignment.

Definition at line 102 of file cuboid3D.hh.

103{
104 init( rhs._globPosX, rhs._globPosY, rhs._globPosZ, rhs._delta, rhs._nX,
105 rhs._nY, rhs._nZ);
106 _weight = rhs._weight;
107 return *this;
108}

◆ operator==()

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

equal operator

Definition at line 252 of file cuboid3D.hh.

253{
254 return util::nearZero<T>(_globPosX - rhs._globPosX) &&
255 util::nearZero<T>(_globPosY - rhs._globPosY) &&
256 util::nearZero<T>(_globPosZ - rhs._globPosZ) &&
257 util::nearZero<T>(_delta - rhs._delta) &&
258 _nX == rhs._nX &&
259 _nY == rhs._nY &&
260 _nZ == rhs._nZ &&
261 _weight == rhs._weight;
262}

◆ physCheckPoint()

template<typename T >
bool olb::Cuboid3D< T >::physCheckPoint ( T globX,
T globY,
T globZ,
double overlap = 0 ) const

Same for physical overlap.

Definition at line 378 of file cuboid3D.hh.

379{
380 return _globPosX <= globX + T(0.5 + overlap) * _delta &&
381 _globPosX + T(_nX+overlap)*_delta > globX + _delta / 2. &&
382 _globPosY <= globY + T(0.5 + overlap)*_delta &&
383 _globPosY + T(_nY+overlap)*_delta > globY + _delta / 2. &&
384 _globPosZ <= globZ + T(0.5 + overlap)*_delta &&
385 _globPosZ + T(_nZ+overlap)*_delta > globZ + _delta / 2.;
386}

◆ print()

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

Prints cuboid details.

Definition at line 284 of file cuboid3D.hh.

285{
286 clout << "--------Cuboid Details----------" << std::endl;
287 clout << " Corner (x/y/z): " << "\t" << "("
288 << _globPosX-_delta/2. << "/" << _globPosY - _delta/2.
289 << "/" << _globPosZ - _delta/2. << ")" << std::endl;
290 clout << " Delta: " << "\t" << "\t" << getDeltaR() << std::endl;
291 clout << " Perimeter: " << "\t" << "\t" << getPhysPerimeter() << std::endl;
292 clout << " Volume: " << "\t" << "\t" << getPhysVolume() << std::endl;
293 clout << " Extent (x/y/z): " << "\t" << "("
294 << getNx() << "/" << getNy() << "/"
295 << getNz() << ")" << std::endl;
296 clout << " Nodes at Perimeter: " << "\t" << getLatticePerimeter() << std::endl;
297 clout << " Nodes in Volume: " << "\t" << getLatticeVolume() << std::endl;
298 clout << " Nodes in Indicator: " << "\t" << getWeight() << std::endl;
299 clout << " Other Corner: " << "\t"<< "(" << _globPosX + T(_nX-0.5)*_delta << "/"
300 << _globPosY + T(_nY-0.5)*_delta << "/"
301 << _globPosZ + T(_nZ-0.5)*_delta << ")" << std::endl;
302 clout << "--------------------------------" << std::endl;
303
304}
T getPhysVolume() const
Returns the volume of the cuboid.
Definition cuboid3D.hh:171
T getDeltaR() const
Read only access to the distance of cuboid nodes.
Definition cuboid3D.hh:141
int getLatticePerimeter() const
Returns the number of Nodes at the perimeter.
Definition cuboid3D.hh:233
T getPhysPerimeter() const
Returns the perimeter of the cuboid.
Definition cuboid3D.hh:227
+ Here is the caller graph for this function:

◆ refine()

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

Refines by splitting each cell into factor^3 cells.

Definition at line 239 of file cuboid3D.hh.

239 {
240 if (factor < 1) {
241 throw std::invalid_argument("refinement factor must be >= 1");
242 } else if (factor > 1) {
243 _delta /= factor;
244 _nX *= factor;
245 _nY *= factor;
246 _nZ *= factor;
247 _weight *= factor*factor*factor;
248 }
249}

◆ resize()

template<typename T >
void olb::Cuboid3D< T >::resize ( int X,
int Y,
int Z,
int nX,
int nY,
int nZ )

resize the cuboid to the passed size

Definition at line 518 of file cuboid3D.hh.

519{
520 _globPosX = _globPosX+iX*_delta;
521 _globPosY = _globPosY+iY*_delta;
522 _globPosZ = _globPosZ+iZ*_delta;
523
524 _nX = nX;
525 _nY = nY;
526 _nZ = nZ;
527}

◆ setWeight()

template<typename T >
void olb::Cuboid3D< T >::setWeight ( size_t fullCells)

Sets the number of full cells.

Definition at line 215 of file cuboid3D.hh.

216{
217 _weight = fullCells;
218}

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