| 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 |
|
|---|
| 24 | namespace VMG
|
|---|
| 25 | {
|
|---|
| 26 |
|
|---|
| 27 | class Discretization : public Object
|
|---|
| 28 | {
|
|---|
| 29 | public:
|
|---|
| 30 | Discretization() : stencil(1.0) {}
|
|---|
| 31 | Discretization(const Stencil& stencil_) : stencil(stencil_) {}
|
|---|
| 32 |
|
|---|
| 33 | Discretization(std::string id) :
|
|---|
| 34 | Object(id),
|
|---|
| 35 | stencil(1.0)
|
|---|
| 36 | {}
|
|---|
| 37 |
|
|---|
| 38 | Discretization(std::string id, const Stencil& stencil_) :
|
|---|
| 39 | Object(id),
|
|---|
| 40 | stencil(stencil_)
|
|---|
| 41 | {}
|
|---|
| 42 |
|
|---|
| 43 | const Stencil& GetStencil() const {return stencil;} ///< Returns the stencil of the discretized operator.
|
|---|
| 44 |
|
|---|
| 45 | virtual vmg_float OperatorPrefactor(const Grid& grid) const = 0; ///< Returns the prefactor of the operator.
|
|---|
| 46 |
|
|---|
| 47 | /**
|
|---|
| 48 | * This function gets called whenever boundary points at inner boundaries are needed.
|
|---|
| 49 | * Inner boundaries occur when using adaptive grid refinement.
|
|---|
| 50 | *
|
|---|
| 51 | * @param sol_fine Solution vector / fine level
|
|---|
| 52 | * @param rhs_fine Right handside vector / fine level
|
|---|
| 53 | * @param sol_coarse Solution vector / coarse level
|
|---|
| 54 | */
|
|---|
| 55 | void SetInnerBoundary(Grid& sol_fine, Grid& rhs_fine, Grid& sol_coarse) const
|
|---|
| 56 | {
|
|---|
| 57 | if (sol_fine.Global().BoundaryType() == LocallyRefined)
|
|---|
| 58 | SetInnerBoundaryCompute(sol_fine, rhs_fine, sol_coarse);
|
|---|
| 59 | }
|
|---|
| 60 |
|
|---|
| 61 | private:
|
|---|
| 62 | virtual void SetInnerBoundaryCompute(Grid& sol_fine, Grid& rhs_fine, Grid& sol_coarse) const = 0;
|
|---|
| 63 |
|
|---|
| 64 | protected:
|
|---|
| 65 | VMG::Stencil stencil;
|
|---|
| 66 | };
|
|---|
| 67 |
|
|---|
| 68 | }
|
|---|
| 69 |
|
|---|
| 70 | #endif /* DISCRETIZATION_HPP_ */
|
|---|