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

#include <blockGeometryStatistics2D.h>

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

Public Member Functions

 BlockGeometryStatistics2D (BlockGeometry< T, 2 > *blockGeometry)
 
bool & getStatisticsStatus ()
 Read and write access to a flag, which indicates if an uptate is needed (=true)
 
bool const & getStatisticsStatus () const
 Read only access to a flag, which indicates if an uptate is needed (=true)
 
std::map< int, int > getMaterial2n ()
 Returns the map with the numbers of voxels for each material.
 
std::map< int, int > getMaterial2n () const
 
void update (bool verbose=true)
 Updates the statistics if it is really needed.
 
int getNmaterials ()
 Returns the number of different materials.
 
int getNmaterials () const
 
int getNvoxel (int material)
 Returns the number of voxels for a given material number.
 
int getNvoxel (int material) const
 
int getNvoxel ()
 Returns the number of voxels with material!=0.
 
int getNvoxel () const
 
std::vector< int > getMinLatticeR (int material)
 Returns the min. lattice position in each direction.
 
std::vector< int > getMinLatticeR (int material) const
 
std::vector< int > getMaxLatticeR (int material)
 Returns the max. lattice position in each direction.
 
std::vector< int > getMaxLatticeR (int material) const
 
std::vector< T > getMinPhysR (int material) const
 Returns the min. phys position in each direction.
 
std::vector< T > getMaxPhysR (int material) const
 Returns the max. phys position in each direction.
 
std::vector< T > getLatticeExtend (int material)
 Returns the lattice extend as length in each direction.
 
std::vector< T > getLatticeExtend (int material) const
 
std::vector< T > getPhysExtend (int material)
 Returns the phys extend as length in each direction.
 
std::vector< T > getPhysExtend (int material) const
 
std::vector< T > getPhysRadius (int material)
 Returns the phys radius as length in each direction.
 
std::vector< T > getPhysRadius (int material) const
 
std::vector< T > getCenterPhysR (int material)
 Returns the center position.
 
std::vector< T > getCenterPhysR (int material) const
 
std::vector< int > getType (const int *input) const
 Returns the boundary type which is characterized by a discrete normal (c.f. Zimny)
 
std::vector< int > getType (int iX, int iY) const
 
std::vector< int > computeNormal (int iX, int iY)
 Returns normal that points into the fluid for paraxial surfaces.
 
std::vector< int > computeNormal (int iX, int iY) const
 
std::vector< T > computeNormal (int material)
 Returns normal that points into the fluid for paraxial surfaces.
 
std::vector< T > computeNormal (int material) const
 
std::vector< int > computeDiscreteNormal (int material, T maxNorm=1.1)
 Returns discrete normal with norm maxNorm that points into the fluid for paraxial surfaces maxNorm=1.1 implies only normals parallel to the axises.
 
std::vector< int > computeDiscreteNormal (int material, T maxNorm=1.1) const
 
bool check (int material, int iX, int iY, unsigned offsetX, unsigned offsetY)
 
bool check (int material, int iX, int iY, unsigned offsetX, unsigned offsetY) const
 
bool find (int material, unsigned offsetX, unsigned offsetY, int &iX, int &iY)
 
bool find (int material, unsigned offsetX, unsigned offsetY, int &iX, int &iY) const
 
void print ()
 Prints some statistic information, i.e. the number of voxels and min. max. physical position for each different material.
 
void print () const
 

Detailed Description

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

Definition at line 53 of file blockGeometryStatistics2D.h.

Constructor & Destructor Documentation

◆ BlockGeometryStatistics2D()

template<typename T >
olb::BlockGeometryStatistics2D< T >::BlockGeometryStatistics2D ( BlockGeometry< T, 2 > * blockGeometry)

Definition at line 43 of file blockGeometryStatistics2D.hh.

44 : _blockGeometry(blockGeometry),
45 clout(std::cout,"BlockGeometryStatistics2D")
46{
47 _statisticsUpdateNeeded = true;
48}

Member Function Documentation

◆ check() [1/2]

template<typename T >
bool olb::BlockGeometryStatistics2D< T >::check ( int material,
int iX,
int iY,
unsigned offsetX,
unsigned offsetY )

Definition at line 509 of file blockGeometryStatistics2D.hh.

511{
512 return const_this->check(material, iX, iY, offsetX, offsetY);
513}

◆ check() [2/2]

template<typename T >
bool olb::BlockGeometryStatistics2D< T >::check ( int material,
int iX,
int iY,
unsigned offsetX,
unsigned offsetY ) const

Definition at line 516 of file blockGeometryStatistics2D.hh.

518{
519 bool found = true;
520 for (int iOffsetX = -offsetX; iOffsetX <= (int) offsetX; ++iOffsetX) {
521 for (int iOffsetY = -offsetY; iOffsetY <= (int) offsetY; ++iOffsetY) {
522 if (_blockGeometry->getMaterial({iX + iOffsetX, iY + iOffsetY}) != material) {
523 found = false;
524 }
525 }
526 }
527 return found;
528}
int getMaterial(LatticeR< D > latticeR) const
returns the (iX,iY) entry in the 2D scalar field

◆ computeDiscreteNormal() [1/2]

template<typename T >
std::vector< int > olb::BlockGeometryStatistics2D< T >::computeDiscreteNormal ( int material,
T maxNorm = 1.1 )

Returns discrete normal with norm maxNorm that points into the fluid for paraxial surfaces maxNorm=1.1 implies only normals parallel to the axises.

Definition at line 480 of file blockGeometryStatistics2D.hh.

481{
482 return const_this->computeDiscreteNormal(material, maxNorm);
483}

◆ computeDiscreteNormal() [2/2]

template<typename T >
std::vector< int > olb::BlockGeometryStatistics2D< T >::computeDiscreteNormal ( int material,
T maxNorm = 1.1 ) const

Definition at line 486 of file blockGeometryStatistics2D.hh.

487{
488 std::vector<T> normal = computeNormal(material);
489 std::vector<int> discreteNormal(2,int(0));
490
491 T smallestAngle = T(0);
492 for (int iX = -1; iX<=1; iX++) {
493 for (int iY = -1; iY<=1; iY++) {
494 T norm = util::sqrt(iX*iX+iY*iY);
495 if (norm>0.&& norm<maxNorm) {
496 T angle = (iX*normal[0] + iY*normal[1])/norm;
497 if (angle>=smallestAngle) {
498 smallestAngle=angle;
499 discreteNormal[0] = iX;
500 discreteNormal[1] = iY;
501 }
502 }
503 }
504 }
505 return discreteNormal;
506}
std::vector< int > computeNormal(int iX, int iY)
Returns normal that points into the fluid for paraxial surfaces.
cpu::simd::Pack< T > sqrt(cpu::simd::Pack< T > value)
Definition pack.h:100
constexpr T norm(const ScalarVector< T, D, IMPL > &a)
Euclidean vector norm.

References olb::norm(), and olb::util::sqrt().

+ Here is the call graph for this function:

◆ computeNormal() [1/4]

template<typename T >
std::vector< int > olb::BlockGeometryStatistics2D< T >::computeNormal ( int iX,
int iY )

Returns normal that points into the fluid for paraxial surfaces.

Definition at line 418 of file blockGeometryStatistics2D.hh.

419{
420 return const_this->computeNormal(iX, iY);
421}

◆ computeNormal() [2/4]

template<typename T >
std::vector< int > olb::BlockGeometryStatistics2D< T >::computeNormal ( int iX,
int iY ) const

Definition at line 424 of file blockGeometryStatistics2D.hh.

425{
426 std::vector<int> normal (2,int(0));
427
428 if (iX != 0) {
429 if (_blockGeometry->getMaterial({iX - 1, iY}) == 1) {
430 normal[0] = -1;
431 }
432 }
433 if (iX != _nX - 1) {
434 if (_blockGeometry->getMaterial({iX + 1, iY}) == 1) {
435 normal[0] = 1;
436 }
437 }
438 if (iY != 0) {
439 if (_blockGeometry->getMaterial({iX, iY - 1}) == 1) {
440 normal[1] = -1;
441 }
442 }
443 if (iY != _nY - 1) {
444 if (_blockGeometry->getMaterial({iX, iY + 1}) == 1) {
445 normal[1] = 1;
446 }
447 }
448 return normal;
449}

◆ computeNormal() [3/4]

template<typename T >
std::vector< T > olb::BlockGeometryStatistics2D< T >::computeNormal ( int material)

Returns normal that points into the fluid for paraxial surfaces.

Definition at line 452 of file blockGeometryStatistics2D.hh.

453{
454 return const_this->computeNormal(material);
455}

◆ computeNormal() [4/4]

template<typename T >
std::vector< T > olb::BlockGeometryStatistics2D< T >::computeNormal ( int material) const

Definition at line 458 of file blockGeometryStatistics2D.hh.

459{
460 std::vector<T> normal (2,int(0));
461 std::vector<int> minC = getMinLatticeR(material);
462 std::vector<int> maxC = getMaxLatticeR(material);
463 for (int iX = minC[0]; iX<=maxC[0]; iX++) {
464 for (int iY = minC[1]; iY<=maxC[1]; iY++) {
465 if (_blockGeometry->getMaterial({iX,iY}) == material) {
466 normal[0]+=computeNormal(iX,iY)[0];
467 normal[1]+=computeNormal(iX,iY)[1];
468 }
469 }
470 }
471 T norm = util::sqrt(normal[0]*normal[0]+normal[1]*normal[1]);
472 if (norm>0.) {
473 normal[0]/=norm;
474 normal[1]/=norm;
475 }
476 return normal;
477}
std::vector< int > getMaxLatticeR(int material)
Returns the max. lattice position in each direction.
std::vector< int > getMinLatticeR(int material)
Returns the min. lattice position in each direction.

References olb::norm(), and olb::util::sqrt().

+ Here is the call graph for this function:

◆ find() [1/2]

template<typename T >
bool olb::BlockGeometryStatistics2D< T >::find ( int material,
unsigned offsetX,
unsigned offsetY,
int & iX,
int & iY )

Definition at line 531 of file blockGeometryStatistics2D.hh.

533{
534 return const_this->find(material, offsetX, offsetY, foundX, foundY);
535}

References olb::BlockGeometryStatistics2D< T >::find().

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

◆ find() [2/2]

template<typename T >
bool olb::BlockGeometryStatistics2D< T >::find ( int material,
unsigned offsetX,
unsigned offsetY,
int & iX,
int & iY ) const

Definition at line 538 of file blockGeometryStatistics2D.hh.

540{
541 bool found = false;
542 for (foundX = 0; foundX < _nX; foundX++) {
543 for (foundY = 0; foundY < _nY; foundY++) {
544 found = check(material, foundX, foundY, offsetX, offsetY);
545 if (found) {
546 return found;
547 }
548 }
549 }
550 return found;
551}
bool check(int material, int iX, int iY, unsigned offsetX, unsigned offsetY)

◆ getCenterPhysR() [1/2]

template<typename T >
std::vector< T > olb::BlockGeometryStatistics2D< T >::getCenterPhysR ( int material)

Returns the center position.

Definition at line 262 of file blockGeometryStatistics2D.hh.

263{
264 update();
265 return const_this->getCenterPhysR(material);
266}
void update(bool verbose=true)
Updates the statistics if it is really needed.

◆ getCenterPhysR() [2/2]

template<typename T >
std::vector< T > olb::BlockGeometryStatistics2D< T >::getCenterPhysR ( int material) const

Definition at line 269 of file blockGeometryStatistics2D.hh.

270{
271 std::vector<T> center;
272 for (int iDim=0; iDim<2; iDim++) {
273 center.push_back(getMinPhysR(material)[iDim] + getPhysRadius(material)[iDim]);
274 }
275 return center;
276}
std::vector< T > getPhysRadius(int material)
Returns the phys radius as length in each direction.
std::vector< T > getMinPhysR(int material) const
Returns the min. phys position in each direction.

◆ getLatticeExtend() [1/2]

template<typename T >
std::vector< T > olb::BlockGeometryStatistics2D< T >::getLatticeExtend ( int material)

Returns the lattice extend as length in each direction.

Definition at line 205 of file blockGeometryStatistics2D.hh.

206{
207 update();
208 return const_this->getLatticeExtend(material);
209}

◆ getLatticeExtend() [2/2]

template<typename T >
std::vector< T > olb::BlockGeometryStatistics2D< T >::getLatticeExtend ( int material) const

Definition at line 212 of file blockGeometryStatistics2D.hh.

213{
214 try {
215 std::vector<T> extend;
216 for (int iDim = 0; iDim < 2; iDim++) {
217 extend.push_back(_material2max.at(material)[iDim] - _material2min.at(material)[iDim]);
218 }
219 return extend;
220 }
221 catch (std::out_of_range& ex) {
222 std::vector<T> null;
223 return null;
224 }
225}

◆ getMaterial2n() [1/2]

template<typename T >
std::map< int, int > olb::BlockGeometryStatistics2D< T >::getMaterial2n ( )

Returns the map with the numbers of voxels for each material.

Definition at line 121 of file blockGeometryStatistics2D.hh.

122{
123 update();
124 return const_this->getMaterial2n();
125}

◆ getMaterial2n() [2/2]

template<typename T >
std::map< int, int > olb::BlockGeometryStatistics2D< T >::getMaterial2n ( ) const

Definition at line 128 of file blockGeometryStatistics2D.hh.

129{
130 return _material2n;
131}

◆ getMaxLatticeR() [1/2]

template<typename T >
std::vector< int > olb::BlockGeometryStatistics2D< T >::getMaxLatticeR ( int material)

Returns the max. lattice position in each direction.

Definition at line 170 of file blockGeometryStatistics2D.hh.

171{
172 update();
173 return const_this->getMaxLatticeR(material);
174}

◆ getMaxLatticeR() [2/2]

template<typename T >
std::vector< int > olb::BlockGeometryStatistics2D< T >::getMaxLatticeR ( int material) const

Definition at line 177 of file blockGeometryStatistics2D.hh.

178{
179 try {
180 return _material2max.at(material);
181 }
182 catch (std::out_of_range& ex) {
183 std::vector<int> null;
184 return null;
185 }
186}

◆ getMaxPhysR()

template<typename T >
std::vector< T > olb::BlockGeometryStatistics2D< T >::getMaxPhysR ( int material) const

Returns the max. phys position in each direction.

Definition at line 197 of file blockGeometryStatistics2D.hh.

198{
199 std::vector<T> tmp(2,T());
200 _blockGeometry->getPhysR(&(tmp[0]), &(getMaxLatticeR(material)[0]));
201 return tmp;
202}
Vector< T, D > getPhysR(LatticeR< D > latticeR)

◆ getMinLatticeR() [1/2]

template<typename T >
std::vector< int > olb::BlockGeometryStatistics2D< T >::getMinLatticeR ( int material)

Returns the min. lattice position in each direction.

Definition at line 151 of file blockGeometryStatistics2D.hh.

152{
153 update();
154 return const_this->getMinLatticeR(material);
155}

◆ getMinLatticeR() [2/2]

template<typename T >
std::vector< int > olb::BlockGeometryStatistics2D< T >::getMinLatticeR ( int material) const

Definition at line 158 of file blockGeometryStatistics2D.hh.

159{
160 try {
161 return _material2min.at(material);
162 }
163 catch (std::out_of_range& ex) {
164 std::vector<int> null;
165 return null;
166 }
167}

◆ getMinPhysR()

template<typename T >
std::vector< T > olb::BlockGeometryStatistics2D< T >::getMinPhysR ( int material) const

Returns the min. phys position in each direction.

Definition at line 189 of file blockGeometryStatistics2D.hh.

190{
191 std::vector<T> tmp(2,T());
192 _blockGeometry->getPhysR(&(tmp[0]), &(getMinLatticeR(material)[0]));
193 return tmp;
194}

◆ getNmaterials() [1/2]

template<typename T >
int olb::BlockGeometryStatistics2D< T >::getNmaterials ( )

Returns the number of different materials.

Definition at line 90 of file blockGeometryStatistics2D.hh.

91{
92 update();
93 return const_this->getNmaterials();
94}

◆ getNmaterials() [2/2]

template<typename T >
int olb::BlockGeometryStatistics2D< T >::getNmaterials ( ) const

Definition at line 97 of file blockGeometryStatistics2D.hh.

98{
99 return _nMaterials;
100}

◆ getNvoxel() [1/4]

template<typename T >
int olb::BlockGeometryStatistics2D< T >::getNvoxel ( )

Returns the number of voxels with material!=0.

Definition at line 134 of file blockGeometryStatistics2D.hh.

135{
136 update();
137 return const_this->getNvoxel();
138}

◆ getNvoxel() [2/4]

template<typename T >
int olb::BlockGeometryStatistics2D< T >::getNvoxel ( ) const

Definition at line 141 of file blockGeometryStatistics2D.hh.

142{
143 int total = 0;
144 for (const auto& material : _material2n ) {
145 total += material.second;
146 }
147 return total;
148}

◆ getNvoxel() [3/4]

template<typename T >
int olb::BlockGeometryStatistics2D< T >::getNvoxel ( int material)

Returns the number of voxels for a given material number.

Definition at line 103 of file blockGeometryStatistics2D.hh.

104{
105 update();
106 return const_this->getNvoxel(material);
107}

◆ getNvoxel() [4/4]

template<typename T >
int olb::BlockGeometryStatistics2D< T >::getNvoxel ( int material) const

Definition at line 110 of file blockGeometryStatistics2D.hh.

111{
112 try {
113 return _material2n.at(material);
114 }
115 catch (std::out_of_range& ex) {
116 return 0;
117 }
118}

◆ getPhysExtend() [1/2]

template<typename T >
std::vector< T > olb::BlockGeometryStatistics2D< T >::getPhysExtend ( int material)

Returns the phys extend as length in each direction.

Definition at line 228 of file blockGeometryStatistics2D.hh.

229{
230 update();
231 return const_this->getPhysExtend(material);
232}

◆ getPhysExtend() [2/2]

template<typename T >
std::vector< T > olb::BlockGeometryStatistics2D< T >::getPhysExtend ( int material) const

Definition at line 235 of file blockGeometryStatistics2D.hh.

236{
237 std::vector<T> extend;
238 for (int iDim = 0; iDim < 2; iDim++) {
239 extend.push_back(getMaxPhysR(material)[iDim] - getMinPhysR(material)[iDim]);
240 }
241 return extend;
242}
std::vector< T > getMaxPhysR(int material) const
Returns the max. phys position in each direction.

◆ getPhysRadius() [1/2]

template<typename T >
std::vector< T > olb::BlockGeometryStatistics2D< T >::getPhysRadius ( int material)

Returns the phys radius as length in each direction.

Definition at line 245 of file blockGeometryStatistics2D.hh.

246{
247 update();
248 return const_this->getPhysRadius(material);
249}

◆ getPhysRadius() [2/2]

template<typename T >
std::vector< T > olb::BlockGeometryStatistics2D< T >::getPhysRadius ( int material) const

Definition at line 252 of file blockGeometryStatistics2D.hh.

253{
254 std::vector<T> radius;
255 for (int iDim=0; iDim<2; iDim++) {
256 radius.push_back((getMaxPhysR(material)[iDim] - getMinPhysR(material)[iDim])/2.);
257 }
258 return radius;
259}

◆ getStatisticsStatus() [1/2]

template<typename T >
bool & olb::BlockGeometryStatistics2D< T >::getStatisticsStatus ( )

Read and write access to a flag, which indicates if an uptate is needed (=true)

Definition at line 52 of file blockGeometryStatistics2D.hh.

53{
54 return _statisticsUpdateNeeded;
55}

◆ getStatisticsStatus() [2/2]

template<typename T >
bool const & olb::BlockGeometryStatistics2D< T >::getStatisticsStatus ( ) const

Read only access to a flag, which indicates if an uptate is needed (=true)

Definition at line 58 of file blockGeometryStatistics2D.hh.

59{
60 return _statisticsUpdateNeeded;
61}

◆ getType() [1/2]

template<typename T >
std::vector< int > olb::BlockGeometryStatistics2D< T >::getType ( const int * input) const

Returns the boundary type which is characterized by a discrete normal (c.f. Zimny)

Definition at line 279 of file blockGeometryStatistics2D.hh.

280{
281 return const_this->getType(input[0], input[1]);
282}

◆ getType() [2/2]

template<typename T >
std::vector< int > olb::BlockGeometryStatistics2D< T >::getType ( int iX,
int iY ) const

boundary0N and boundary 0P

boundary1N and boundary1P

externalCornerNN and externalCornerNP

externalCornerPN and externalCornerPP

internalCornerNN and internalCornerNP

internalCornerPN and internalCornerPP

Definition at line 285 of file blockGeometryStatistics2D.hh.

286{
287 std::vector<int> discreteNormal(3, 0);
288
289 if (_blockGeometry->getMaterial({iX, iY}) != 1
290 && _blockGeometry->getMaterial({iX, iY}) != 0) {
291
293 if (_blockGeometry->getMaterial({iX, iY + 1}) != 1
294 && _blockGeometry->getMaterial({iX, iY + 1}) != 0
295 && _blockGeometry->getMaterial({iX, iY - 1}) != 1
296 && _blockGeometry->getMaterial({iX, iY - 1}) != 0) {
297
298 if (_blockGeometry->getMaterial({iX + 1, iY}) == 1) {
299 discreteNormal[0] = 0;
300 discreteNormal[1] = -1;
301 discreteNormal[2] = 0;
302 }
303
304 if (_blockGeometry->getMaterial({iX - 1, iY}) == 1) {
305 discreteNormal[0] = 0;
306 discreteNormal[1] = 1;
307 discreteNormal[2] = 0;
308 }
309 }
310
312 if (_blockGeometry->getMaterial({iX + 1, iY}) != 1
313 && _blockGeometry->getMaterial({iX + 1, iY}) != 0
314 && _blockGeometry->getMaterial({iX - 1, iY}) != 1
315 && _blockGeometry->getMaterial({iX - 1, iY}) != 0) {
316
317 if (_blockGeometry->getMaterial({iX, iY + 1}) == 1) {
318 discreteNormal[0] = 0;
319 discreteNormal[1] = 0;
320 discreteNormal[2] = -1;
321 }
322
323 if (_blockGeometry->getMaterial({iX, iY - 1}) == 1) {
324 discreteNormal[0] = 0;
325 discreteNormal[1] = 0;
326 discreteNormal[2] = 1;
327 }
328 }
329
331 if ( _blockGeometry->getMaterial({iX + 1, iY}) != 1
332 && _blockGeometry->getMaterial({iX + 1, iY}) != 0) {
333
334 if (_blockGeometry->getMaterial({iX, iY + 1}) != 1
335 && _blockGeometry->getMaterial({iX, iY + 1}) != 0
336 && _blockGeometry->getMaterial({iX + 1, iY + 1}) == 1) {
337 discreteNormal[0] = 1;
338 discreteNormal[1] = -1;
339 discreteNormal[2] = -1;
340 }
341
342 if (_blockGeometry->getMaterial({iX, iY - 1}) != 1
343 && _blockGeometry->getMaterial({iX, iY - 1}) != 0
344 && _blockGeometry->getMaterial({iX + 1, iY - 1}) == 1) {
345 discreteNormal[0] = 1;
346 discreteNormal[1] = -1;
347 discreteNormal[2] = 1;
348 }
349 }
350
352 if (_blockGeometry->getMaterial({iX - 1, iY}) != 1
353 && _blockGeometry->getMaterial({iX - 1, iY}) != 0) {
354
355 if (_blockGeometry->getMaterial({iX, iY + 1}) != 1
356 && _blockGeometry->getMaterial({iX, iY + 1}) != 0
357 && _blockGeometry->getMaterial({iX - 1, iY + 1}) == 1) {
358 discreteNormal[0] = 1;
359 discreteNormal[1] = 1;
360 discreteNormal[2] = -1;
361 }
362
363 if (_blockGeometry->getMaterial({iX, iY - 1}) != 1
364 && _blockGeometry->getMaterial({iX, iY - 1}) != 0
365 && _blockGeometry->getMaterial({iX - 1, iY - 1}) == 1) {
366 discreteNormal[0] = 1;
367 discreteNormal[1] = 1;
368 discreteNormal[2] = 1;
369 }
370 }
371
373 if (_blockGeometry->getMaterial({iX - 1, iY}) != 1
374 && _blockGeometry->getMaterial({iX - 1, iY}) != 0) {
375
376 if (_blockGeometry->getMaterial({iX, iY - 1}) != 1
377 && _blockGeometry->getMaterial({iX, iY - 1}) != 0
378 && _blockGeometry->getMaterial({iX - 1, iY - 1}) == 0) {
379 discreteNormal[0] = 2;
380 discreteNormal[1] = -1;
381 discreteNormal[2] = -1;
382 }
383
384 if (_blockGeometry->getMaterial({iX, iY + 1}) != 1
385 && _blockGeometry->getMaterial({iX, iY + 1}) != 0
386 && _blockGeometry->getMaterial({iX - 1, iY + 1}) == 0) {
387 discreteNormal[0] = 2;
388 discreteNormal[1] = -1;
389 discreteNormal[2] = 1;
390 }
391 }
392
394 if (_blockGeometry->getMaterial({iX + 1, iY}) != 1
395 && _blockGeometry->getMaterial({iX + 1, iY}) != 0) {
396
397 if (_blockGeometry->getMaterial({iX, iY - 1}) != 1
398 && _blockGeometry->getMaterial({iX, iY - 1}) != 0
399 && _blockGeometry->getMaterial({iX + 1, iY - 1}) == 0) {
400 discreteNormal[0] = 2;
401 discreteNormal[1] = 1;
402 discreteNormal[2] = -1;
403 }
404
405 if (_blockGeometry->getMaterial({iX, iY + 1}) != 1
406 && _blockGeometry->getMaterial({iX, iY + 1}) != 0
407 && _blockGeometry->getMaterial({iX + 1, iY + 1}) == 0) {
408 discreteNormal[0] = 2;
409 discreteNormal[1] = 1;
410 discreteNormal[2] = 1;
411 }
412 }
413 }
414 return discreteNormal;
415}

◆ print() [1/2]

template<typename T >
void olb::BlockGeometryStatistics2D< T >::print ( )

Prints some statistic information, i.e. the number of voxels and min. max. physical position for each different material.

Definition at line 554 of file blockGeometryStatistics2D.hh.

555{
556 update();
557 return const_this->print();
558}

◆ print() [2/2]

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

Definition at line 561 of file blockGeometryStatistics2D.hh.

562{
563 try {
564 std::map<int, int>::iterator iter;
565 for (const auto& material : _material2n) {
566 clout << "materialNumber=" << material.first
567 << "; count=" << material.second
568 << "; minLatticeR=(" << _material2min.at(material.first)[0] <<","<< _material2min.at(material.first)[1] <<")"
569 << "; maxLatticeR=(" << _material2max.at(material.first)[0] <<","<< _material2max.at(material.first)[1] <<")"
570 << std::endl;
571 }
572 }
573 catch (std::out_of_range& ex)
574 { }
575}

◆ update()

template<typename T >
void olb::BlockGeometryStatistics2D< T >::update ( bool verbose = true)

Updates the statistics if it is really needed.

Definition at line 65 of file blockGeometryStatistics2D.hh.

66{
67 const_this = const_cast<const BlockGeometryStatistics2D<T>*>(this);
68
69 if (getStatisticsStatus() ) {
70 _material2n.clear();
71 _blockGeometry->forCoreSpatialLocations([&](auto iX, auto iY) {
72 takeStatistics(iX, iY);
73 });
74
75 _nMaterials=int();
76 std::map<int, int>::iterator iter;
77 for (iter = _material2n.begin(); iter != _material2n.end(); iter++) {
78 _nMaterials++;
79 }
80
81 if (verbose) {
82 clout << "updated" << std::endl;
83 }
84 getStatisticsStatus() = false;
85 }
86}
bool & getStatisticsStatus()
Read and write access to a flag, which indicates if an uptate is needed (=true)
void forCoreSpatialLocations(F f) const

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