source: src/base/discretization.hpp@ 4571da

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

vmg: Implement fourth-order discretization of the Poisson equation.

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

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