OpenLB 1.7
Loading...
Searching...
No Matches
cuboidGeometry2D.hh
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2007, 2014 Mathias J. Krause
4 * E-mail contact: info@openlb.net
5 * The most recent release of OpenLB can be downloaded at
6 * <http://www.openlb.net/>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program; if not, write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22*/
23
29#ifndef CUBOID_GEOMETRY_2D_HH
30#define CUBOID_GEOMETRY_2D_HH
31
32
33#include <iostream>
34#include <math.h>
37
38namespace olb {
39
40
42
43template<typename T>
45 : _motherCuboid(0,0,0,0,0), _periodicityOn(3, bool(false)), clout(std::cout, "CuboidGeometry3D")
46{
47 add(_motherCuboid);
48 split(0, 1);
49}
50
51template<typename T>
52CuboidGeometry2D<T>::CuboidGeometry2D(T originX, T originY, T deltaR, int nX, int nY, int nC)
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}
59
60template<typename T>
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}
72
73
74template<typename T>
75void CuboidGeometry2D<T>::reInit(T globPosX, T globPosY, T delta, int nX, int nY, int nC)
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}
87
88template<typename T>
90{
91 return _cuboids[i];
92}
93
94template<typename T>
96{
97 return _cuboids[i];
98}
99
100template<typename T>
101void CuboidGeometry2D<T>::setPeriodicity(bool periodicityX, bool periodicityY)
102{
103 _periodicityOn.resize(2);
104 _periodicityOn[0] = periodicityX;
105 _periodicityOn[1] = periodicityY;
106}
107
108
109template<typename T>
110bool CuboidGeometry2D<T>::getC(std::vector<T> physR, int& iC) const
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}
121
122template<typename T>
123bool CuboidGeometry2D<T>::getC(const Vector<T,2>& physR, int& iC) const
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}
134
135template<typename T>
136bool CuboidGeometry2D<T>::getLatticeR(std::vector<T> physR, std::vector<int>& latticeR) const
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}
149
150template<typename T>
151bool CuboidGeometry2D<T>::getLatticeR(int latticeR[], const T physR[]) const
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}
164
165template<typename T>
167 const Vector<T,2>& physR, Vector<int,3>& latticeR) const
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}
180
181template<typename T>
182bool CuboidGeometry2D<T>::getFloorLatticeR(std::vector<T> physR, std::vector<int>& latticeR) const
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}
195
196template<typename T>
198 const Vector<T,2>& physR, Vector<int,3>& latticeR) const
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}
211
212template<typename T>
213std::vector<T> CuboidGeometry2D<T>::getPhysR(int iCglob, int iX, int iY) const
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}
237
238template<typename T>
239std::vector<T> CuboidGeometry2D<T>::getPhysR(std::vector<int> latticeR) const
240{
241 return getPhysR(latticeR[0], latticeR[1], latticeR[2]);
242}
243
244template<typename T>
245void CuboidGeometry2D<T>::getPhysR(T output[2], const int latticeR[3]) const
246{
247 getPhysR(output, latticeR[0], latticeR[1], latticeR[2]);
248}
249
250template<typename T>
251void CuboidGeometry2D<T>::getPhysR(T output[2], LatticeR<3> latticeR) const
252{
253 getPhysR(output, latticeR[0], latticeR[1], latticeR[2]);
254}
255
256template<typename T>
257void CuboidGeometry2D<T>::getPhysR(T output[2], const int iCglob, LatticeR<2> latticeR) const
258{
259 getPhysR(output, iCglob, latticeR[0], latticeR[1]);
260}
261
262
263template<typename T>
264void CuboidGeometry2D<T>::getPhysR(T output[2], const int iCglob, const int iX, const int iY) const
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}
286
287template<typename T>
289{
290 return _cuboids.size();
291}
292
293template<typename T>
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}
304
305template<typename T>
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}
316
317template<typename T>
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}
331
332template<typename T>
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}
348
349template<typename T>
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}
360
361template<typename T>
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}
372
373template<typename T>
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}
384
385template<typename T>
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}
396
397template<typename T>
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}
408
409template<typename T>
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}
420
421template<typename T>
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}
466
467template<typename T>
468int CuboidGeometry2D<T>::get_iC(T globX, T globY, int offset) const
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}
478
479template<typename T>
480int CuboidGeometry2D<T>::get_iC(T globX, T globY, int orientationX, int orientationY) const
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}
492
493
494template<typename T>
496{
497
498 _cuboids.push_back(cuboid);
499}
500
501template<typename T>
503{
504
505 _cuboids.erase(_cuboids.begin() + iC);
506}
507/*
508template<typename T>
509void CuboidGeometry2D<T>::remove(olb::ScalarField2D<int>* geometryData)
510{
511
512 std::vector<Cuboid2D<T> > cuboids;
513 unsigned size = _cuboids.size();
514
515 std::vector<bool> allZero;
516 for (unsigned i = 0; i < size; i++) {
517 allZero.push_back(1);
518 for (int iX = 0; iX < _cuboids[i].getNx(); iX++) {
519 for (int iY = 0; iY < _cuboids[i].getNy(); iY++) {
520 if (geometryData->get(_cuboids[i].get_globPosX() + iX,
521 _cuboids[i].get_globPosY() + iY) != 0 ) {
522 allZero[i] = 0;
523 }
524 }
525 }
526 }
527 for (unsigned i = 0; i < size; i++) {
528 if (!allZero[i] ) {
529 cuboids.push_back(_cuboids[i]);
530 }
531 }
532 _cuboids.clear();
533 for (unsigned i = 0; i < cuboids.size(); i++) {
534 _cuboids.push_back(cuboids[i]);
535 }
536}*/
537
538template<typename T>
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}
585
586template<typename T>
587void CuboidGeometry2D<T>::split(int iC, int p)
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}
595
596template<typename T>
597void CuboidGeometry2D<T>::getNeighbourhood(int cuboid, std::vector<int>& neighbours, int offset)
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}
612
613template<typename T>
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}
626
627template<typename T>
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}
638
639} // namespace olb
640
641#endif
A regular single 2D cuboid is the basic component of a 2D cuboid structure which defines the grid.
Definition cuboid2D.h:54
void divide(int p, int q, std::vector< Cuboid2D< T > > &childrenC) const
Divides the cuboid in p*q cuboids and adds them to the given vector.
Definition cuboid2D.hh:298
void resize(int X, int Y, int nX, int nY)
resize the cuboid to the passed size
Definition cuboid2D.hh:377
void init(T globPosX, T globPosY, T delta, int nX, int nY)
Initializes the cuboid.
Definition cuboid2D.hh:77
void reInit(T globPosX, T globPosY, T delta, int nX, int nY, int nC=1)
Re init.
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 posi...
void remove(int iC)
Removes the cuboid iC.
void print() const
Prints cuboid geometry details.
int getNc() const
Returns the number of cuboids in t < 2he structure.
size_t getMinLatticeVolume() const
Returns the maximum/minimum number of nodes in the structure.
void printExtended()
Prints cuboid geometry details plus details of all cuboids.
CuboidGeometry2D()
Constructs empty Geometry.
void shrink(IndicatorF2D< T > &indicatorF)
Shrink all cuboids so that no empty planes are left.
Cuboid2D< T > getMotherCuboid() const
Returns the smallest cuboid that includes all cuboids of the structure.
void setPeriodicity(bool periodicityX, bool periodicityY)
Set flag to enable/disable periodicity.
size_t getMaxLatticeVolume() const
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 ...
Cuboid2D< T > & get(int i)
Read and write access to the cuboids.
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.
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...
std::vector< T > getMinPhysR() const
Returns the minimum coordinate in the structure.
void getNeighbourhood(int cuboid, std::vector< int > &neighbours, int offset=0)
stores the neighbouring cuboids in array neighbours;
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...
T getMinPhysVolume() const
Returns the maximum/minimum volume in the structure.
void add(Cuboid2D< T > cuboid)
Adds a cuboid.
std::vector< T > getMaxPhysR() const
Returns the maximum coordinate in the structure.
void split(int iC, int p)
Removes all cuboids where geometryData = 0.
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...
IndicatorF2D is an application from .
Plain old scalar vector.
Definition vector.h:47
The description of a vector of 2D cuboid – header file.
This file contains indicator functions.
ADf< T, DIM > floor(const ADf< T, DIM > &a)
Definition aDiff.h:869
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
Top level namespace for all of OpenLB.