ParallelDofMapping.h 15.4 KB
 Thomas Witkowski committed Feb 06, 2012 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 // ============================================================================ // == == // == AMDiS - Adaptive multidimensional simulations == // == == // == http://www.amdis-fem.org == // == == // ============================================================================ // // 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. /** \file FeSpaceMapping.h */  Thomas Witkowski committed Feb 14, 2012 23 #include  Thomas Witkowski committed Feb 06, 2012 24 #include  Thomas Witkowski committed Mar 06, 2012 25 26 #include #include "parallel/DofComm.h"  Thomas Witkowski committed Apr 23, 2012 27 #include "parallel/MeshLevelData.h"  Thomas Witkowski committed Feb 06, 2012 28 29 #include "parallel/MpiHelper.h" #include "parallel/ParallelTypes.h"  Thomas Witkowski committed Mar 13, 2012 30 #include "parallel/StdMpi.h"  Thomas Witkowski committed Feb 06, 2012 31   Thomas Witkowski committed Jun 14, 2012 32 33 #include  Thomas Witkowski committed Feb 06, 2012 34 35 36 37 #ifndef AMDIS_FE_SPACE_MAPPING_H #define AMDIS_FE_SPACE_MAPPING_H namespace AMDiS {  Thomas Witkowski committed Apr 20, 2012 38   Thomas Witkowski committed Feb 06, 2012 39 40  using namespace std;  Thomas Witkowski committed Mar 13, 2012 41  /** \brief  Thomas Witkowski committed Mar 22, 2012 42 43 44  * Is used to store matrix indices to all DOFs in rank's subdomain. Thus, the * class defines a mapping from component number and DOF index to a global * matrix index. This class does not calculate the indices by itself!  Thomas Witkowski committed Mar 13, 2012 45 46 47 48 49 50 51 52 53 54 55 56  */ class DofToMatIndex { public: DofToMatIndex() {} /// Reset the data structure. inline void clear() { data.clear(); }  Thomas Witkowski committed Mar 22, 2012 57 58 59 60 61 62 63  /** Add a new mapping for a given DOF. * * \param[in] component Component number for which the mapping * is defined. * \param[in] dof DOF index * \param[in] globalMatIndex Global matrix index. */  Thomas Witkowski committed Mar 13, 2012 64 65 66 67 68  inline void add(int component, DegreeOfFreedom dof, int globalMatIndex) { data[component][dof] = globalMatIndex; }  Thomas Witkowski committed Mar 22, 2012 69  /// Maps a global DOF index to the global matrix index for a specific  Thomas Witkowski committed Mar 13, 2012 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84  /// system component number. inline int get(int component, DegreeOfFreedom dof) { FUNCNAME("DofToMatIndex::get()"); TEST_EXIT_DBG(data.count(component)) ("No mapping data for component %d available!\n", component); TEST_EXIT_DBG(data[component].count(dof)) ("Mapping for DOF %d in component %d does not exists!\n", dof, component); return data[component][dof]; }  Thomas Witkowski committed Jun 07, 2012 85 86 87 88 89  /// Returns for a given matrix index the component and (local or global) DOF /// index. As the data structure is not made for this kind of reverse /// search, this is very slow and should be only used for debugging. void getReverse(int rowIndex, int &component, int &dofIndex);  Thomas Witkowski committed Mar 13, 2012 90 91 92 93 94 95 96  private: /// The mapping data. For each system component there is a specific map that /// maps global DOF indices to global matrix indices. map > data; };  Thomas Witkowski committed Mar 22, 2012 97 98 99 100 101 102  /** * This class defines the parallel mapping of DOFs for one FE space. It is used * by the class \ref ParallelDofMapping to specifiy the mapping for a set of * FE spaces. */ class FeSpaceDofMap  Thomas Witkowski committed Feb 06, 2012 103 104  { public:  Thomas Witkowski committed Feb 16, 2012 105 106  /// This constructor exists only to create std::map of this class and make /// use of the operator [] for read access. Should never be called.  Thomas Witkowski committed Mar 22, 2012 107  FeSpaceDofMap()  Thomas Witkowski committed Feb 16, 2012 108 109 110  { ERROR_EXIT("Should not be called!\n"); }  Thomas Witkowski committed Mar 22, 2012 111 112  /// This is the only valid constructur to be used.  Thomas Witkowski committed Apr 23, 2012 113 114  FeSpaceDofMap(MeshLevelData* ld) : levelData(ld),  Thomas Witkowski committed Apr 30, 2012 115  dofComm(NULL),  Thomas Witkowski committed Mar 13, 2012 116  feSpace(NULL),  Thomas Witkowski committed Mar 09, 2012 117  needGlobalMapping(false),  Thomas Witkowski committed May 02, 2012 118  hasNonLocalDofs(false)  Thomas Witkowski committed Apr 23, 2012 119 120 121  { clear(); }  Thomas Witkowski committed Mar 22, 2012 122 123  /// Clears all data of the mapping.  Thomas Witkowski committed Feb 14, 2012 124  void clear();  Thomas Witkowski committed Apr 27, 2012 125   Thomas Witkowski committed Mar 22, 2012 126 127  /// Maps a DOF index to both, the local and global index of the mapping. The /// global index must not be set.  Thomas Witkowski committed Mar 09, 2012 128  MultiIndex& operator[](DegreeOfFreedom d)  Thomas Witkowski committed Feb 06, 2012 129  {  Thomas Witkowski committed May 30, 2012 130  TEST_EXIT_DBG(dofMap.count(d))("DOF %d is not in map!\n", d);  Thomas Witkowski committed Feb 06, 2012 131   Thomas Witkowski committed May 04, 2012 132  return dofMap[d];  Thomas Witkowski committed Feb 06, 2012 133  }  Thomas Witkowski committed Jun 26, 2012 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152  /** \brief * Searchs the map for a given DOF. It does not fail, if the DOF is not * mapped by this mapping. In this case, it returns false. If the DOF is * mapped, the result is stored and the function returns true. * * \param[in] dof DOF index for which a mapping is searched. * \param[out] index In the case that the DOF is mapped, the result * is stored here. */ inline bool find(DegreeOfFreedom dof, MultiIndex& index) { DofMap::iterator it = dofMap.find(dof); if (it == dofMap.end()) return false; index = it->second; return true; }  Thomas Witkowski committed Feb 06, 2012 153   Thomas Witkowski committed Mar 22, 2012 154 155  /// Inserts a new DOF to rank's mapping. The DOF is assumed to be owend by /// the rank.  Thomas Witkowski committed May 04, 2012 156  void insertRankDof(DegreeOfFreedom dof0, DegreeOfFreedom dof1 = -1)  Thomas Witkowski committed Feb 06, 2012 157  {  Thomas Witkowski committed Mar 22, 2012 158  FUNCNAME("FeSpaceDofMap::insertRankDof()");  Thomas Witkowski committed Feb 06, 2012 159   Thomas Witkowski committed May 04, 2012 160  TEST_EXIT_DBG(dofMap.count(dof0) == 0)("Should not happen!\n");  Thomas Witkowski committed Feb 06, 2012 161   Thomas Witkowski committed May 04, 2012 162 163  dofMap[dof0].local = dof1; nLocalDofs++;  Thomas Witkowski committed Mar 09, 2012 164  if (dof1 != -1)  Thomas Witkowski committed May 04, 2012 165  nRankDofs++;  Thomas Witkowski committed Feb 06, 2012 166 167  }  Thomas Witkowski committed Mar 22, 2012 168 169  /// Inserts a new DOF to rank's mapping. The DOF exists in rank's subdomain /// but is owned by a different rank, thus it is part of an interior boundary.  Thomas Witkowski committed May 04, 2012 170  void insertNonRankDof(DegreeOfFreedom dof0, DegreeOfFreedom dof1 = -1)  Thomas Witkowski committed Feb 06, 2012 171  {  Thomas Witkowski committed Apr 23, 2012 172  FUNCNAME("FeSpaceDofMap::insertNonRankDof()");  Thomas Witkowski committed Feb 06, 2012 173   Thomas Witkowski committed May 04, 2012 174  TEST_EXIT_DBG(dofMap.count(dof0) == 0)("Should not happen!\n");  Thomas Witkowski committed Feb 06, 2012 175   Thomas Witkowski committed May 04, 2012 176 177 178  dofMap[dof0].local = dof1; nLocalDofs++; nonRankDofs.insert(dof0);  Thomas Witkowski committed Feb 06, 2012 179 180  }  Thomas Witkowski committed Mar 22, 2012 181  /// Checks if a given DOF is in the DOF mapping.  Thomas Witkowski committed May 04, 2012 182  bool isSet(DegreeOfFreedom dof)  Thomas Witkowski committed Feb 06, 2012 183  {  Thomas Witkowski committed May 04, 2012 184  return static_cast(dofMap.count(dof));  Thomas Witkowski committed Feb 06, 2012 185  }  Thomas Witkowski committed Mar 13, 2012 186   Thomas Witkowski committed Aug 16, 2012 187 188 189  /// Checks if a given DOF is a rank owned DOF of the DOF mapping. The DOF /// must be a DOF of the mapping (this is not checked here), otherwise the /// result is meaningsless.  Thomas Witkowski committed May 04, 2012 190  bool isRankDof(DegreeOfFreedom dof)  Thomas Witkowski committed Mar 13, 2012 191  {  Thomas Witkowski committed May 04, 2012 192  return !(static_cast(nonRankDofs.count(dof)));  Thomas Witkowski committed Mar 13, 2012 193  }  Thomas Witkowski committed Aug 16, 2012 194 195 196 197 198  bool isRankGlobalDof(int dof) { return (dof >= rStartDofs && dof < rStartDofs + nRankDofs); }  Thomas Witkowski committed Feb 06, 2012 199   Thomas Witkowski committed Mar 22, 2012 200  /// Returns number of DOFs in the mapping.  Thomas Witkowski committed May 04, 2012 201  unsigned int size()  Thomas Witkowski committed Feb 06, 2012 202  {  Thomas Witkowski committed May 04, 2012 203  return dofMap.size();  Thomas Witkowski committed Feb 06, 2012 204 205  }  Thomas Witkowski committed Mar 22, 2012 206  /// Returns the raw data of the mapping.  Thomas Witkowski committed May 04, 2012 207  DofMap& getMap()  Thomas Witkowski committed Feb 06, 2012 208  {  Thomas Witkowski committed May 04, 2012 209  return dofMap;  Thomas Witkowski committed Feb 06, 2012 210  }  Thomas Witkowski committed Mar 06, 2012 211   Thomas Witkowski committed Jun 27, 2012 212 213 214 215 216 217 218 219 220 221  DofMap::iterator begin() { return dofMap.begin(); } DofMap::iterator end() { return dofMap.end(); }  Thomas Witkowski committed Mar 22, 2012 222 223  /// Recomputes the mapping. void update();  Thomas Witkowski committed Mar 06, 2012 224   Thomas Witkowski committed Mar 22, 2012 225  /// Sets the FE space this mapping corresponds to.  Thomas Witkowski committed Mar 06, 2012 226 227 228 229 230  void setFeSpace(const FiniteElemSpace *fe) { feSpace = fe; }  Thomas Witkowski committed Mar 22, 2012 231 232  /// Informs the mapping whether the mapping will include DOFs that are not /// owned by the rank.  Thomas Witkowski committed Mar 14, 2012 233  void setNonLocalDofs(bool b)  Thomas Witkowski committed Mar 06, 2012 234  {  Thomas Witkowski committed Mar 14, 2012 235  hasNonLocalDofs = b;  Thomas Witkowski committed Mar 06, 2012 236 237  }  Thomas Witkowski committed Mar 22, 2012 238  /// Informs the mapping whether a global index must be computed.  Thomas Witkowski committed Mar 13, 2012 239  void setNeedGlobalMapping(bool b)  Thomas Witkowski committed Mar 06, 2012 240  {  Thomas Witkowski committed Mar 13, 2012 241  needGlobalMapping = b;  Thomas Witkowski committed Mar 06, 2012 242 243  }  Thomas Witkowski committed Jun 27, 2012 244  /// Sets the DOF communicator.  Thomas Witkowski committed Apr 30, 2012 245  void setDofComm(DofComm &dc)  Thomas Witkowski committed Mar 09, 2012 246  {  Thomas Witkowski committed Apr 30, 2012 247  dofComm = &dc;  Thomas Witkowski committed Mar 09, 2012 248 249  }  Thomas Witkowski committed May 04, 2012 250 251 252 253 254 255  void setMpiComm(MPI::Intracomm &m, int l) { mpiComm = m; meshLevel = l; }  Thomas Witkowski committed Feb 06, 2012 256  private:  Thomas Witkowski committed Mar 22, 2012 257  /// Computes a global mapping from the local one.  Thomas Witkowski committed May 04, 2012 258  void computeGlobalMapping();  Thomas Witkowski committed Mar 22, 2012 259 260 261  /// Computes the global indices of all DOFs in the mapping that are not owned /// by the rank.  Thomas Witkowski committed May 04, 2012 262  void computeNonLocalIndices();  Thomas Witkowski committed Mar 22, 2012 263 264  private:  Thomas Witkowski committed Apr 23, 2012 265  MeshLevelData *levelData;  Thomas Witkowski committed Mar 06, 2012 266   Thomas Witkowski committed Apr 30, 2012 267 268  /// DOF communicator for all DOFs on interior boundaries. DofComm *dofComm;  Thomas Witkowski committed Mar 13, 2012 269   Thomas Witkowski committed May 04, 2012 270 271 272 273  MPI::Intracomm mpiComm; int meshLevel;  Thomas Witkowski committed Mar 22, 2012 274  /// The FE space this mapping belongs to. This is used only the get the  Thomas Witkowski committed Apr 30, 2012 275  /// correct DOF communicator in \ref dofComm.  Thomas Witkowski committed Mar 06, 2012 276 277  const FiniteElemSpace *feSpace;  Thomas Witkowski committed Mar 22, 2012 278  /// Mapping data from DOF indices to local and global indices.  Thomas Witkowski committed May 04, 2012 279  DofMap dofMap;  Thomas Witkowski committed Feb 06, 2012 280   Thomas Witkowski committed Mar 22, 2012 281  /// Set of all DOFs that are in mapping but are not owned by the rank.  Thomas Witkowski committed May 04, 2012 282  std::set nonRankDofs;  Thomas Witkowski committed Mar 06, 2012 283   Thomas Witkowski committed Mar 22, 2012 284  /// If true, a global index mapping will be computed for all DOFs.  Thomas Witkowski committed Mar 09, 2012 285  bool needGlobalMapping;  Thomas Witkowski committed Mar 06, 2012 286   Thomas Witkowski committed Mar 14, 2012 287 288 289 290  /// Is true if there are DOFs in at least one subdomain that are not owned /// by the rank. If the value is false, each rank contains only DOFs that /// are also owned by this rank. bool hasNonLocalDofs;  Thomas Witkowski committed Apr 23, 2012 291   Thomas Witkowski committed Mar 22, 2012 292 293  public: ///  Thomas Witkowski committed May 04, 2012 294  int nRankDofs, nLocalDofs, nOverallDofs, rStartDofs;  Thomas Witkowski committed Feb 06, 2012 295 296  };  Thomas Witkowski committed Mar 22, 2012 297 298 299 300 301 302  /** * Implements the mapping from sets of distributed DOF indices to local and * global indices. The mapping works for a given set of FE spaces. Furthermore, * this class may compute the matrix indices of the set of DOF indices. */  Thomas Witkowski committed Mar 15, 2012 303  class ParallelDofMapping  Thomas Witkowski committed Feb 06, 2012 304 305  { public:  Thomas Witkowski committed Mar 15, 2012 306  ParallelDofMapping()  Thomas Witkowski committed Apr 23, 2012 307  : levelData(NULL),  Thomas Witkowski committed Jun 28, 2012 308  dofComm(NULL),  Thomas Witkowski committed Mar 14, 2012 309  hasNonLocalDofs(false),  Thomas Witkowski committed Apr 20, 2012 310 311  needMatIndex(false), needMatIndexFromGlobal(false),  Thomas Witkowski committed Feb 16, 2012 312  feSpaces(0),  Thomas Witkowski committed Apr 23, 2012 313 314 315 316 317  nRankDofs(1), nLocalDofs(1), nOverallDofs(1), rStartDofs(1) {  Thomas Witkowski committed May 04, 2012 318 319 320 321  nRankDofs = -1; nLocalDofs = -1; nOverallDofs = -1; rStartDofs = -1;  Thomas Witkowski committed Apr 23, 2012 322  }  Thomas Witkowski committed Feb 06, 2012 323   Thomas Witkowski committed Mar 22, 2012 324 325 326 327  /** \brief Initialize the parallel DOF mapping. * * \param[in] m MPI communicator. * \param[in] fe The FE spaces of all components of the  Thomas Witkowski committed Apr 04, 2012 328 329 330 331  * PDE to be solved. * \param[in] uniqueFe Unique list of FE spaces. Thus, two * arbitrary elements of this list are always * different.  Thomas Witkowski committed Mar 22, 2012 332 333 334 335 336  * \param[in] needGlobalMapping If true, the mapping computes also a global * index for the DOFs. * \param[in] bNonLocalDofs If true, at least one rank's mapping con- * taines DOFs that are not owend by the rank. */  Thomas Witkowski committed Apr 23, 2012 337  void init(MeshLevelData& mld,  Thomas Witkowski committed Mar 22, 2012 338  vector &fe,  Thomas Witkowski committed Apr 04, 2012 339  vector &uniqueFe,  Thomas Witkowski committed Mar 22, 2012 340 341  bool needGlobalMapping, bool bNonLocalDofs);  Thomas Witkowski committed May 04, 2012 342 343  void setMpiComm(MPI::Intracomm &m, int l);  Thomas Witkowski committed Mar 28, 2012 344 345 346  /// Clear all data. void clear();  Thomas Witkowski committed Mar 22, 2012 347 348 349  /// Set the DOF communicator objects that are required to exchange information /// about DOFs that are on interior boundaries.  Thomas Witkowski committed Apr 30, 2012 350  void setDofComm(DofComm &dofComm);  Thomas Witkowski committed Mar 22, 2012 351   Thomas Witkowski committed Jun 27, 2012 352 353 354  /// Returns the DOF communicator. DofComm& getDofComm() {  Thomas Witkowski committed Jun 28, 2012 355 356 357  FUNCNAME("ParallelDofMapping::getDofComm()"); TEST_EXIT_DBG(dofComm)("No DOF communicator object defined!\n");  Thomas Witkowski committed Jun 27, 2012 358 359 360 361  return *dofComm; }  Thomas Witkowski committed Apr 23, 2012 362 363 364 365 366 367  void setComputeMatIndex(bool b, bool global = false) { needMatIndex = b; needMatIndexFromGlobal = global; }  Thomas Witkowski committed May 15, 2012 368 369 370 371 372  inline bool isMatIndexFromGlobal() { return needMatIndexFromGlobal; }  Thomas Witkowski committed Mar 22, 2012 373 374  /// Access the DOF mapping for a given FE space. inline FeSpaceDofMap& operator[](const FiniteElemSpace* feSpace)  Thomas Witkowski committed Feb 06, 2012 375  {  Thomas Witkowski committed Mar 15, 2012 376  FUNCNAME("ParallelDofMapping::operator[]()");  Thomas Witkowski committed Feb 06, 2012 377   Thomas Witkowski committed Apr 16, 2012 378 379  TEST_EXIT_DBG(data.count(feSpace)) ("No data for FE space at address %p!\n", feSpace);  Thomas Witkowski committed Feb 06, 2012 380 381 382 383  return data.find(feSpace)->second; }  Thomas Witkowski committed Mar 22, 2012 384  /// Returns \ref nRankDofs, thus the number of DOFs owned by the rank.  Thomas Witkowski committed May 04, 2012 385  inline int getRankDofs()  Thomas Witkowski committed Feb 16, 2012 386  {  Thomas Witkowski committed May 04, 2012 387  TEST_EXIT_DBG(nRankDofs >= 0)("Should not happen!\n");  Thomas Witkowski committed Feb 16, 2012 388   Thomas Witkowski committed May 04, 2012 389  return nRankDofs;  Thomas Witkowski committed Feb 16, 2012 390 391  }  Thomas Witkowski committed Mar 22, 2012 392  /// Returns \ref nLocalDofs, thus the number of DOFs in ranks subdomain.  Thomas Witkowski committed May 04, 2012 393  inline int getLocalDofs()  Thomas Witkowski committed Mar 12, 2012 394  {  Thomas Witkowski committed May 04, 2012 395  TEST_EXIT_DBG(nLocalDofs >= 0)("Should not happen!\n");  Thomas Witkowski committed Mar 12, 2012 396   Thomas Witkowski committed May 04, 2012 397  return nLocalDofs;  Thomas Witkowski committed Mar 12, 2012 398 399  }  Thomas Witkowski committed Mar 22, 2012 400  /// Returns \ref nOverallDofs, thus the number of all DOFs in this mapping.  Thomas Witkowski committed May 04, 2012 401  inline int getOverallDofs()  Thomas Witkowski committed Feb 16, 2012 402  {  Thomas Witkowski committed May 04, 2012 403  TEST_EXIT_DBG(nOverallDofs >= 0)("Should not happen!\n");  Thomas Witkowski committed Feb 16, 2012 404   Thomas Witkowski committed May 04, 2012 405  return nOverallDofs;  Thomas Witkowski committed Feb 16, 2012 406 407  }  Thomas Witkowski committed Mar 22, 2012 408 409  /// Returns \ref rStartDofs, thus the smallest global index of a DOF that is /// owned by the rank.  Thomas Witkowski committed May 04, 2012 410  inline int getStartDofs()  Thomas Witkowski committed Feb 16, 2012 411  {  Thomas Witkowski committed May 04, 2012 412  TEST_EXIT_DBG(rStartDofs >= 0)("Should not happen!\n");  Thomas Witkowski committed Feb 16, 2012 413   Thomas Witkowski committed May 04, 2012 414  return rStartDofs;  Thomas Witkowski committed Feb 16, 2012 415 416  }  Thomas Witkowski committed Mar 22, 2012 417  /// Update the mapping.  Thomas Witkowski committed Mar 15, 2012 418  void update();  Thomas Witkowski committed Mar 13, 2012 419   420 421 422  /// Update the mapping. void update(vector& feSpaces);  Thomas Witkowski committed Mar 22, 2012 423 424  /// Returns the global matrix index of a given DOF for a given /// component number.  Thomas Witkowski committed May 04, 2012 425  inline int getMatIndex(int ithComponent, DegreeOfFreedom d)  Thomas Witkowski committed Mar 13, 2012 426  {  Thomas Witkowski committed May 04, 2012 427  return dofToMatIndex.get(ithComponent, d);  Thomas Witkowski committed Mar 13, 2012 428 429  }  Thomas Witkowski committed Jun 07, 2012 430 431 432 433 434 435 436  /// Returns the component number and local/global DOF index for a given /// matrix row index. Should be used for debugging only! inline void getReverseMatIndex(int index, int &component, int &dofIndex) { dofToMatIndex.getReverse(index, component, dofIndex); }  Thomas Witkowski committed Mar 22, 2012 437 438  /// Returns the local matrix index of a given DOF for a given /// component number.  Thomas Witkowski committed May 04, 2012 439  inline int getLocalMatIndex(int ithComponent, DegreeOfFreedom d)  Thomas Witkowski committed Mar 14, 2012 440  {  Thomas Witkowski committed Mar 15, 2012 441  FUNCNAME("ParallelDofMapping::getLocalMatIndex()");  Thomas Witkowski committed Mar 14, 2012 442   Thomas Witkowski committed May 04, 2012 443  TEST_EXIT_DBG(data[feSpaces[ithComponent]].isRankDof(d))  Thomas Witkowski committed Mar 14, 2012 444 445  ("Should not happen!\n");  Thomas Witkowski committed May 04, 2012 446  return dofToMatIndex.get(ithComponent, d) - rStartDofs;  Thomas Witkowski committed Mar 14, 2012 447 448  }  Thomas Witkowski committed Apr 20, 2012 449 450 451 452 453 454 455 456 457 458 459 460  // Writes all data of this object to an output stream. void serialize(ostream &out) { ERROR_EXIT("MUST BE IMPLEMENTED!\n"); } // Reads the object data from an input stream. void deserialize(istream &in) { ERROR_EXIT("MUST BE IMPLEMENTED!\n"); }  Thomas Witkowski committed Apr 20, 2012 461  /// Compute local and global matrix indices.  Thomas Witkowski committed May 04, 2012 462  void computeMatIndex(bool globalIndex);  Thomas Witkowski committed Apr 20, 2012 463   Thomas Witkowski committed Jun 14, 2012 464 465 466 467  void createIndexSet(IS &is, int firstComponent, int nComponents);  Thomas Witkowski committed Mar 22, 2012 468 469 470 471 472  protected: /// Insert a new FE space DOF mapping for a given FE space. void addFeSpace(const FiniteElemSpace* feSpace); /// Compute \ref nRankDofs.  Thomas Witkowski committed May 04, 2012 473  int computeRankDofs();  Thomas Witkowski committed Mar 22, 2012 474 475  /// Compute \ref nLocalDofs.  Thomas Witkowski committed May 04, 2012 476  int computeLocalDofs();  Thomas Witkowski committed Mar 22, 2012 477 478  /// Compute \ref nOverallDofs.  Thomas Witkowski committed May 04, 2012 479  int computeOverallDofs();  Thomas Witkowski committed Mar 22, 2012 480 481  /// Compute \ref rStartDofs.  Thomas Witkowski committed May 04, 2012 482  int computeStartDofs();  Thomas Witkowski committed Mar 22, 2012 483   Thomas Witkowski committed Feb 06, 2012 484  private:  Thomas Witkowski committed May 04, 2012 485 486 487 488  MPI::Intracomm mpiComm; int meshLevel;  Thomas Witkowski committed Apr 23, 2012 489  MeshLevelData *levelData;  Thomas Witkowski committed Mar 13, 2012 490   Thomas Witkowski committed Apr 30, 2012 491 492  /// DOF communicator for all DOFs on interior boundaries. DofComm *dofComm;  Thomas Witkowski committed Mar 13, 2012 493   Thomas Witkowski committed Mar 14, 2012 494 495 496 497  /// Is true if there are DOFs in at least one subdomain that are not owned /// by the rank. If the value is false, each rank contains only DOFs that /// are also owned by this rank. bool hasNonLocalDofs;  Thomas Witkowski committed Feb 16, 2012 498   Thomas Witkowski committed Apr 20, 2012 499 500 501 502 503 504 505 506  /// If true, matrix indeces for the stored DOFs are computed, see /// \ref computeMatIndex. bool needMatIndex; /// If matrix indices should be computed, this variable defines if the /// mapping from DOF indices to matrix row indices is defined on local /// or global DOF indices. If true, the mapping is to specify and to use /// on global ones, otherwise on local DOF indices.  Thomas Witkowski committed May 15, 2012 507 508 509 510 511  /// In most scenarios the mapping stored on local DOF indices is what we /// want to have. Only when periodic boundary conditions are used together /// with some global matrix approache, the matrix indices must be stored /// also for DOFs that are not part of the local subdomain. Thus, the /// mapping will be stored on global DOF indices.  Thomas Witkowski committed Apr 20, 2012 512 513  bool needMatIndexFromGlobal;  Thomas Witkowski committed Mar 22, 2012 514 515 516 517  /// Maps from FE space pointers to DOF mappings. map data; /// The FE spaces for all components.  Thomas Witkowski committed Feb 16, 2012 518 519  vector feSpaces;  Thomas Witkowski committed Mar 22, 2012 520 521  /// The set of all FE spaces. It uniquly contains all different FE spaces /// from \ref feSpaces.  Thomas Witkowski committed Apr 04, 2012 522  vector feSpacesUnique;  Thomas Witkowski committed Mar 12, 2012 523   Thomas Witkowski committed Mar 22, 2012 524  /// Number of DOFs owned by rank.  Thomas Witkowski committed May 04, 2012 525  int nRankDofs;  Thomas Witkowski committed Mar 22, 2012 526 527  /// Number of DOFs in rank's subdomain.  Thomas Witkowski committed May 04, 2012 528  int nLocalDofs;  Thomas Witkowski committed Mar 22, 2012 529 530  /// Number of global DOFs (this value is thus the same on all ranks).  Thomas Witkowski committed May 04, 2012 531  int nOverallDofs;  Thomas Witkowski committed Mar 22, 2012 532 533  /// Smallest global index of a DOF owned by the rank.  Thomas Witkowski committed May 04, 2012 534  int rStartDofs;  Thomas Witkowski committed Mar 13, 2012 535 536 537  /// Mapping from global DOF indices to global matrix indices under /// consideration of possibly multiple components.  Thomas Witkowski committed May 04, 2012 538  DofToMatIndex dofToMatIndex;  Thomas Witkowski committed Feb 06, 2012 539 540 541 542 543  }; } #endif