OpenLB 1.7
Loading...
Searching...
No Matches
latticeDiscreteNormal3D.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_3D_HH
25#define LATTICE_DISCRETE_NORMAL_3D_HH
26
27#include<vector> // for generic i/o
28
32
33
34namespace olb {
35
36template<typename T, typename DESCRIPTOR>
38 : SuperLatticeF3D<T, DESCRIPTOR>(sLattice, DESCRIPTOR::d), _superGeometry(superGeometry),
39 _indicatorF(std::move(indicatorF))
40{
41 this->getName() = "discreteNormal";
42 int maxC = this->_sLattice.getLoadBalancer().size();
43 this->_blockF.reserve(maxC);
44 for (int iC = 0; iC < maxC; iC++) {
45 this->_blockF.emplace_back(new BlockLatticeDiscreteNormal3D<T, DESCRIPTOR>(this->_sLattice.getBlock(iC),
46 this->_superGeometry.getBlockGeometry(iC),
47 indicatorF->getBlockIndicatorF(iC) ));
48 }
49}
50
51template<typename T, typename DESCRIPTOR>
53 : BlockLatticeF3D<T, DESCRIPTOR>(blockLattice, DESCRIPTOR::d),
54 _blockGeometry(blockGeometry),
55 _indicatorF(indicatorF)
56{
57 this->getName() = "discreteNormal";
58}
59
60template<typename T, typename DESCRIPTOR>
62{
63 if (_indicatorF(input)) {
64 std::vector<int> normalVector = _blockGeometry.getStatistics().getType(input);
65 output[0] = normalVector[1];
66 output[1] = normalVector[2];
67 output[2] = normalVector[3];
68 }
69 else {
70 output[0] = 0.;
71 output[1] = 0.;
72 output[2] = 0.;
73 }
74
75 return true;
76}
77
78template<typename T, typename DESCRIPTOR>
80 : SuperLatticeF3D<T, DESCRIPTOR>(sLattice, DESCRIPTOR::d), _superGeometry(superGeometry),
81 _indicatorF(std::move(indicatorF))
82{
83 this->getName() = "discreteNormalType";
84 int maxC = this->_sLattice.getLoadBalancer().size();
85 this->_blockF.reserve(maxC);
86 for (int iC = 0; iC < maxC; iC++) {
87 this->_blockF.emplace_back(new BlockLatticeDiscreteNormalType3D<T, DESCRIPTOR>(this->_sLattice.getBlock(iC),
88 this->_superGeometry.getBlockGeometry(iC),
89 indicatorF->getBlockIndicatorF(iC) ));
90 }
91}
92
93template<typename T, typename DESCRIPTOR>
95 : BlockLatticeF3D<T, DESCRIPTOR>(blockLattice, DESCRIPTOR::d),
96 _blockGeometry(blockGeometry),
97 _indicatorF(indicatorF)
98{
99 this->getName() = "discreteNormalType";
100}
101
102template<typename T, typename DESCRIPTOR>
104{
105 if (_indicatorF(input)) {
106 std::vector<int> normalVector = _blockGeometry.getStatistics().getType(input);
107 output[0] = normalVector[0];
108 }
109 else {
110 output[0] = 0.;
111 }
112
113 return true;
114}
115
116}
117#endif
Representation of a block geometry.
Base block indicator functor.
BlockLatticeDiscreteNormal3D returns pointwise the discrete normal vector of the local lattice bounda...
bool operator()(T output[], const int input[]) override
has to be implemented for 'every' derived class
BlockLatticeDiscreteNormal3D(BlockLattice< T, DESCRIPTOR > &blockLattice, BlockGeometry< T, 3 > &blockGeometry, BlockIndicatorF3D< T > &indicatorF)
BlockLatticeDiscreteNormalType3D returns pointwise the type of a discrete normal vector.
BlockLatticeDiscreteNormalType3D(BlockLattice< T, DESCRIPTOR > &blockLattice, BlockGeometry< T, 3 > &blockGeometry, BlockIndicatorF3D< 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< BlockF3D< T > > > _blockF
Super functors may consist of several BlockF3D<W> derived functors.
Representation of a statistic for a parallel 2D geometry.
Base indicator functor (discrete)
SuperLatticeDiscreteNormal3D(SuperLattice< T, DESCRIPTOR > &sLattice, SuperGeometry< T, 3 > &superGeometry, FunctorPtr< SuperIndicatorF3D< T > > &&indicatorF)
SuperLatticeDiscreteNormalType3D(SuperLattice< T, DESCRIPTOR > &sLattice, SuperGeometry< T, 3 > &superGeometry, FunctorPtr< SuperIndicatorF3D< 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.
Top level namespace for all of OpenLB.
Representation of a parallel 2D geometry – header file.