OpenLB 1.8.1
Loading...
Searching...
No Matches
superBaseF3D.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2012-2017 Lukas Baron, Tim Dornieden, Mathias J. Krause,
4 * Albert Mink, Benjamin Förster, Adrian Kummerlaender
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 SUPER_BASE_F_3D_H
26#define SUPER_BASE_F_3D_H
27
28#include <memory>
29
30#include "functors/genericF.h"
31#include "blockBaseF3D.h"
35#include "core/superData.h"
36#include "core/superLattice.h"
37
38
39/* Note: Throughout the whole source code directory functors, the
40 * template parameters for i/o dimensions are:
41 * F: S^m -> T^n (S=source, T=target)
42 */
43
44namespace olb {
45
46template<typename T, typename BaseType> class SuperData3D;
47template<typename T, typename DESCRIPTOR> class SuperLattice;
48template<typename T> class SuperStructure3D;
49template<typename T> class BlockF3D;
50template<typename T> class SuperIndicatorF3D;
51template<typename T, typename W> class SuperIdentity3D;
52template<typename T, typename DESCRIPTOR> class SuperLatticeIdentity3D;
53
55template <typename T, typename W = T>
56class SuperF3D : public GenericF<W,int> {
57protected:
58 SuperF3D(SuperStructure<T,3>& superStructure, int targetDim);
59
62
66 std::vector<std::unique_ptr<BlockF3D<W>>> _blockF;
67public:
69 static constexpr bool isSuper = true;
70 static constexpr unsigned d = 3;
71
76
80 int getBlockFSize() const;
82 BlockF3D<W>& getBlockF(int iCloc);
83
84 bool operator() (W output[], const int input []);
85
86 using GenericF<W,int>::operator();
87};
88
89
91template<typename T, typename BaseType>
92class SuperDataF3D : public SuperF3D<T,BaseType> {
93protected:
96public:
100 bool operator() (BaseType output[], const int input[]);
103};
104
105
107template <typename T, typename W=T>
108class SuperIdentity3D : public SuperF3D<T,W> {
109protected:
111public:
113 bool operator() (W output[], const int input[]) override;
114};
115
116
118template <typename T, typename W=T>
120protected:
122 const int _extractDim;
123public:
125 int getExtractDim();
126 bool operator() (W output[], const int input[]);
127};
128
129
131template <typename T, typename W=T>
133protected:
135public:
137 FunctorPtr<SuperIndicatorF3D<T>>&& indicatorF);
138 bool operator() (W output[], const int input[]) override;
139};
140
141
143template <typename T, typename W=T>
145protected:
148public:
150 FunctorPtr<SuperIndicatorF3D<T>>&& indicatorF);
151 bool operator() (W output[], const int input[]);
152};
153
155// user has to guarantee that cast is well-defined
156template <typename T, typename W, typename W2>
157class SuperTypecastF3D : public SuperF3D<T,W> {
158protected:
160public:
162 bool operator() (W output[], const int input[]);
163};
164
166template <typename T, typename W=T>
168protected:
172public:
173 SuperIdentityOnSuperIndicatorF3D(SuperF3D<T,W>& f, SuperIndicatorF3D<T>& indicatorF, W defaultValue=0.);
174 bool operator() (W output[], const int input[]);
175};
176
178template <typename T, typename DESCRIPTOR>
179class SuperLatticeF3D : public SuperF3D<T,T> {
180protected:
181 SuperLatticeF3D(SuperLattice<T,DESCRIPTOR>& superLattice, int targetDim);
182
184public:
186
188
189 bool operator() (T output [], const int input []);
190
191 using GenericF<T,int>::operator();
192};
193
195template <typename T, typename DESCRIPTOR>
196class SuperLatticeIdentity3D : public SuperLatticeF3D<T,DESCRIPTOR> {
197protected:
199public:
201 bool operator() (T output[], const int input[]) override;
202};
203
205template <typename T, typename DESCRIPTOR>
206class SuperLatticePhysF3D : public SuperLatticeF3D<T,DESCRIPTOR> {
207protected:
209 const UnitConverter<T,DESCRIPTOR>& converter, int targetDim);
211public:
213};
214
216template <typename T, typename DESCRIPTOR, typename TDESCRIPTOR>
225
226
227template <typename T, typename DESCRIPTOR>
228class ComposedSuperLatticeF3D : public SuperLatticeF3D<T,DESCRIPTOR> {
229private:
233public:
237 bool operator() (T output[], const int x[]) override;
238};
239
240
242template <typename T, typename DESCRIPTOR>
243class SuperLatticeFfromCallableF final : public SuperLatticeF<T,DESCRIPTOR> {
244public:
252 // iCuboid is the local cuboid index
253 template <typename F>
255 : SuperLatticeF<T,DESCRIPTOR>(superLattice, 1)
256 {
257 this->getName() = "FromCallable";
258
259 LoadBalancer<T>& load = this->getSuperStructure().getLoadBalancer();
260 for (int iC = 0; iC < load.size(); ++iC) {
261 this->_blockF.emplace_back(
263 this->_sLattice.getBlock(iC), iC, f));
264 }
265 }
266};
267
268
269} // end namespace olb
270
271#endif
represents all functors that operate on a cuboid in general, mother class of BlockLatticeF,...
Definition aliases.h:174
Generate a BlockLatticeF from an arbitrary function.
bool operator()(T output[], const int x[]) override
ComposedSuperLatticeF3D(SuperLatticeF3D< T, DESCRIPTOR > &f0, SuperLatticeF3D< T, DESCRIPTOR > &f1, SuperLatticeF3D< T, DESCRIPTOR > &f2)
Smart pointer for managing the various ways of passing functors around.
Definition functorPtr.h:60
GenericF is a base class, that can represent continuous as well as discrete functions.
Definition genericF.h:50
Base class for all LoadBalancer.
Definition vtiWriter.h:42
Functor from SuperData3D
SuperDataF3D(SuperData< 3, T, BaseType > &superData)
Constructor from SuperData3D - stores _superData reference.
SuperData< 3, T, BaseType > & _superData
SuperData3D object this functor was created from
bool operator()(BaseType output[], const int input[])
Operator for this functor - copies data from _superData object into output.
SuperData< 3, T, BaseType > & getSuperData()
Getter for _superData
functor to extract one component
SuperExtractComponentF3D(FunctorPtr< SuperF3D< T, W > > &&f, int extractDim)
bool operator()(W output[], const int input[])
has to be implemented for 'every' derived class
FunctorPtr< SuperF3D< T, W > > _f
functor to extract one component inside an indicator
SuperExtractComponentIndicatorF3D(FunctorPtr< SuperF3D< T, W > > &&f, int extractDim, FunctorPtr< SuperIndicatorF3D< T > > &&indicatorF)
FunctorPtr< SuperIndicatorF3D< T > > _indicatorF
bool operator()(W output[], const int input[]) override
has to be implemented for 'every' derived class
functor to extract data inside an indicator
SuperExtractIndicatorF3D(FunctorPtr< SuperF3D< T, W > > &&f, FunctorPtr< SuperIndicatorF3D< T > > &&indicatorF)
FunctorPtr< SuperF3D< T, W > > _f
FunctorPtr< SuperIndicatorF3D< T > > _indicatorF
bool operator()(W output[], const int input[])
has to be implemented for 'every' derived class
represents all functors that operate on a SuperStructure<T,3> in general
Definition aliases.h:184
SuperStructure< T, 3 > & getSuperStructure()
SuperF3D< T, W > & operator*(SuperF3D< T, W > &rhs)
static constexpr bool isSuper
int getBlockFSize() const
SuperStructure< T, 3 > & _superStructure
BlockF3D< W > & getBlockF(int iCloc)
SuperF3D(SuperStructure< T, 3 > &superStructure, int targetDim)
SuperF3D< T, W > & operator/(SuperF3D< T, W > &rhs)
static constexpr unsigned d
std::vector< std::unique_ptr< BlockF3D< W > > > _blockF
Super functors may consist of several BlockF3D<W> derived functors.
bool operator()(W output[], const int input[])
has to be implemented for 'every' derived class
SuperF3D< T, W > & operator+(SuperF3D< T, W > &rhs)
SuperF3D< T, W > & operator-(SuperF3D< T, W > &rhs)
identity functor for memory management
FunctorPtr< SuperF3D< T, W > > _f
bool operator()(W output[], const int input[]) override
has to be implemented for 'every' derived class
SuperIdentity3D(FunctorPtr< SuperF3D< T, W > > &&f)
identity functor for memory management
SuperIdentityOnSuperIndicatorF3D(SuperF3D< T, W > &f, SuperIndicatorF3D< T > &indicatorF, W defaultValue=0.)
SuperIndicatorF3D< T > & _indicatorF
bool operator()(W output[], const int input[])
has to be implemented for 'every' derived class
Base indicator functor (discrete)
Definition aliases.h:194
represents all functors that operate on a SuperLattice in general, e.g. getVelocity(),...
Definition aliases.h:115
SuperLattice< T, DESCRIPTOR > & getSuperLattice()
SuperLattice< T, DESCRIPTOR > & _sLattice
SuperLatticeF3D(SuperLattice< T, DESCRIPTOR > &superLattice, int targetDim)
bool operator()(T output[], const int input[])
Generate a SuperLatticeF from an arbitrary function.
SuperLatticeFfromCallableF(SuperLattice< T, DESCRIPTOR > &superLattice, F &&f)
Generate a SuperLatticeF from an arbitrary function.
identity functor for memory management
FunctorPtr< SuperLatticeF3D< T, DESCRIPTOR > > _f
bool operator()(T output[], const int input[]) override
SuperLatticeIdentity3D(FunctorPtr< SuperLatticeF3D< T, DESCRIPTOR > > &&f)
represents all functors that operate on a DESCRIPTOR with output in Phys, e.g. physVelocity(),...
Definition aliases.h:315
const UnitConverter< T, DESCRIPTOR > & _converter
UnitConverter< T, DESCRIPTOR > const & getConverter() const
SuperLatticePhysF3D(SuperLattice< T, DESCRIPTOR > &sLattice, const UnitConverter< T, DESCRIPTOR > &converter, int targetDim)
represents all thermal functors that operate on a DESCRIPTOR with output in Phys, e....
ThermalUnitConverter< T, DESCRIPTOR, TDESCRIPTOR > const & getConverter() const
const ThermalUnitConverter< T, DESCRIPTOR, TDESCRIPTOR > & _converter
SuperLatticeThermalPhysF3D(SuperLattice< T, TDESCRIPTOR > &sLattice, const ThermalUnitConverter< T, DESCRIPTOR, TDESCRIPTOR > &converter, int targetDim)
Super class maintaining block lattices for a cuboid decomposition.
perform explicit typecast from output type W2 to W
FunctorPtr< SuperF3D< T, W2 > > _f
SuperTypecastF3D(FunctorPtr< SuperF3D< T, W2 > > &&f)
bool operator()(W output[], const int input[])
has to be implemented for 'every' derived class
Conversion between physical and lattice units, as well as discretization specialized for thermal appl...
Conversion between physical and lattice units, as well as discretization.
The description of a generic interface for all functor classes – header file.
Top level namespace for all of OpenLB.
std::conditional_t< DESCRIPTOR::d==2, SuperLatticeF2D< T, DESCRIPTOR >, SuperLatticeF3D< T, DESCRIPTOR > > SuperLatticeF
Definition aliases.h:118
typename util::BaseTypeHelper< T >::type BaseType
Definition baseType.h:59
std::string getName(OperatorScope scope)
Returns human-readable name of scope.
Dynamics for a generic 2D super data – header file.