ProblemStatBase.hpp 4.48 KB
 Praetorius, Simon committed Mar 13, 2016 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 /** * \defgroup Problem Problem module * @{ @} */ #pragma once #include #include "Flag.hpp" namespace AMDiS { // Flags for controling which part of the problem should be initialized // For all problems const Flag INIT_FE_SPACE = 0x01L; const Flag INIT_MESH = 0x02L; const Flag CREATE_MESH = 0x04L; const Flag INIT_SYSTEM = 0x08L; const Flag INIT_SOLVER = 0x10L; const Flag INIT_ESTIMATOR = 0x20L; const Flag INIT_MARKER = 0x40L; const Flag INIT_ADAPT = 0x80L; const Flag INIT_FILEWRITER = 0x100L; const Flag INIT_GLOBAL_REFINES = 0x1000L; // For time dependent problems const Flag INIT_INITIAL_PROBLEM = 0x200L; const Flag INIT_UH_OLD = 0x400L; // For non linear problems const Flag INIT_UPDATER = 0x800L; const Flag INIT_NONLIN_SOLVER = 0x1000L; // Combined Flags const Flag INIT_NOTHING = 0x00L; const Flag INIT_ALL = INIT_FE_SPACE | INIT_MESH | CREATE_MESH | INIT_SYSTEM | INIT_SOLVER | INIT_ESTIMATOR | INIT_MARKER | INIT_ADAPT | INIT_FILEWRITER | INIT_INITIAL_PROBLEM | INIT_UH_OLD | INIT_UPDATER | INIT_NONLIN_SOLVER ;  Praetorius, Simon committed Oct 19, 2018 43  const Flag MESH_ADAPTED = 1;  Praetorius, Simon committed Mar 13, 2016 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60  // forward declaration class AdaptInfo; /** * \ingroup Problem * * \brief * Interface for time independent problems. Concrete problems must override * all pure virtual methods. The method \ref adaptMethodStat() should * initiate the adaption loop which in turn uses the other pure virtual * functions. The default stationary adaption loop is implemented in the class * AdaptStationary. */ class ProblemStatBase { public:  Praetorius, Simon committed Oct 01, 2018 61  virtual ~ProblemStatBase() = default;  Praetorius, Simon committed Mar 13, 2016 62 63  /// Marks mesh elements for refinement and coarsening.  Praetorius, Simon committed Mar 20, 2016 64  virtual Flag markElements(AdaptInfo& adaptInfo) = 0;  Praetorius, Simon committed Mar 13, 2016 65 66 67 68 69 70  /** \brief * Assembling of system matrices and vectors after coarsening. * By the last two parameters, assembling can be restricted to either * matrices or vectors only. */  Praetorius, Simon committed Oct 02, 2018 71  virtual void buildAfterAdapt(AdaptInfo& adaptInfo, Flag flag,  Praetorius, Simon committed Oct 19, 2018 72  bool assembleMatrix, bool assembleVector) = 0;  Praetorius, Simon committed Mar 13, 2016 73   Praetorius, Simon committed Oct 02, 2018 74 75  /// Refinement/coarsening of the grid. virtual Flag adaptGrid(AdaptInfo& adaptInfo) = 0;  Praetorius, Simon committed Mar 13, 2016 76   Praetorius, Simon committed Feb 15, 2019 77 78 79 80 81 82 83 84  /// Uniform global grid coarsening by up to n level. /// Returns MESH_ADAPTED if grid was changed virtual Flag globalCoarsen(int n) = 0; /// Uniform global refinement by n level /// Returns MESH_ADAPTED if grid was changed virtual Flag globalRefine(int n) = 0;  Praetorius, Simon committed Mar 13, 2016 85 86 87 88 89  /** \brief * Solves the assembled system. The result is an approximative solution. * The last two boolean arguments can be used to controll successive * solutions of systems with the same matrix. *  Praetorius, Simon committed Nov 19, 2017 90  * \param adaptInfo Reference to an \ref AdaptInfo object.  Praetorius, Simon committed Mar 13, 2016 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111  * \param createMatrixData If false, the solver assumes that all of its * internal data structures for the system * matrix are already created. This is the case, * if we solve different systems but with the * same matrix. After the first call to this * function (with this parameter set to true), * all other calls may set it to false. * \param storeMatrixData If true, all internal data structures for the * system matrix are not deleted such that they * can be used for next solutions with the same * system matrix. */ virtual void solve(AdaptInfo& adaptInfo, bool createMatrixData = true, bool storeMatrixData = false) = 0; /** \brief * A posteriori error estimation of the calculated solution. Should store * a local error estimation at each elements leaf data and return the * total error sum. */  Praetorius, Simon committed Mar 20, 2016 112  virtual void estimate(AdaptInfo& adaptInfo) = 0;  Praetorius, Simon committed Mar 13, 2016 113   Praetorius, Simon committed Mar 28, 2019 114 115 116 117 118 119  /// \brief backup the grid and the solution to a file virtual void backup(AdaptInfo& adaptInfo) = 0; /// \brief restore the grid and the solution from a file virtual void restore(Flag initFlag) = 0;  Praetorius, Simon committed Mar 13, 2016 120  /// Returns the name of the problem.  Praetorius, Simon committed Oct 23, 2018 121  virtual std::string const& name() const = 0;  Praetorius, Simon committed Mar 13, 2016 122  };  Praetorius, Simon committed Nov 19, 2017 123   Praetorius, Simon committed Mar 13, 2016 124 } // end namespace AMDiS