MeshDistributor.h 20 KB
 Thomas Witkowski committed Apr 03, 2009 1 2 3 4 // ============================================================================ // == == // == AMDiS - Adaptive multidimensional simulations == // == ==  Thomas Witkowski committed Dec 16, 2010 5 // == http://www.amdis-fem.org ==  Thomas Witkowski committed Apr 03, 2009 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.  Thomas Witkowski committed Apr 03, 2009 20   21 /** \file MeshDistributor.h */  Thomas Witkowski committed Jul 09, 2009 22   23 24 #ifndef AMDIS_MESHDISTRIBUTOR_H #define AMDIS_MESHDISTRIBUTOR_H  Thomas Witkowski committed Apr 03, 2009 25 26 27  #include  Thomas Witkowski committed Jun 11, 2009 28 #include  Thomas Witkowski committed Apr 03, 2009 29 #include  Thomas Witkowski committed Feb 08, 2010 30 #include  Thomas Witkowski committed Apr 03, 2009 31   Thomas Witkowski committed Jan 24, 2011 32 #include "parallel/MeshPartitioner.h"  Thomas Witkowski committed Nov 29, 2010 33 #include "parallel/InteriorBoundary.h"  Thomas Witkowski committed Jan 27, 2011 34 #include "AMDiS_fwd.h"  Thomas Witkowski committed Feb 08, 2010 35 #include "Global.h"  Thomas Witkowski committed Apr 03, 2009 36 37 #include "ProblemTimeInterface.h" #include "ProblemIterationInterface.h"  Thomas Witkowski committed Apr 15, 2009 38 #include "FiniteElemSpace.h"  Thomas Witkowski committed Sep 29, 2009 39 #include "Serializer.h"  Thomas Witkowski committed Feb 08, 2010 40 #include "BoundaryManager.h"  Thomas Witkowski committed Jul 29, 2010 41 #include "ElementObjectData.h"  Thomas Witkowski committed Jan 27, 2011 42 #include "SystemVector.h"  Thomas Witkowski committed Jun 12, 2009 43   Thomas Witkowski committed Apr 03, 2009 44 namespace AMDiS {  Thomas Witkowski committed Jan 07, 2011 45 46  using namespace std;  Thomas Witkowski committed Apr 08, 2011 47 48 49 50  struct BoundaryDofInfo {  Thomas Witkowski committed Apr 08, 2011 51  map geoDofs;  Thomas Witkowski committed Apr 08, 2011 52  };  53   Thomas Witkowski committed Apr 08, 2011 54   Thomas Witkowski committed Jun 08, 2010 55  class MeshDistributor  Thomas Witkowski committed Apr 03, 2009 56  {  Thomas Witkowski committed Feb 09, 2010 57  protected:  Thomas Witkowski committed Jun 29, 2009 58  /// Defines a mapping type from DOFs to rank numbers.  Thomas Witkowski committed Jan 07, 2011 59  typedef map DofToRank;  Thomas Witkowski committed Jun 29, 2009 60 61  /// Defines a mapping type from DOFs to a set of rank numbers.  Thomas Witkowski committed Jan 07, 2011 62  typedef map > DofToPartitions;  Thomas Witkowski committed Jun 29, 2009 63 64  /// Defines a mapping type from rank numbers to sets of DOFs.  Thomas Witkowski committed Jan 07, 2011 65  typedef map RankToDofContainer;  Thomas Witkowski committed Jun 29, 2009 66 67  /// Defines a mapping type from DOF indices to DOF indices.  Thomas Witkowski committed Jan 07, 2011 68  typedef map DofMapping;  Thomas Witkowski committed Jun 29, 2009 69   Thomas Witkowski committed Aug 13, 2009 70  /// Defines a mapping type from DOFs to boolean values.  Thomas Witkowski committed Jan 07, 2011 71  typedef map DofToBool;  Thomas Witkowski committed Aug 13, 2009 72   Thomas Witkowski committed Jun 29, 2009 73  /// Defines a mapping type from DOF indices to boolean values.  Thomas Witkowski committed Jan 07, 2011 74  typedef map DofIndexToBool;  Thomas Witkowski committed Jun 29, 2009 75   Thomas Witkowski committed Jul 01, 2009 76 77 78  /// Forward type (it maps rank numbers to the interior boundary objects). typedef InteriorBoundary::RankToBoundMap RankToBoundMap;  Thomas Witkowski committed Jan 07, 2011 79  typedef map DofIndexMap;  Thomas Witkowski committed Jul 07, 2009 80   81  /// Mapps a boundar type, i.e., a boundary identifier index, to a periodic  Thomas Witkowski committed Mar 18, 2011 82  /// DOF mapping.  Thomas Witkowski committed Jan 07, 2011 83 84 85  typedef map PeriodicDofMap; typedef vector MeshCodeVec;  Thomas Witkowski committed Oct 14, 2009 86   Thomas Witkowski committed Apr 03, 2009 87  public:  Thomas Witkowski committed Mar 18, 2011 88  MeshDistributor();  Thomas Witkowski committed Jun 08, 2010 89 90  virtual ~MeshDistributor() {}  Thomas Witkowski committed Apr 03, 2009 91   92  void initParallelization();  Thomas Witkowski committed Apr 03, 2009 93   94  void exitParallelization();  Thomas Witkowski committed Jun 08, 2010 95   Thomas Witkowski committed Apr 21, 2011 96  void addProblemStat(ProblemStatSeq *probStat);  Thomas Witkowski committed Jun 26, 2009 97   Thomas Witkowski committed Jan 19, 2011 98 99 100 101 102 103 104  /// Adds a DOFVector to the set of \ref interchangeVecs. Thus, this vector will /// be automatically interchanged between ranks when mesh is repartitioned. void addInterchangeVector(DOFVector *vec) { interchangeVectors.push_back(vec); }  Thomas Witkowski committed Jan 27, 2011 105 106 107 108 109 110 111  /// Adds all DOFVectors of a SystemVector to \ref interchangeVecs. void addInterchangeVector(SystemVector *vec) { for (int i = 0; i < vec->getSize(); i++) interchangeVectors.push_back(vec->getDOFVector(i)); }  Thomas Witkowski committed Jan 29, 2010 112 113 114 115  /** \brief * This function checks if the mesh has changed on at least on rank. In this case, * the interior boundaries are adapted on all ranks such that they fit together on * all ranks. Furthermore the function \ref updateLocalGlobalNumbering() is called  Thomas Witkowski committed Mar 18, 2011 116  * to update the DOF numberings and mappings on all rank due to the new mesh  Thomas Witkowski committed Jan 29, 2010 117  * structure.  118 119 120 121 122  * * \param[in] tryRepartition If this parameter is true, repartitioning may be * done. This depends on several other parameters. If * the parameter is false, the mesh is only checked * and adapted but never repartitioned.  Thomas Witkowski committed Jan 29, 2010 123  */  124  void checkMeshChange(bool tryRepartition = true);  Thomas Witkowski committed Jan 29, 2010 125   Thomas Witkowski committed Jun 26, 2009 126 127 128 129 130 131 132  /** \brief * Test, if the mesh consists of macro elements only. The mesh partitioning of * the parallelization works for macro meshes only and would fail, if the mesh * is already refined in some way. Therefore, this function will exit the program * if it finds a non macro element in the mesh. */ void testForMacroMesh();  Thomas Witkowski committed Apr 03, 2009 133 134  /// Set for each element on the partitioning level the number of leaf elements.  135  void setInitialElementWeights();  Thomas Witkowski committed Apr 03, 2009 136   Thomas Witkowski committed Jan 07, 2011 137  inline virtual string getName()  Thomas Witkowski committed Jun 08, 2010 138 139 140  { return name; }  141   Thomas Witkowski committed Jan 14, 2011 142 143 144 145 146  inline Mesh* getMesh() { return mesh; }  147 148 149 150 151  /// Returns \ref feSpace. inline const FiniteElemSpace* getFeSpace() { return feSpace; }  Thomas Witkowski committed Jun 08, 2010 152 153 154  /// Returns \ref nRankDOFs, the number of DOFs in the rank mesh. inline int getNumberRankDofs()  Thomas Witkowski committed Jul 10, 2009 155  {  Thomas Witkowski committed Jun 08, 2010 156  return nRankDofs;  Thomas Witkowski committed Jul 10, 2009 157  }  Thomas Witkowski committed Apr 03, 2009 158   159  /// Returns \ref nOverallDofs, the global number of DOFs.  Thomas Witkowski committed Jun 08, 2010 160  inline int getNumberOverallDofs()  Thomas Witkowski committed Jul 10, 2009 161  {  Thomas Witkowski committed Jun 08, 2010 162  return nOverallDofs;  Thomas Witkowski committed Jul 10, 2009 163  }  Thomas Witkowski committed Apr 03, 2009 164   Thomas Witkowski committed Jan 14, 2011 165 166 167 168 169  inline DofMapping& getMapLocalGlobalDofs() { return mapLocalGlobalDofs; }  Thomas Witkowski committed Mar 18, 2011 170  /// Maps a local DOF to its global index.  Thomas Witkowski committed Jun 08, 2010 171  inline DegreeOfFreedom mapLocalToGlobal(DegreeOfFreedom dof)  Thomas Witkowski committed Jul 10, 2009 172  {  Thomas Witkowski committed Jun 08, 2010 173  return mapLocalGlobalDofs[dof];  Thomas Witkowski committed Jul 10, 2009 174  }  Thomas Witkowski committed Apr 03, 2009 175   Thomas Witkowski committed Jan 17, 2011 176 177  DegreeOfFreedom mapGlobalToLocal(DegreeOfFreedom dof);  Thomas Witkowski committed Mar 18, 2011 178  /// Maps a local DOF to its local index.  Thomas Witkowski committed Jun 09, 2010 179 180 181 182 183  inline DegreeOfFreedom mapLocalToDofIndex(DegreeOfFreedom dof) { return mapLocalDofIndex[dof]; }  Thomas Witkowski committed Jan 14, 2011 184 185 186 187 188 189  /// Returns the periodic mapping for all boundary DOFs in rank. inline PeriodicDofMap& getPeriodicMapping() { return periodicDof; }  190  /// Returns for a global dof index its periodic mapping for a given boundary type.  Thomas Witkowski committed Jan 17, 2011 191  inline int getPeriodicMapping(int globalDofIndex, BoundaryType type)  Thomas Witkowski committed Jul 10, 2009 192  {  Thomas Witkowski committed Jan 14, 2011 193 194  FUNCNAME("MeshDistributor::getPeriodicMapping()");  Thomas Witkowski committed Jul 08, 2010 195  TEST_EXIT_DBG(periodicDof[type].count(globalDofIndex) == 1)  Thomas Witkowski committed Jan 14, 2011 196 197  ("There is no periodic association for global DOF %d for boundary type %d!\n", globalDofIndex, type);  Thomas Witkowski committed Jul 08, 2010 198 199 200 201  return periodicDof[type][globalDofIndex]; }  202 203 204  /// For a given global DOF index, this function returns the set of periodic /// associations, i.e., the boundary types the DOF is associated to, for this DOF. inline std::set& getPerDofAssociations(int globalDofIndex)  Thomas Witkowski committed Jul 08, 2010 205  {  Thomas Witkowski committed Jan 17, 2011 206 207 208  TEST_EXIT_DBG(periodicDofAssociations.count(globalDofIndex)) ("Should not happen!\n");  209  return periodicDofAssociations[globalDofIndex];  Thomas Witkowski committed Jul 10, 2009 210  }  Thomas Witkowski committed Apr 03, 2009 211   212  /// Returns true, if the DOF (global index) is a periodic DOF.  Thomas Witkowski committed Jul 08, 2010 213  inline bool isPeriodicDof(int globalDofIndex)  Thomas Witkowski committed Jun 10, 2009 214  {  Thomas Witkowski committed Jan 17, 2011 215 216  return (periodicDofAssociations.count(globalDofIndex) > 0 && periodicDofAssociations[globalDofIndex].size() > 0);  Thomas Witkowski committed Jul 08, 2010 217 218  }  219 220 221  /// Returns true, if the DOF (global index) is a periodic DOF for the given /// boundary type. inline bool isPeriodicDof(int globalDofIndex, BoundaryType type)  Thomas Witkowski committed Jul 08, 2010 222 223  { return (periodicDof[type].count(globalDofIndex) > 0);  Thomas Witkowski committed Apr 07, 2009 224 225  }  226 227  /// Return true, if the given DOF is owned by the rank. If false, the DOF is in /// rank's partition, but is owned by some other rank.  Thomas Witkowski committed Jun 08, 2010 228 229  inline bool getIsRankDof(DegreeOfFreedom dof) {  Thomas Witkowski committed Jan 18, 2011 230 231 232 233  if (isRankDof.count(dof)) return isRankDof[dof]; return false;  Thomas Witkowski committed Jun 08, 2010 234  }  Thomas Witkowski committed Dec 08, 2009 235   Thomas Witkowski committed Mar 17, 2011 236 237 238 239 240  inline DofIndexToBool& getIsRankDof() { return isRankDof; }  Thomas Witkowski committed Jun 08, 2010 241  inline long getLastMeshChangeIndex()  Thomas Witkowski committed Jun 10, 2009 242  {  Thomas Witkowski committed Jun 08, 2010 243  return lastMeshChangeIndex;  Thomas Witkowski committed Apr 07, 2009 244  }  Thomas Witkowski committed Apr 03, 2009 245   Thomas Witkowski committed Jun 08, 2010 246 247 248 249  inline int getRstart() { return rstart; }  Thomas Witkowski committed Jul 09, 2009 250   Thomas Witkowski committed Jun 08, 2010 251  inline int getMpiRank()  Thomas Witkowski committed Jun 11, 2009 252  {  Thomas Witkowski committed Jun 08, 2010 253  return mpiRank;  Thomas Witkowski committed Jun 11, 2009 254  }  Thomas Witkowski committed Apr 03, 2009 255   Thomas Witkowski committed Jan 14, 2011 256 257 258 259 260  inline int getMpiSize() { return mpiSize; }  Thomas Witkowski committed Jun 08, 2010 261 262 263  inline MPI::Intracomm& getMpiComm() { return mpiComm;  Thomas Witkowski committed Apr 03, 2009 264 265  }  Thomas Witkowski committed Jun 08, 2010 266  inline RankToDofContainer& getSendDofs()  Thomas Witkowski committed Jun 10, 2009 267  {  Thomas Witkowski committed Jun 08, 2010 268  return sendDofs;  Thomas Witkowski committed Apr 07, 2009 269 270  }  Thomas Witkowski committed Jun 08, 2010 271  inline RankToDofContainer& getRecvDofs()  Thomas Witkowski committed Jun 11, 2009 272  {  Thomas Witkowski committed Jun 08, 2010 273  return recvDofs;  Thomas Witkowski committed Jun 11, 2009 274  }  275   Thomas Witkowski committed Sep 28, 2009 276  // Writes all data of this object to an output stream.  Thomas Witkowski committed Jan 07, 2011 277  void serialize(ostream &out);  Thomas Witkowski committed Jun 11, 2009 278   Thomas Witkowski committed Sep 28, 2009 279  // Reads the object data from an input stream.  Thomas Witkowski committed Jan 07, 2011 280  void deserialize(istream &in);  Thomas Witkowski committed Jun 08, 2010 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300  /** \brief * This function must be used if the values of a DOFVector must be synchronised * over all ranks. That means, that each rank sends the values of the DOFs, which * are owned by the rank and lie on an interior bounday, to all other ranks also * having these DOFs. * * This function must be used, for example, after the lineary system is solved, or * after the DOFVector is set by some user defined functions, e.g., initial * solution functions. */ void synchVector(DOFVector &vec); /** \brief * Works in the same way as the function above defined for DOFVectors. Due to * performance, this function does not call \ref synchVector for each DOFVector, * but instead sends all values of all DOFVectors all at once. */ void synchVector(SystemVector &vec);  Thomas Witkowski committed Jan 20, 2011 301 302  void check3dValidMesh();  Thomas Witkowski committed Apr 08, 2011 303 304 305 306 307  void setBoundaryDofRequirement(Flag flag) { createBoundaryDofFlag = flag; }  Thomas Witkowski committed Apr 08, 2011 308 309 310 311 312  BoundaryDofInfo& getBoundaryDofInfo() { return boundaryDofInfo; }  Thomas Witkowski committed Jun 11, 2009 313  protected:  Thomas Witkowski committed Jun 11, 2009 314  /** \brief  Thomas Witkowski committed Jan 26, 2010 315  * Determines the interior boundaries, i.e. boundaries between ranks, and stores  Thomas Witkowski committed Jun 11, 2009 316 317  * all information about them in \ref interiorBoundary. */  Thomas Witkowski committed Oct 19, 2009 318  void createInteriorBoundaryInfo();  Thomas Witkowski committed Jun 11, 2009 319   Thomas Witkowski committed Nov 29, 2010 320 321 322 323 324  void updateInteriorBoundaryInfo(); void createMeshElementData(); void createBoundaryData();  Thomas Witkowski committed Jan 26, 2010 325   Thomas Witkowski committed Apr 08, 2011 326 327  void createBoundaryDofs();  Thomas Witkowski committed Jun 11, 2009 328 329 330  /// Removes all macro elements from the mesh that are not part of ranks partition. void removeMacroElements();  331  /// Updates the local and global DOF numbering after the mesh has been changed.  Thomas Witkowski committed Nov 30, 2010 332  void updateLocalGlobalNumbering();  Thomas Witkowski committed Jun 11, 2009 333   334 335 336 337 338  /** \brief * Creates to all dofs in rank's partition that are on a periodic boundary the * mapping from dof index to the other periodic dof indices. This information * is stored in \ref periodicDof. */  Thomas Witkowski committed Oct 14, 2009 339 340  void createPeriodicMap();  Thomas Witkowski committed Nov 25, 2010 341 342  void createMacroElementInfo();  343 344  void updateMacroElementInfo();  Thomas Witkowski committed Jan 19, 2010 345 346 347 348 349 350 351 352 353  /** \brief * Checks for all given interior boundaries if the elements fit together on both * sides of the boundaries. If this is not the case, the mesh is adapted. Because * refinement of a certain element may forces the refinement of other elements, * it is not guaranteed that all rank's meshes fit together after this function * terminates. Hence, it must be called until a stable mesh refinement is reached. * * \param[in] allBound Defines a map from rank to interior boundaries which * should be checked.  354 355 356 357  * * \return If the mesh has been changed by this function, it returns true. * Otherwise, it returns false, i.e., the given interior boundaries * fit together on both sides.  Thomas Witkowski committed Jan 19, 2010 358 359  */ bool checkAndAdaptBoundary(RankToBoundMap &allBound);  Thomas Witkowski committed Nov 26, 2010 360 361 362 363 364 365 366 367  /** \brief * Checks if is required to repartition the mesh. If this is the case, a new * partition will be created and the mesh will be redistributed between the * ranks. */ void repartitionMesh();  Thomas Witkowski committed Mar 28, 2011 368 369  /// Sets \ref isRankDof to all matrices and rhs vectors in a given /// stationary problem.  Thomas Witkowski committed Apr 21, 2011 370  void setRankDofs(ProblemStatSeq *probStat);  Thomas Witkowski committed Mar 28, 2011 371   Thomas Witkowski committed Jul 18, 2010 372 373 374  /// Sets \ref isRankDof to all matrices and rhs vectors in all stationary problems. void setRankDofs();  Thomas Witkowski committed Jun 29, 2010 375 376 377 378  /// Removes all periodic boundary condition information from all matrices and /// vectors of all stationary problems and from the mesh itself. void removePeriodicBoundaryConditions();  Thomas Witkowski committed Feb 08, 2010 379  // Removes all periodic boundaries from a given boundary map.  Thomas Witkowski committed Jun 29, 2010 380  void removePeriodicBoundaryConditions(BoundaryIndexMap& boundaryMap);  Thomas Witkowski committed Feb 08, 2010 381   Thomas Witkowski committed Sep 28, 2009 382  /// Writes a vector of dof pointers to an output stream.  Thomas Witkowski committed Jan 07, 2011 383  void serialize(ostream &out, DofContainer &data);  Thomas Witkowski committed Sep 28, 2009 384 385  /// Reads a vector of dof pointers from an input stream.  Thomas Witkowski committed Jan 07, 2011 386 387  void deserialize(istream &in, DofContainer &data, map &dofMap);  Thomas Witkowski committed Sep 28, 2009 388 389  /// Writes a \ref RankToDofContainer to an output stream.  Thomas Witkowski committed Jan 07, 2011 390  void serialize(ostream &out, RankToDofContainer &data);  Thomas Witkowski committed Sep 28, 2009 391 392  /// Reads a \ref RankToDofContainer from an input stream.  Thomas Witkowski committed Jan 07, 2011 393 394  void deserialize(istream &in, RankToDofContainer &data, map &dofMap);  Thomas Witkowski committed Sep 29, 2009 395   Thomas Witkowski committed Oct 26, 2009 396  /// Writes a periodic dof mapping to an output stream.  Thomas Witkowski committed Jan 07, 2011 397  void serialize(ostream &out, PeriodicDofMap &data);  Thomas Witkowski committed Oct 26, 2009 398   Thomas Witkowski committed Jan 07, 2011 399  void serialize(ostream &out, map >& data);  Thomas Witkowski committed Jul 08, 2010 400   Thomas Witkowski committed Oct 26, 2009 401  /// Reads a periodic dof mapping from an input stream.  Thomas Witkowski committed Jan 07, 2011 402  void deserialize(istream &in, PeriodicDofMap &data);  Thomas Witkowski committed Oct 26, 2009 403   Thomas Witkowski committed Jan 07, 2011 404  void deserialize(istream &in, map >& data);  Thomas Witkowski committed Jul 08, 2010 405   Thomas Witkowski committed Sep 29, 2009 406 407  /// Writes a mapping from dof pointers to some values to an output stream. template  Thomas Witkowski committed Jan 07, 2011 408  void serialize(ostream &out, map &data)  Thomas Witkowski committed Sep 29, 2009 409  {  410 411  FUNCNAME("ParallelDomainBase::serialize()");  Thomas Witkowski committed Sep 29, 2009 412  int mapSize = data.size();  413  SerUtil::serialize(out, mapSize);  Thomas Witkowski committed Jan 07, 2011 414  for (typename map::iterator it = data.begin();  Thomas Witkowski committed Sep 29, 2009 415 416 417  it != data.end(); ++it) { int v1 = (*(it->first)); T v2 = it->second;  418 419  SerUtil::serialize(out, v1); SerUtil::serialize(out, v2);  Thomas Witkowski committed Sep 29, 2009 420 421 422 423 424  } } /// Reads a mapping from dof pointer to some values from an input stream. template  Thomas Witkowski committed Jan 07, 2011 425 426  void deserialize(istream &in, map &data, map &dofMap)  Thomas Witkowski committed Sep 29, 2009 427  {  Thomas Witkowski committed Oct 02, 2009 428 429  FUNCNAME("ParallelDomainBase::deserialize()");  Thomas Witkowski committed Sep 29, 2009 430  int mapSize = 0;  431  SerUtil::deserialize(in, mapSize);  Thomas Witkowski committed Sep 29, 2009 432 433 434  for (int i = 0; i < mapSize; i++) { int v1 = 0; T v2;  435 436  SerUtil::deserialize(in, v1); SerUtil::deserialize(in, v2);  Thomas Witkowski committed Oct 02, 2009 437 438 439  TEST_EXIT_DBG(dofMap.count(v1) != 0)("Cannot find DOF %d in map!\n", v1);  Thomas Witkowski committed Sep 29, 2009 440 441 442  data[dofMap[v1]] = v2; } }  Thomas Witkowski committed Nov 30, 2010 443   Thomas Witkowski committed Apr 03, 2009 444  protected:  Thomas Witkowski committed Mar 28, 2011 445  /// List of all stationary problems that are managed by this mesh distributor.  Thomas Witkowski committed Apr 21, 2011 446  vector problemStat;  Thomas Witkowski committed Feb 08, 2010 447   Thomas Witkowski committed Mar 28, 2011 448 449 450  /// If true, the mesh distributor is already initialized; bool initialized;  Thomas Witkowski committed Apr 03, 2009 451 452 453 454 455 456 457 458 459 460 461 462 463 464  /// The rank of the current process. int mpiRank; /// Overall number of processes. int mpiSize; /** \brief * MPI communicator collected all processes, which should * be used for calculation. The Debug procces is not included * in this communicator. */ MPI::Intracomm mpiComm; /// Name of the problem (as used in the init files)  Thomas Witkowski committed Jan 07, 2011 465  string name;  Thomas Witkowski committed Apr 03, 2009 466   Thomas Witkowski committed Apr 15, 2009 467 468 469  /// Finite element space of the problem. FiniteElemSpace *feSpace;  Thomas Witkowski committed Apr 03, 2009 470 471 472  /// Mesh of the problem. Mesh *mesh;  473 474 475 476 477 478 479  /** \brief * A refinement manager that should be used on the mesh. It is used to refine * elements at interior boundaries in order to fit together with elements on the * other side of the interior boundary. */ RefinementManager *refineManager;  Thomas Witkowski committed Jun 26, 2009 480 481 482  /// Info level. int info;  Thomas Witkowski committed Jan 24, 2011 483 484  /// Pointer to a mesh partitioner that is used to partition the mesh to the ranks. MeshPartitioner *partitioner;  Thomas Witkowski committed Apr 03, 2009 485 486  /// Weights for the elements, i.e., the number of leaf elements within this element.  Thomas Witkowski committed Jan 07, 2011 487  map elemWeights;  Thomas Witkowski committed Apr 03, 2009 488 489  /** \brief  490 491  * Stores to every macro element index the number of the rank that owns this * macro element.  Thomas Witkowski committed Apr 03, 2009 492  */  Thomas Witkowski committed Jan 24, 2011 493  map partitionMap;  Thomas Witkowski committed Apr 03, 2009 494   Thomas Witkowski committed Apr 07, 2009 495  /// Number of DOFs in the rank mesh.  Thomas Witkowski committed Sep 25, 2009 496  int nRankDofs;  Thomas Witkowski committed Apr 27, 2009 497   498  /// Number of DOFs in the whole domain.  Thomas Witkowski committed Jun 08, 2010 499 500  int nOverallDofs;  Thomas Witkowski committed Nov 29, 2010 501 502 503 504  // Data structure to store all sub-objects of all elements of the macro mesh. ElementObjects elObjects; // Maps to each macro element index a pointer to the corresponding element.  Thomas Witkowski committed Jan 07, 2011 505  map macroElIndexMap;  Thomas Witkowski committed Nov 29, 2010 506 507  // Maps to each macro element index the type of this element.  Thomas Witkowski committed Jan 07, 2011 508  map macroElIndexTypeMap;  Thomas Witkowski committed Nov 29, 2010 509   Thomas Witkowski committed Apr 27, 2009 510  /** \brief  Thomas Witkowski committed Jun 15, 2009 511 512 513 514 515 516 517 518 519 520 521 522  * Defines the interior boundaries of the domain that result from partitioning * the whole mesh. Contains only the boundaries, which are owned by the rank, i.e., * the object gives for every neighbour rank i the boundaries this rank owns and * shares with rank i. */ InteriorBoundary myIntBoundary; /** \brief * Defines the interior boundaries of the domain that result from partitioning * the whole mesh. Contains only the boundaries, which are not owned by the rank, * i.e., the object gives for every neighbour rank i the boundaries that are * owned by rank i and are shared with this rank.  Thomas Witkowski committed Apr 27, 2009 523  */  Thomas Witkowski committed Jun 15, 2009 524  InteriorBoundary otherIntBoundary;  Thomas Witkowski committed Apr 27, 2009 525   Thomas Witkowski committed Oct 14, 2009 526  /** \brief  527 528  * Defines the periodic boundaries with other ranks. Periodic boundaries have * no owner, as it is the case of interior boundaries.  Thomas Witkowski committed Oct 14, 2009 529 530 531  */ InteriorBoundary periodicBoundary;  Thomas Witkowski committed Jun 10, 2009 532  /** \brief  Thomas Witkowski committed Mar 17, 2011 533 534  * This map contains for each rank the list of DOFs the current rank must send * to exchange solution DOFs at the interior boundaries.  Thomas Witkowski committed Jun 10, 2009 535  */  Thomas Witkowski committed Jun 29, 2009 536  RankToDofContainer sendDofs;  Thomas Witkowski committed Jun 10, 2009 537 538  /** \brief  Thomas Witkowski committed Mar 17, 2011 539  * This map contains on each rank the list of DOFs from which the current rank  Thomas Witkowski committed Jan 19, 2010 540 541  * will receive DOF values (i.e., this are all DOFs at an interior boundary). The * DOF indices are given in rank's local numbering.  Thomas Witkowski committed Jun 10, 2009 542  */  Thomas Witkowski committed Jun 29, 2009 543  RankToDofContainer recvDofs;  Thomas Witkowski committed Jun 11, 2009 544 545  /// Maps local to global dof indices.  Thomas Witkowski committed Jan 19, 2010 546  DofMapping mapLocalGlobalDofs;  Thomas Witkowski committed Jun 11, 2009 547   Thomas Witkowski committed Jul 20, 2009 548  /// Maps local dof indices to real dof indices.  Thomas Witkowski committed Jun 09, 2010 549  DofMapping mapLocalDofIndex;  Thomas Witkowski committed Jun 11, 2009 550 551 552 553 554 555  /** \brief * Maps all DOFs in ranks partition to a bool value. If it is true, the DOF is * owned by the rank. Otherwise, its an interior boundary DOF that is owned by * another rank. */  Thomas Witkowski committed Aug 13, 2009 556 557  DofIndexToBool isRankDof;  558  /** \brief  559 560 561 562  * If periodic boundaries are used, this map stores, for each periodic boundary * type, for all DOFs in rank's partition (that are on periodic boundaries), the * corresponding mapped periodic DOFs. The mapping is defined by using global * dof indices.  563  */  Thomas Witkowski committed Oct 14, 2009 564  PeriodicDofMap periodicDof;  565 566 567 568 569  /** \brief * If periodic boundaries are used, this map stores to each periodic DOF in rank's * partition the set of periodic boundaries the DOF is associated to. In 2D, most * DOFs are only on one periodic boundary. Only, e.g., in a box with all boundaries  Thomas Witkowski committed Jan 18, 2011 570  * being periodic, the four corners are associated by two different boundaries.  571  */  Thomas Witkowski committed Jan 07, 2011 572  map > periodicDofAssociations;  Thomas Witkowski committed Jul 08, 2010 573   Thomas Witkowski committed Jan 19, 2011 574 575 576 577 578  /// This set of values must be interchanged between ranks when the mesh is /// repartitioned. vector*> interchangeVectors;  Thomas Witkowski committed Sep 25, 2009 579  /// Is the index of the first row of the linear system, which is owned by the rank.  Thomas Witkowski committed Jul 03, 2009 580  int rstart;  Thomas Witkowski committed Jul 09, 2009 581   582 583 584 585 586 587 588  /** \brief * If the problem definition has been read from a serialization file, this * variable is true, otherwise it is false. This variable is used to stop the * initialization function, if the problem definition has already been read from * a serialization file. */ bool deserialized;  Thomas Witkowski committed Dec 08, 2009 589   590 591 592  /// Denotes whether there exists a filewriter for this object. bool writeSerializationFile;  Thomas Witkowski committed Nov 26, 2010 593 594 595  /// If true, it is possible to repartition the mesh during computations. bool repartitioningAllowed;  596  /// Stores the number of mesh changes that must lie in between to repartitionings.  Thomas Witkowski committed Dec 20, 2010 597 598  int repartitionIthChange;  599 600  /// Counts the number of mesh changes after the last mesh repartitioning was done. int nMeshChangesAfterLastRepartitioning;  Thomas Witkowski committed Dec 03, 2010 601   602 603 604  /// Countes the number of mesh repartitions that were done. Till now, this /// variable is used only for debug outputs. int repartitioningCounter;  Thomas Witkowski committed Dec 03, 2010 605   Thomas Witkowski committed Dec 16, 2010 606  /// Directory name where all debug output files should be written to.  Thomas Witkowski committed Jan 07, 2011 607  string debugOutputDir;  Thomas Witkowski committed Dec 16, 2010 608   Thomas Witkowski committed Dec 08, 2009 609 610 611 612 613  /** \brief * Stores the mesh change index. This is used to recognize changes in the mesh * structure (e.g. through refinement or coarsening managers). */ long lastMeshChangeIndex;  614   Thomas Witkowski committed Jan 07, 2011 615  map > macroElementNeighbours;  Thomas Witkowski committed Nov 25, 2010 616   617 618  /// Store all macro elements of the overall mesh, i.e., before the macro mesh is /// redistributed for the first time.  Thomas Witkowski committed Jan 07, 2011 619  vector allMacroElements;  620   Thomas Witkowski committed Apr 08, 2011 621 622 623 624 625 626 627 628 629  Flag createBoundaryDofFlag; BoundaryDofInfo boundaryDofInfo; public: /// static const Flag BOUNDARY_SUBOBJ_SORTED; static const Flag BOUNDARY_EDGE_SCHUR;  630  friend class ParallelDebug;  Thomas Witkowski committed Apr 03, 2009 631 632 633  }; }  634 #endif // AMDIS_MESHDISTRIBUTOR_H