source: src/base/discretization.hpp@ fb228be

Last change on this file since fb228be was a72216, checked in by Olaf Lenz <olenz@…>, 13 years ago

Fixed permissions.

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

  • Property mode set to 100644
File size: 3.1 KB
RevLine 
[fcf7f6]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
[48b662]19/**
20 * @file discretization.hpp
21 * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
22 * @date Tue Apr 5 20:32:09 2011
[dfed1c]23 *
[48b662]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.
[dfed1c]27 *
[48b662]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:
[b57b9b]48 Discretization(bool register_ = true) :
49 Object("DISCRETIZATION", register_),
[4571da]50 stencil(1.0),
51 order(2)
52 {}
53
[b57b9b]54 Discretization(const int& order, bool register_ = true) :
55 Object("DISCRETIZATION", register_),
[4571da]56 stencil(1.0),
57 order(order)
58 {}
59
[b57b9b]60 Discretization(const Stencil& stencil_, const int& order, bool register_ = true) :
61 Object("DISCRETIZATION", register_),
[4571da]62 stencil(stencil_),
63 order(order)
64 {}
[48b662]65
66 Discretization(std::string id) :
67 Object(id),
[4571da]68 stencil(1.0),
69 order(2)
[48b662]70 {}
71
[4571da]72 Discretization(std::string id, const int& order) :
[48b662]73 Object(id),
[4571da]74 stencil(1.0),
75 order(order)
76 {}
77
78 Discretization(std::string id, const Stencil& stencil_, const int& order) :
79 Object(id),
80 stencil(stencil_),
81 order(order)
[48b662]82 {}
83
84 const Stencil& GetStencil() const {return stencil;} ///< Returns the stencil of the discretized operator.
85
86 virtual vmg_float OperatorPrefactor(const Grid& grid) const = 0; ///< Returns the prefactor of the operator.
87
[4571da]88 virtual void ModifyRightHandSide() {}
89
90 /**
[48b662]91 * This function gets called whenever boundary points at inner boundaries are needed.
92 * Inner boundaries occur when using adaptive grid refinement.
[4571da]93 *
[48b662]94 * @param sol_fine Solution vector / fine level
95 * @param rhs_fine Right handside vector / fine level
96 * @param sol_coarse Solution vector / coarse level
97 */
98 void SetInnerBoundary(Grid& sol_fine, Grid& rhs_fine, Grid& sol_coarse) const
99 {
100 if (sol_fine.Global().BoundaryType() == LocallyRefined)
101 SetInnerBoundaryCompute(sol_fine, rhs_fine, sol_coarse);
102 }
103
104private:
[4571da]105 virtual void SetInnerBoundaryCompute(Grid& sol_fine, Grid& rhs_fine, Grid& sol_coarse) const {}
[48b662]106
107protected:
108 VMG::Stencil stencil;
[4571da]109 int order;
[48b662]110};
111
112}
113
114#endif /* DISCRETIZATION_HPP_ */
Note: See TracBrowser for help on using the repository browser.