37template <
typename T,
unsigned D>
50 static_assert(D == 2 || D == 3,
"Only 2D/3D supported");
63 _weight(rhs._weight) { }
65 _origin(indicatorF.getMin()),
66 _extent((indicatorF.getMax() - indicatorF.getMin()) / delta + 1.5),
80 int getNx()
const {
return _extent[0]; }
81 int getNy()
const {
return _extent[1]; }
82 int getNz()
const {
return _extent[2]; }
88 void setWeight(std::size_t weight) { _weight = weight; }
91 return _origin + latticeR*_delta;
95 return util::floor((physR - _origin) / _delta + 0.5);
125 void divide(
Vector<
int,D> division, std::vector<
Cuboid<T,D>>& childrenC) const requires (D == 3);
130 void divideP(
int p, std::vector<
Cuboid<T,D>>& childrenC) const requires (D == 2);
132 void divideP(
int p, std::vector<
Cuboid<T,D>>& childrenC) const requires (D == 3);
141 void write(std::ostream& cout) const;
Cuboid(Vector< T, D > origin, T delta, Vector< int, D > extent)
T getPhysPerimeter() const
Returns the perimeter of the cuboid.
Vector< T, D > getOrigin() const
Returns lower left corner coordinates.
Cuboid(IndicatorF< T, D > &indicatorF, T delta)
LatticeR< D > getFloorLatticeR(Vector< T, D > physR) const
Cuboid(const Cuboid &rhs)
bool intersects(Vector< T, D > globMin, Vector< T, D > globMax, int overlap=0) const
Checks whether there is an intersection with the cuboid extended by a layer of size overlap*delta.
std::size_t getLatticeVolume() const
Returns the number of Nodes in the volume.
Vector< int, D > getExtent() const
Returns extent in number of voxels.
Cuboid & operator=(const Cuboid &rhs)
std::optional< LatticeR< D > > getCloseLatticeR(Vector< T, D > physR, T eps=1e-5) const
Returns closest latticeR within eps of physR if it exists.
bool operator==(const Cuboid &rhs) const
T getDeltaR() const
Returns spacing of cuboid nodes.
std::size_t getWeight() const
LatticeR< D > getLatticeR(Vector< T, D > physR) const
bool isInside(Vector< T, D > pos, int overlap=0) const
Checks whether pos is contained in the cuboid extended with an layer of size overlap*delta.
void resize(Vector< int, D > offset, Vector< int, D > extent)
T getPhysVolume() const
Returns the volume of the cuboid.
void setWeight(std::size_t weight)
std::size_t getLatticePerimeter() const
Returns the number of Nodes at the perimeter.
void divideP(int p, std::vector< Cuboid< T, D > > &childrenC) const
Divides the cuboid in p cuboids and add them to the given vector.
Vector< T, D > getPhysR(LatticeR< D > latticeR) const
void divideFractional(int iD, std::vector< T > fractions, std::vector< Cuboid< T, D > > &childrenC) const
Divides the cuboid into fractions along the iDth dimension.
void writeAsXML(std::ostream &) const
void write(std::ostream &cout) const
void divide(Vector< int, D > division, std::vector< Cuboid< T, D > > &childrenC) const
Divides the cuboid in p*q*r cuboids of equal volume and add them to the given vector.
ADf< T, DIM > floor(const ADf< T, DIM > &a)
Top level namespace for all of OpenLB.
std::conditional_t< D==2, IndicatorF2D< T >, IndicatorF3D< T > > IndicatorF
efficient implementation of a vector class