OpenLB 1.7
Loading...
Searching...
No Matches
genericF.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2012-2013 Lukas Baron, 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
30#ifndef GENERIC_F_H
31#define GENERIC_F_H
32
33#include<string>
34#include<memory>
35
36namespace olb {
37
49template <typename T, typename S>
50class GenericF {
51protected:
52 // constructor
53 GenericF(int targetDim, int sourceDim):
54 _n(targetDim), _m(sourceDim) { };
55
56private:
57 std::string _name;
58 int _n;
59 int _m;
60 // private copy constructor
61 GenericF(const GenericF&) = delete;
62 // copy assignment operator
63 GenericF& operator=(const GenericF&) = delete;
64
65public:
66 using targetType = T;
67 using sourceType = S;
68 // virtual destructor
69 virtual ~GenericF() = default;
71 std::shared_ptr< GenericF<T,S> > _ptrCalcC;
73 int getSourceDim() const;
75 int getTargetDim() const;
77 std::string& getName();
79 std::string const& getName() const;
81 virtual bool operator() (T output[], const S input[])=0;
83 // it is aimed that it even calls the implemented pure virtual operator() of derived classes
84 // how to use: derived class handles the overloaded operators by including:
85 // using GenericF<T,S>::operator();
86 bool operator() (T output[]);
87 bool operator() (T output[], S input0);
88 bool operator() (T output[], S input0, S input1);
89 bool operator() (T output[], S input0, S input1, S input2);
90 bool operator() (T output[], S input0, S input1, S input2, S input3);
91};
92
93} // end namespace olb
94
95#endif
GenericF is a base class, that can represent continuous as well as discrete functions.
Definition genericF.h:50
int getTargetDim() const
read only access to member variable _n
Definition genericF.hh:45
virtual ~GenericF()=default
int getSourceDim() const
read only access to member variable _m
Definition genericF.hh:39
std::shared_ptr< GenericF< T, S > > _ptrCalcC
memory management, frees resouces (calcClass)
Definition genericF.h:71
std::string & getName()
read and write access to name
Definition genericF.hh:51
GenericF(int targetDim, int sourceDim)
Definition genericF.h:53
virtual bool operator()(T output[], const S input[])=0
has to be implemented for 'every' derived class
Top level namespace for all of OpenLB.