BoundaryManager.h 4.06 KB
 Peter Gottschling committed Feb 15, 2008 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 // ============================================================================ // == == // == AMDiS - Adaptive multidimensional simulations == // == == // ============================================================================ // == == // == crystal growth group == // == == // == Stiftung caesar == // == Ludwig-Erhard-Allee 2 == // == 53175 Bonn == // == germany == // == == // ============================================================================ // == == // == http://www.caesar.de/cg/AMDiS == // == == // ============================================================================ /** \file BoundaryManager.h */ #ifndef AMDIS_BOUNDARYMANAGER_H #define AMDIS_BOUNDARYMANAGER_H #include  Peter Gottschling committed Apr 28, 2009 27 #include "AMDiS_fwd.h"  Peter Gottschling committed Feb 15, 2008 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 #include "Boundary.h" #include "BoundaryCondition.h" namespace AMDiS { /** * \ingroup Assembler * * \brief * A BoundaryManager handles a set of boundary conditions and applies * this conditions to DOFVectorBase and DOFMatrix objects. Each DOFVectorBase * and each DOFMatrix has its own BoundaryManager. */ class BoundaryManager { public:  Thomas Witkowski committed Sep 23, 2008 44 45 46 47 48 49  BoundaryManager(const FiniteElemSpace *feSpace); BoundaryManager(BoundaryManager &bm); ~BoundaryManager();  Thomas Witkowski committed May 07, 2009 50  /// Adds a local boundary condition to the list of managed conditions.  Peter Gottschling committed Feb 15, 2008 51 52 53 54 55  void addBoundaryCondition(BoundaryCondition *localBC) { BoundaryType type = localBC->getBoundaryType(); TEST_EXIT(localBCs[type] == NULL) ("there is already a condition for this type\n"); localBCs[type] = localBC;  56  }  Peter Gottschling committed Feb 15, 2008 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87  void initMatrix(DOFMatrix *matrix); void exitMatrix(DOFMatrix *matrix); void initVector(DOFVectorBase *vector); void exitVector(DOFVectorBase *vector); /** \brief * Calls DOFVectorBase::fillBoundaryCondition() for each local boundary condition * in \ref localBCs. */ void fillBoundaryConditions(ElInfo *elInfo, DOFVectorBase *vec); /** \brief * Calls DOFMatrix::fillBoundaryCondition() for each local boundary condition * in \ref localBCs. */ void fillBoundaryConditions(ElInfo *elInfo, DOFMatrix *mat); /** \brief * Calls BoundaryCondition::boundResidual() for each boundary condition in * \ref localBCs. */ double boundResidual(ElInfo *elInfo, DOFMatrix *matrix, const DOFVectorBase *dv); inline BoundaryCondition *getBoundaryCondition(BoundaryType type) { return localBCs[type];  88  }  Peter Gottschling committed Feb 15, 2008 89   Thomas Witkowski committed Aug 29, 2008 90  const std::map& getBoundaryConditionMap() {  Peter Gottschling committed Feb 15, 2008 91  return localBCs;  92  }  Peter Gottschling committed Feb 15, 2008 93   Thomas Witkowski committed Aug 29, 2008 94  void setBoundaryConditionMap(const std::map& bcs) {  Peter Gottschling committed Feb 15, 2008 95  localBCs = bcs;  96  }  Peter Gottschling committed Feb 15, 2008 97 98  protected:  Thomas Witkowski committed Mar 23, 2009 99  /// Map of managed local boundary conditions.  Thomas Witkowski committed Aug 29, 2008 100  std::map localBCs;  Thomas Witkowski committed Sep 23, 2008 101   Thomas Witkowski committed Mar 23, 2009 102  /// Temporary thread-safe variable for functions fillBoundaryconditions.  Thomas Witkowski committed Sep 23, 2008 103 104  std::vector localBounds;  Thomas Witkowski committed Mar 23, 2009 105 106 107  /// Temporary thread-safe variable for functions fillBoundaryconditions. std::vector > dofIndices;  Thomas Witkowski committed Sep 23, 2008 108 109 110 111 112  /** \brief * Stores the number of byte that were allocated in the constructor for * each localBounds value. Is used to free the memory in the destructor. */ int allocatedMemoryLocalBounds;  Peter Gottschling committed Feb 15, 2008 113 114 115 116 117  }; } #endif