BoundaryManager.h 4.22 KB
Newer Older
 Peter Gottschling committed Feb 15, 2008 1 2 3 4 // ============================================================================ // == == // == AMDiS - Adaptive multidimensional simulations == // == == Thomas Witkowski committed Dec 16, 2010 5 // == http://www.amdis-fem.org == Peter Gottschling committed Feb 15, 2008 6 7 // == == // ============================================================================ Thomas Witkowski committed Dec 16, 2010 8 9 10 11 12 13 14 15 16 17 18 19 // // Software License for AMDiS // // Copyright (c) 2010 Dresden University of Technology // All rights reserved. // Authors: Simon Vey, Thomas Witkowski et al. // // This file is part of AMDiS // // See also license.opensource.txt in the distribution. Peter Gottschling committed Feb 15, 2008 20 21 22 23 24 25 26 27 /** \file BoundaryManager.h */ #ifndef AMDIS_BOUNDARYMANAGER_H #define AMDIS_BOUNDARYMANAGER_H #include Peter Gottschling committed Apr 28, 2009 28 #include "AMDiS_fwd.h" Peter Gottschling committed Feb 15, 2008 29 30 31 32 33 #include "Boundary.h" #include "BoundaryCondition.h" namespace AMDiS { Thomas Witkowski committed Oct 14, 2009 34 35 typedef std::map BoundaryIndexMap; Peter Gottschling committed Feb 15, 2008 36 37 38 39 40 41 42 43 44 45 46 /** * \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 47 48 49 50 51 52 BoundaryManager(const FiniteElemSpace *feSpace); BoundaryManager(BoundaryManager &bm); ~BoundaryManager(); Thomas Witkowski committed May 07, 2009 53 /// Adds a local boundary condition to the list of managed conditions. 54 void addBoundaryCondition(BoundaryCondition *localBC); Peter Gottschling committed Feb 15, 2008 55 56 57 58 59 60 61 62 63 void initMatrix(DOFMatrix *matrix); void exitMatrix(DOFMatrix *matrix); void initVector(DOFVectorBase *vector); void exitVector(DOFVectorBase *vector); 64 65 /// Calls DOFVectorBase::fillBoundaryCondition() for each local boundary /// condition in \ref localBCs. Peter Gottschling committed Feb 15, 2008 66 67 void fillBoundaryConditions(ElInfo *elInfo, DOFVectorBase *vec); 68 69 /// Calls DOFMatrix::fillBoundaryCondition() for each local boundary condition /// in \ref localBCs. Peter Gottschling committed Feb 15, 2008 70 71 void fillBoundaryConditions(ElInfo *elInfo, DOFMatrix *mat); 72 73 /// Calls BoundaryCondition::boundResidual() for each boundary condition in /// \ref localBCs. Thomas Witkowski committed Oct 14, 2009 74 double boundResidual(ElInfo *elInfo, DOFMatrix *matrix, Peter Gottschling committed Feb 15, 2008 75 76 const DOFVectorBase *dv); Thomas Witkowski committed May 25, 2009 77 78 inline BoundaryCondition *getBoundaryCondition(BoundaryType type) { Peter Gottschling committed Feb 15, 2008 79 return localBCs[type]; 80 } Peter Gottschling committed Feb 15, 2008 81 Thomas Witkowski committed Oct 14, 2009 82 const BoundaryIndexMap& getBoundaryConditionMap() Thomas Witkowski committed May 25, 2009 83 { Peter Gottschling committed Feb 15, 2008 84 return localBCs; 85 } Peter Gottschling committed Feb 15, 2008 86 Thomas Witkowski committed Oct 14, 2009 87 void setBoundaryConditionMap(const BoundaryIndexMap& bcs) Thomas Witkowski committed May 25, 2009 88 { Peter Gottschling committed Feb 15, 2008 89 localBCs = bcs; 90 } Thomas Witkowski committed Oct 14, 2009 91 92 93 /// Returns true, if there is at least one boundary object with the given /// boundary id, which implements a periodic boundary. Thomas Witkowski committed Oct 14, 2009 94 95 96 97 98 99 100 101 static bool isBoundaryPeriodic(BoundaryType b) { for (int i = 0; i < static_cast(globalBoundaryMap[b].size()); i++) if (globalBoundaryMap[b][i]->isPeriodic()) return true; return false; } Peter Gottschling committed Feb 15, 2008 102 103 protected: Thomas Witkowski committed Mar 23, 2009 104 /// Map of managed local boundary conditions. Thomas Witkowski committed Oct 14, 2009 105 BoundaryIndexMap localBCs; Thomas Witkowski committed Sep 23, 2008 106 Thomas Witkowski committed Feb 24, 2011 107 108 /// Temporary variable for functions fillBoundaryconditions. BoundaryType* localBound; Thomas Witkowski committed Sep 23, 2008 109 Thomas Witkowski committed Feb 24, 2011 110 111 /// Temporary variable for functions fillBoundaryconditions. std::vector dofVec; Thomas Witkowski committed Mar 30, 2010 112 113 114 /// Stores the number of byte that were allocated in the constructor for /// each localBounds value. Is used to free the memory in the destructor. Thomas Witkowski committed Sep 23, 2008 115 int allocatedMemoryLocalBounds; Thomas Witkowski committed Oct 14, 2009 116 117 118 /** \brief * For every boundary id we store here all possible boundary object (although Thomas Witkowski committed Jan 25, 2012 119 120 * it's not clear if it is meaningful to have different boundary conditions on * the same boundary id). Thomas Witkowski committed Oct 14, 2009 121 * Thomas Witkowski committed Jan 25, 2012 122 123 124 * We have to use this global variable, because the mesh traverse interface * does not provide more information about traversed boundaries at elements * than the boundary id. Thomas Witkowski committed Oct 14, 2009 125 126 127 128 129 130 * * TODO: Change interface such that mesh traverse returns the boundary objects * directly and we can remove this global variable. The biggest problem will be * than serialization and deserialization of the mesh. */ static std::map > globalBoundaryMap; Peter Gottschling committed Feb 15, 2008 131 132 133 134 135 }; } #endif