source: src/base/discretization.hpp@ e271f0

Last change on this file since e271f0 was fcf7f6, checked in by Julian Iseringhausen <isering@…>, 14 years ago

vmg: Added license files and headers (GPLv3).

git-svn-id: https://svn.version.fz-juelich.de/scafacos/trunk@1812 5161e1c8-67bf-11de-9fd5-51895aff932f

  • Property mode set to 100644
File size: 2.9 KB
Line 
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/**
20 * @file discretization.hpp
21 * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
22 * @date Tue Apr 5 20:32:09 2011
23 *
24 * @brief Base class for controlling the discretization of
25 * the continuous system of equations. The discretized
26 * operator must be specified as a stencil.
27 *
28 */
29
30#ifndef DISCRETIZATION_HPP_
31#define DISCRETIZATION_HPP_
32
33#include <algorithm>
34#include <string>
35
36#include "base/object.hpp"
37#include "base/stencil.hpp"
38#include "grid/grid.hpp"
39#include "grid/multigrid.hpp"
40#include "mg.hpp"
41
42namespace VMG
43{
44
45class Discretization : public Object
46{
47public:
48 Discretization() :
49 stencil(1.0),
50 order(2)
51 {}
52
53 Discretization(const int& order) :
54 stencil(1.0),
55 order(order)
56 {}
57
58 Discretization(const Stencil& stencil_, const int& order) :
59 stencil(stencil_),
60 order(order)
61 {}
62
63 Discretization(std::string id) :
64 Object(id),
65 stencil(1.0),
66 order(2)
67 {}
68
69 Discretization(std::string id, const int& order) :
70 Object(id),
71 stencil(1.0),
72 order(order)
73 {}
74
75 Discretization(std::string id, const Stencil& stencil_, const int& order) :
76 Object(id),
77 stencil(stencil_),
78 order(order)
79 {}
80
81 const Stencil& GetStencil() const {return stencil;} ///< Returns the stencil of the discretized operator.
82
83 virtual vmg_float OperatorPrefactor(const Grid& grid) const = 0; ///< Returns the prefactor of the operator.
84
85 virtual void ModifyRightHandSide() {}
86
87 /**
88 * This function gets called whenever boundary points at inner boundaries are needed.
89 * Inner boundaries occur when using adaptive grid refinement.
90 *
91 * @param sol_fine Solution vector / fine level
92 * @param rhs_fine Right handside vector / fine level
93 * @param sol_coarse Solution vector / coarse level
94 */
95 void SetInnerBoundary(Grid& sol_fine, Grid& rhs_fine, Grid& sol_coarse) const
96 {
97 if (sol_fine.Global().BoundaryType() == LocallyRefined)
98 SetInnerBoundaryCompute(sol_fine, rhs_fine, sol_coarse);
99 }
100
101private:
102 virtual void SetInnerBoundaryCompute(Grid& sol_fine, Grid& rhs_fine, Grid& sol_coarse) const {}
103
104protected:
105 VMG::Stencil stencil;
106 int order;
107};
108
109}
110
111#endif /* DISCRETIZATION_HPP_ */
Note: See TracBrowser for help on using the repository browser.