-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathfunctionhandler.h
77 lines (58 loc) · 2.12 KB
/
functionhandler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef FUNCTIONHANDLER_H
#define FUNCTIONHANDLER_H
#include "multigridsolver2D.h"
#include "multigridsolver3D.h"
typedef real (*Function2D)(real,real);
class FunctionHandler2D
{
public:
FunctionHandler2D( Function2D f,
Function2D borders,
Function2D solution = 0) : m_pFunc(f),
m_pBord(borders),
m_pSol(solution)
{}
Buffer2D discretize_func(int dimx,int dimy,real dh,const BorderHandler2D & bord);
Buffer2D discretize_sol(int dimx,int dimy,real dh,const BorderHandler2D & bord);
BidimArray<real> solution(int dimx,int dimy);
bool hasSol() const {return m_pSol;}
private:
Function2D m_pFunc;
Function2D m_pBord;
Function2D m_pSol;
};
typedef real (*Function3D)(real,real,real);
class FunctionHandler3D
{
public:
FunctionHandler3D( Function3D f,
Function3D borders,
Function3D solution = 0) : m_pFunc(f),
m_pBord(borders),
m_pSol(solution)
{}
Buffer3D discretize_func(int dimx,int dimy,int dimz,real dh,const BorderHandler3D & bord);
Buffer3D discretize_sol(int dimx,int dimy,int dimz,real dh,const BorderHandler3D & bord);
BidimArray<real> solution(int dimx,int dimy,int dimz);
bool hasSol() const {return m_pSol;}
private:
Function3D m_pFunc;
Function3D m_pBord;
Function3D m_pSol;
};
#endif // FUNCTIONHANDLER_H