OpenLB 1.7
Loading...
Searching...
No Matches
reductionF2D.hh
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2012 Lukas Baron, Tim Dornieden, Mathias J. Krause,
4 * Albert Mink
5 * E-mail contact: info@openlb.net
6 * The most recent release of OpenLB can be downloaded at
7 * <http://www.openlb.net/>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public
20 * License along with this program; if not, write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
23*/
24
25#ifndef REDUCTION_F_2D_HH
26#define REDUCTION_F_2D_HH
27
29#include "core/superLattice2D.h"
30#include "dynamics/lbm.h"
31
32namespace olb {
33
34
35template <typename T, typename DESCRIPTOR>
39 : SuperLatticeF2D<T, DESCRIPTOR>(sLattice, f->getTargetDim()),
40 _f(std::move(f))
41{
42 this->getName() = "fromAnalyticalF(" + _f->getName() + ")";
43
44 LoadBalancer<T>& load = sLattice.getLoadBalancer();
45 CuboidGeometry2D<T>& cuboid = sLattice.getCuboidGeometry();
46
47 for (int iC = 0; iC < load.size(); ++iC) {
48 this->_blockF.emplace_back(
50 *_f,
51 sLattice.getBlock(iC),
52 cuboid.get(load.glob(iC)))
53 );
54 }
55}
56
57template <typename T, typename DESCRIPTOR>
59{
60 T physR[2] = {};
61 this->_sLattice.getCuboidGeometry().getPhysR(physR,input);
62 return _f(output,physR);
63}
64
65
66template<typename T, typename DESCRIPTOR>
70 Cuboid2D<T>& cuboid)
71 : BlockLatticeF2D<T, DESCRIPTOR>(lattice, f.getTargetDim()),
72 _f(f),
73 _cuboid(cuboid)
74{
75 this->getName() = "blockFfromAnalyticalF(" + _f.getName() + ")";
76}
77
78template<typename T, typename DESCRIPTOR>
80 T output[], const int input[])
81{
82 T physR[2] = {};
83 _cuboid.getPhysR(physR,input);
84 return _f(output,physR);
85}
86
87
88} // end namespace olb
89
90#endif
AnalyticalF are applications from DD to XD, where X is set by the constructor.
represents all functors that operate on a DESCRIPTOR in general, e.g. getVelocity(),...
Block level functor for conversion of analytical to lattice functors.
bool operator()(T output[], const int input[]) override
has to be implemented for 'every' derived class
BlockLatticeFfromAnalyticalF2D(AnalyticalF2D< T, T > &f, BlockLattice< T, DESCRIPTOR > &lattice, Cuboid2D< T > &cuboid)
Platform-abstracted block lattice for external access and inter-block interaction.
A regular single 2D cuboid is the basic component of a 2D cuboid structure which defines the grid.
Definition cuboid2D.h:54
A cuboid structure represents the grid of a considered domain.
Cuboid2D< T > & get(int i)
Read and write access to the cuboids.
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
Base class for all LoadBalancer.
int glob(int loc) const
std::vector< std::unique_ptr< BlockF2D< T > > > _blockF
Super functors may consist of several BlockF2D<W> derived functors.
represents all functors that operate on a SuperLattice in general, e.g. getVelocity(),...
FunctorPtr< AnalyticalF2D< T, T > > _f
SuperLatticeFfromAnalyticalF2D(FunctorPtr< AnalyticalF2D< T, T > > &&f, SuperLattice< T, DESCRIPTOR > &sLattice)
bool operator()(T output[], const int input[]) override
Super class maintaining block lattices for a cuboid decomposition.
BlockLattice< T, DESCRIPTOR > & getBlock(int locC)
Return BlockLattice with local index locC.
CuboidGeometry< T, D > & getCuboidGeometry()
Read and write access to cuboid geometry.
LoadBalancer< T > & getLoadBalancer()
Read and write access to the load balancer.
Top level namespace for all of OpenLB.
The description of a 2D super lattice – header file.