OpenLB 1.7
Loading...
Searching...
No Matches
latticeDiscreteNormal2D.hh
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2020 Clara Schragmann
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_DISCRETE_NORMAL_2D_HH
25#define LATTICE_DISCRETE_NORMAL_2D_HH
26
27#include <vector>
28
33
34
35namespace olb {
36
37template<typename T,typename DESCRIPTOR>
40 : SuperLatticeF2D<T,DESCRIPTOR>(sLattice, DESCRIPTOR::d), _superGeometry(superGeometry),
41 _indicatorF(std::move(indicatorF))
42{
43 this->getName() = "discreteNormal";
44 int maxC = this->_sLattice.getLoadBalancer().size();
45 this->_blockF.reserve(maxC);
46 for (int iC = 0; iC < maxC; iC++) {
48 this->_sLattice.getBlock(iC),
49 this->_superGeometry.getBlockGeometry(iC),
50 indicatorF->getBlockIndicatorF(iC)) );
51 }
52}
53
54template <typename T, typename DESCRIPTOR>
56(BlockLattice<T,DESCRIPTOR>& blockLattice, BlockGeometry<T,2>& blockGeometry, BlockIndicatorF2D<T>& indicatorF)
57 : BlockLatticeF2D<T,DESCRIPTOR>(blockLattice, DESCRIPTOR::d),
58 _blockGeometry(blockGeometry),
59 _indicatorF(indicatorF)
60{
61 this->getName() = "discreteNormal";
62}
63
64template <typename T, typename DESCRIPTOR>
66{
67 if (_indicatorF(input)) {
68 std::vector<int> normalVector = _blockGeometry.getStatistics().getType(input);
69 output[0] = normalVector[1];
70 output[1] = normalVector[2];
71 }
72 else {
73 output[0]=0.;
74 output[1]=0.;
75 }
76
77 return true;
78}
79
80template<typename T,typename DESCRIPTOR>
83 : SuperLatticeF2D<T,DESCRIPTOR>(sLattice, DESCRIPTOR::d), _superGeometry(superGeometry),
84 _indicatorF(std::move(indicatorF))
85{
86 this->getName() = "discreteNormalType";
87 int maxC = this->_sLattice.getLoadBalancer().size();
88 this->_blockF.reserve(maxC);
89 for (int iC = 0; iC < maxC; iC++) {
91 this->_sLattice.getBlock(iC),
92 this->_superGeometry.getBlockGeometry(iC),
93 indicatorF->getBlockIndicatorF(iC)) );
94 }
95}
96
97template <typename T, typename DESCRIPTOR>
99(BlockLattice<T,DESCRIPTOR>& blockLattice, BlockGeometry<T,2>& blockGeometry, BlockIndicatorF2D<T>& indicatorF)
100 : BlockLatticeF2D<T,DESCRIPTOR>(blockLattice, DESCRIPTOR::d),
101 _blockGeometry(blockGeometry),
102 _indicatorF(indicatorF)
103{
104 this->getName() = "discreteNormalType";
105}
106
107template <typename T, typename DESCRIPTOR>
109{
110 if (_indicatorF(input)) {
111 std::vector<int> normalVector = _blockGeometry.getStatistics().getType(input);
112 output[0] = normalVector[0];
113 }
114 else {
115 output[0] = 0.;
116 }
117
118 return true;
119}
120
121}
122#endif
Representation of a block geometry.
Base block indicator functor (discrete)
BlockLatticeDiscreteNormal2D returns pointwise the discrete normal vector of the local lattice bounda...
BlockLatticeDiscreteNormal2D(BlockLattice< T, DESCRIPTOR > &blockLattice, BlockGeometry< T, 2 > &blockGeometry, BlockIndicatorF2D< T > &indicatorF)
bool operator()(T output[], const int input[]) override
has to be implemented for 'every' derived class
BlockLatticeDiscreteNormalType2D returns pointwise the type of a discrete normal vector.
BlockLatticeDiscreteNormalType2D(BlockLattice< T, DESCRIPTOR > &blockLattice, BlockGeometry< T, 2 > &blockGeometry, BlockIndicatorF2D< T > &indicatorF)
bool operator()(T output[1], const int input[]) override
represents all functors that operate on a DESCRIPTOR in general, e.g. getVelocity(),...
Platform-abstracted block lattice for external access and inter-block interaction.
Smart pointer for managing the various ways of passing functors around.
Definition functorPtr.h:60
std::string & getName()
read and write access to name
Definition genericF.hh:51
std::vector< std::unique_ptr< BlockF2D< T > > > _blockF
Super functors may consist of several BlockF2D<W> derived functors.
Representation of a statistic for a parallel 2D geometry.
SuperLatticeDiscreteNormal2D(SuperLattice< T, DESCRIPTOR > &sLattice, SuperGeometry< T, 2 > &superGeometry, FunctorPtr< SuperIndicatorF2D< T > > &&indicatorF)
SuperLatticeDiscreteNormalType2D(SuperLattice< T, DESCRIPTOR > &sLattice, SuperGeometry< T, 2 > &superGeometry, FunctorPtr< SuperIndicatorF2D< T > > &&indicatorF)
represents all functors that operate on a SuperLattice in general, e.g. getVelocity(),...
SuperLattice< T, DESCRIPTOR > & _sLattice
Super class maintaining block lattices for a cuboid decomposition.
This file contains indicator functions.
Top level namespace for all of OpenLB.
Representation of a parallel 2D geometry – header file.