1 | /*
|
---|
2 | * vmg - a versatile multigrid solver
|
---|
3 | * Copyright (C) 2012 Institute for Numerical Simulation, University of Bonn
|
---|
4 | *
|
---|
5 | * vmg is free software: you can redistribute it and/or modify
|
---|
6 | * it under the terms of the GNU General Public License as published by
|
---|
7 | * the Free Software Foundation, either version 3 of the License, or
|
---|
8 | * (at your option) any later version.
|
---|
9 | *
|
---|
10 | * vmg is distributed in the hope that it will be useful,
|
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
13 | * GNU General Public License for more details.
|
---|
14 | *
|
---|
15 | * You should have received a copy of the GNU General Public License
|
---|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
17 | */
|
---|
18 |
|
---|
19 | #ifndef INTERPOLATION_HPP_
|
---|
20 | #define INTERPOLATION_HPP_
|
---|
21 |
|
---|
22 | #include <vector>
|
---|
23 |
|
---|
24 | #include "base/index.hpp"
|
---|
25 | #include "base/vector.hpp"
|
---|
26 |
|
---|
27 | namespace VMG
|
---|
28 | {
|
---|
29 |
|
---|
30 | class Grid;
|
---|
31 |
|
---|
32 | namespace Particle
|
---|
33 | {
|
---|
34 |
|
---|
35 | class Particle;
|
---|
36 |
|
---|
37 | class Interpolation
|
---|
38 | {
|
---|
39 | public:
|
---|
40 | Interpolation(const int& degree);
|
---|
41 | ~Interpolation();
|
---|
42 |
|
---|
43 | void ComputeCoefficients(const Grid& grid, const Index& index);
|
---|
44 | void Evaluate(Particle& p);
|
---|
45 |
|
---|
46 | vmg_float EvaluatePotentialLR(const Particle& p);
|
---|
47 |
|
---|
48 | private:
|
---|
49 | vmg_float& _access_coeff(const Index& index)
|
---|
50 | {
|
---|
51 | return coeff[index.Z() + deg_1 * (index.Y() + deg_1 * index.X())];
|
---|
52 | }
|
---|
53 |
|
---|
54 | vmg_float& _access_coeff(const int& i, const int& j, const int& k)
|
---|
55 | {
|
---|
56 | return coeff[k + deg_1 * (j + deg_1 * i)];
|
---|
57 | }
|
---|
58 |
|
---|
59 | void _compute_coefficients_1d(const Index& index, const unsigned int& direction);
|
---|
60 |
|
---|
61 | vmg_float* coeff;
|
---|
62 | vmg_float* coeff_buffer;
|
---|
63 | int deg, deg_1;
|
---|
64 | Vector pos_begin;
|
---|
65 | Vector h;
|
---|
66 | std::vector<Vector> buffer;
|
---|
67 | std::vector< std::vector<Vector> > buffer_diff;
|
---|
68 | };
|
---|
69 |
|
---|
70 | }
|
---|
71 |
|
---|
72 | }
|
---|
73 |
|
---|
74 | #endif /* INTERPOLATION_HPP_ */
|
---|