OpenLB 1.7
Loading...
Searching...
No Matches
analyticalBaseF.h
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, Albert Mink
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 ANALYTICAL_BASE_F_H
25#define ANALYTICAL_BASE_F_H
26
27#include "functors/genericF.h"
29
36namespace olb {
37
39// 2nd level classes
40// note: for LatticeFunctions the number indicates the SOURCE dimension,
41// target dim depends on return variable type, so std::vector<T> is used
42
43template<unsigned D, typename T, typename S> class AnalyticalIdentity;
44
46template<unsigned D, typename T, typename S> class AnalyticalF : public GenericF<T,S> {
47protected:
48 // n denotes the target dimension
49 AnalyticalF(int n): GenericF<T,S>(n,D)
50 {
51 static_assert(D==1 || D==2 || D==3, "Only D=1,2,3 allowed.");
52 }
53public:
55 static constexpr unsigned dim = D;
56
61};
62
64template <unsigned D, typename T, typename S>
65class AnalyticalIdentity : public AnalyticalF<D,T,S> {
66protected:
68public:
70 bool operator() (T output[], const S input[]) override;
71};
72
74// Therefore, casts NewS->OldS and OldT->NewT must be available
75template <unsigned D, typename OldT, typename NewT, typename OldS, typename NewS>
76class AnalyticalTypecast : public AnalyticalF<D,NewT,NewS> {
77protected:
79public:
81 bool operator() (NewT output[], const NewS input[]) override;
82};
83
84
86
87template <typename T, typename S>
89template <typename T, typename S>
91template <typename T, typename S>
93
94template <typename T, typename S>
96template <typename T, typename S>
98template <typename T, typename S>
100
101
103template <typename T, typename S>
105protected:
107public:
109 bool operator() (T output[], const S input[]) override;
110};
111
112
113
114} // end namespace olb
115
116#endif
AnalyticalF are applications from DD to XD, where X is set by the constructor.
AnalyticalF< D, T, S > & operator*(AnalyticalF< D, T, S > &rhs)
AnalyticalF< D, T, S > & operator/(AnalyticalF< D, T, S > &rhs)
static constexpr unsigned dim
AnalyticalF< D, T, S > & operator+(AnalyticalF< D, T, S > &rhs)
AnalyticalF< D, T, S > & operator-(AnalyticalF< D, T, S > &rhs)
Converts IndicatorF to AnalyticalF (used for Analytical operands for Identity)
bool operator()(T output[], const S input[]) override
has to be implemented for 'every' derived class
AnalyticalFfromIndicatorF3D(IndicatorF3D< T > &indicatorF)
AnalyticalIdentity stores vectors, result of addition,multiplication, ...
AnalyticalF< D, T, S > & _f
bool operator()(T output[], const S input[]) override
has to be implemented for 'every' derived class
AnalyticalIdentity(AnalyticalF< D, T, S > &f)
Perform explicit typecast for the arguments and results of functor.
AnalyticalF< D, OldT, OldS > & _f
AnalyticalTypecast(AnalyticalF< D, OldT, OldS > &f)
bool operator()(NewT output[], const NewS input[]) override
GenericF is a base class, that can represent continuous as well as discrete functions.
Definition genericF.h:50
IndicatorF3D is an application from .
The description of a generic interface for all functor classes – header file.
Top level namespace for all of OpenLB.