/** * @file discretization.hpp * @author Julian Iseringhausen * @date Tue Apr 5 20:32:09 2011 * * @brief Base class for controlling the discretization of * the continuous system of equations. The discretized * operator must be specified as a stencil. * */ #ifndef DISCRETIZATION_HPP_ #define DISCRETIZATION_HPP_ #include #include #include "base/object.hpp" #include "base/stencil.hpp" #include "grid/grid.hpp" #include "grid/multigrid.hpp" #include "mg.hpp" namespace VMG { class Discretization : public Object { public: Discretization() : stencil(1.0), order(2) {} Discretization(const int& order) : stencil(1.0), order(order) {} Discretization(const Stencil& stencil_, const int& order) : stencil(stencil_), order(order) {} Discretization(std::string id) : Object(id), stencil(1.0), order(2) {} Discretization(std::string id, const int& order) : Object(id), stencil(1.0), order(order) {} Discretization(std::string id, const Stencil& stencil_, const int& order) : Object(id), stencil(stencil_), order(order) {} const Stencil& GetStencil() const {return stencil;} ///< Returns the stencil of the discretized operator. virtual vmg_float OperatorPrefactor(const Grid& grid) const = 0; ///< Returns the prefactor of the operator. virtual void ModifyRightHandSide() {} /** * This function gets called whenever boundary points at inner boundaries are needed. * Inner boundaries occur when using adaptive grid refinement. * * @param sol_fine Solution vector / fine level * @param rhs_fine Right handside vector / fine level * @param sol_coarse Solution vector / coarse level */ void SetInnerBoundary(Grid& sol_fine, Grid& rhs_fine, Grid& sol_coarse) const { if (sol_fine.Global().BoundaryType() == LocallyRefined) SetInnerBoundaryCompute(sol_fine, rhs_fine, sol_coarse); } private: virtual void SetInnerBoundaryCompute(Grid& sol_fine, Grid& rhs_fine, Grid& sol_coarse) const {} protected: VMG::Stencil stencil; int order; }; } #endif /* DISCRETIZATION_HPP_ */