ProblemStatBase.h 5.31 KB
 Praetorius, Simon committed Aug 02, 2013 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 /****************************************************************************** * * AMDiS - Adaptive multidimensional simulations * * Copyright (C) 2013 Dresden University of Technology. All Rights Reserved. * Web: https://fusionforge.zih.tu-dresden.de/projects/amdis * * Authors: * Simon Vey, Thomas Witkowski, Andreas Naumann, Simon Praetorius, et al. * * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * * This file is part of AMDiS * * See also license.opensource.txt in the distribution. * ******************************************************************************/  Thomas Witkowski committed Dec 16, 2010 20 21   Peter Gottschling committed Feb 15, 2008 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39  /** \file ProblemStatBase.h */ /** * \defgroup Problem Problem module * @{ @} */ #ifndef AMDIS_PROBLEMSTATBASE_H #define AMDIS_PROBLEMSTATBASE_H #include "Flag.h" namespace AMDiS { // Flags for controling which part of the problem should be initialized // For all problems  Praetorius, Simon committed May 12, 2016 40 41 42 43 44 45 46 47 48 49  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;  Peter Gottschling committed Feb 15, 2008 50  // For time dependent problems  Praetorius, Simon committed May 12, 2016 51 52 53  const Flag INIT_INITIAL_PROBLEM = 0x200L; const Flag INIT_UH_OLD = 0x400L;  Peter Gottschling committed Feb 15, 2008 54 55 56  // For non linear problems const Flag INIT_UPDATER = 0x800L; const Flag INIT_NONLIN_SOLVER = 0x1000L;  Praetorius, Simon committed May 12, 2016 57 58 59 60 61  const Flag INIT_GLOBAL_REFINES = 0x2000L; // for parallel problem stat const Flag INIT_DOFMAP = 0x4000L;  Peter Gottschling committed Feb 15, 2008 62 63  // Combined Flags  Praetorius, Simon committed May 12, 2016 64  const Flag INIT_NOTHING = 0x00L;  Peter Gottschling committed Feb 15, 2008 65 66 67  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 |  Praetorius, Simon committed May 12, 2016 68  INIT_UH_OLD | INIT_UPDATER | INIT_NONLIN_SOLVER | INIT_DOFMAP;  Peter Gottschling committed Feb 15, 2008 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87  const Flag MESH_REFINED = 1; const Flag MESH_COARSENED = 2; 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:  Thomas Witkowski committed Jun 09, 2009 88  virtual ~ProblemStatBase() {}  Peter Gottschling committed Feb 15, 2008 89   Thomas Witkowski committed Jun 09, 2009 90  /// Marks mesh elements for refinement and coarsening.  Peter Gottschling committed Feb 15, 2008 91 92  virtual Flag markElements(AdaptInfo *adaptInfo) = 0;  Thomas Witkowski committed Jun 09, 2009 93  /// Assembling of system matrices and vectors before refinement.  Peter Gottschling committed Feb 15, 2008 94 95  virtual void buildBeforeRefine(AdaptInfo *adaptInfo, Flag flag) = 0;  Thomas Witkowski committed Jun 09, 2009 96  /// Assembling of system matrices and vectors before coarsening.  Peter Gottschling committed Feb 15, 2008 97 98 99 100  virtual void buildBeforeCoarsen(AdaptInfo *adaptInfo, Flag flag) = 0; /** \brief * Assembling of system matrices and vectors after coarsening.  101 102  * By the last two parameters, assembling can be restricted to either * matrices or vectors only.  Peter Gottschling committed Feb 15, 2008 103  */  104 105  virtual void buildAfterCoarsen(AdaptInfo *adaptInfo, Flag flag, bool assembleMatrix, bool assembleVector) = 0;  Peter Gottschling committed Feb 15, 2008 106   Thomas Witkowski committed Jun 09, 2009 107  /// Refinement of the mesh.  Peter Gottschling committed Feb 15, 2008 108 109  virtual Flag refineMesh(AdaptInfo *adaptInfo) = 0;  Thomas Witkowski committed Jun 09, 2009 110  /// Coarsening of the mesh.  Peter Gottschling committed Feb 15, 2008 111 112  virtual Flag coarsenMesh(AdaptInfo *adaptInfo) = 0;  Thomas Witkowski committed Nov 11, 2011 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133  /** \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. * * \param adaptInfo Pointer to an \ref AdaptInfo object. * \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;  Peter Gottschling committed Feb 15, 2008 134 135 136 137 138 139 140 141  /** \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. */ virtual void estimate(AdaptInfo *adaptInfo) = 0;  Thomas Witkowski committed Jun 09, 2009 142  /// Returns the name of the problem.  Thomas Witkowski committed Jul 20, 2009 143  virtual std::string getName() = 0;  Peter Gottschling committed Feb 15, 2008 144   Thomas Witkowski committed Jun 09, 2009 145  /// Function that serializes the problem plus information about the iteration.  Thomas Witkowski committed Aug 29, 2008 146  virtual void serialize(std::ostream &out) = 0;  Peter Gottschling committed Feb 15, 2008 147   Thomas Witkowski committed Jun 09, 2009 148  /// Function that deserializes the problem plus information about the iteration.  Thomas Witkowski committed Aug 29, 2008 149  virtual void deserialize(std::istream &in) = 0;  Peter Gottschling committed Feb 15, 2008 150 151 152 153 154  }; } #endif