OpenLB 1.7
Loading...
Searching...
No Matches
latticeAverage2D.hh
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2019 Albert Mink, Mathias J. Krause, Lukas Baron
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
24#ifndef LATTICE_AVERAGE_2D_HH
25#define LATTICE_AVERAGE_2D_HH
26
27#include <vector>
28#include "utilities/omath.h"
29#include <limits>
30
31#include "latticeAverage2D.h"
32#include "dynamics/lbm.h" // for computation of lattice rho and velocity
35#include "blockBaseF2D.h"
36#include "functors/genericF.h"
40
41
42namespace olb {
43
44template <typename T, typename DESCRIPTOR>
47 int material, T radius)
48 : BlockLatticeF2D<T,DESCRIPTOR>(f.getBlock(), f.getTargetDim()),
49 _f(f), _blockGeometry(blockGeometry), _material(material), _radius(radius)
50{
51 this->getName() = "Average("+f.getName()+")";
52}
53
54
55template <typename T, typename DESCRIPTOR>
56bool BlockLatticeAverage2D<T,DESCRIPTOR>::operator() (T output[], const int input[])
57{
58 // CuboidGeometry2D<T>& cGeometry = f.getBlockLattice2D().get_cGeometry();
59 // loadBalancer& load = f.getBlockLattice2D().get_load();
60
61 // //create boolean indicator functor isInSphere
62 // std::vector<T> center(3,0);
63 // center[0] = (int)cGeometry.get(load.glob(input[0])).get_globPosX() + input[1];
64 // center[1] = (int)cGeometry.get(load.glob(input[0])).get_globPosY() + input[2];
65 // center[2] = (int)cGeometry.get(load.glob(input[0])).get_globPosZ() + input[3];
66 // SphereAnalyticalF2D<bool,T> isInSphere(center,radius);
67
68 // iterate over all cuboids & points and test for material && isInSphere
69 // std::vector<T> tmp( this->_n, T() );
70 // int numVoxels(0);
71 // if (this->_blockGeometry.getMaterial({center[0],center[1],center[2]}) == material) {
72 // for (int iC=0; iC<load.size(); iC++) {
73 // int nX = cGeometry.get(load.glob(iC)).getNx();
74 // int nY = cGeometry.get(load.glob(iC)).getNy();
75 // int nZ = cGeometry.get(load.glob(iC)).getNz();
76 // for (int iX=0; iX<nX; ++iX) {
77 // for (int iY=0; iY<nY; ++iY) {
78 // for (int iZ=0; iZ<nZ; iZ++) {
79 // std::vector<T> glob(3,0);
80 // glob[0] = (int)cGeometry.get(load.glob(iC)).get_globPosX() + iX;
81 // glob[1] = (int)cGeometry.get(load.glob(iC)).get_globPosY() + iY;
82 // glob[2] = (int)cGeometry.get(load.glob(iC)).get_globPosZ() + iZ;
83 // if (this->_blockGeometry.getMaterial({glob[0],glob[1],glob[2]}) == material
84 // && isInSphere(glob)[0]==true) {
85 // for (unsigned iD=0; iD<f(load.glob(0),0,0,0).size(); iD++) {
86 // tmp[iD]+=f(load.glob(iC),iX,iY,iZ)[iD];
87 // }
88 // numVoxels++;
89 // }
90 // }
91 // }
92 // }
93 // }
94
95 //#ifdef PARALLEL_MODE_MPI
96 // singleton::mpi().reduceAndBcast(numVoxels, MPI_SUM);
97 //#endif
98 // for (int iD=0; iD<f.getTargetDim(); iD++) {
99 //#ifdef PARALLEL_MODE_MPI
100 // singleton::mpi().reduceAndBcast(tmp[iD], MPI_SUM);
101 //#endif
102 // if (numVoxels>0) {
103 // tmp[iD] /= numVoxels;
104 // }
105 // }
106 // }
107 // return tmp;
108
109 return false;
110}
111
112}
113#endif
Representation of a block geometry.
BlockLatticeAverage2D(BlockLatticeF2D< T, DESCRIPTOR > &f, BlockGeometry< T, 2 > &blockGeometry, int material, T radius)
bool operator()(T output[], const int input[]) override
has to be implemented for 'every' derived class
represents all functors that operate on a DESCRIPTOR in general, e.g. getVelocity(),...
std::string & getName()
read and write access to name
Definition genericF.hh:51
The description of a generic interface for all functor classes – header file.
This file contains indicator functions.
Wrapper functions that simplify the use of MPI.
Top level namespace for all of OpenLB.
Representation of a parallel 2D geometry – header file.