ParallelDebug.h 7.69 KB
 Thomas Witkowski committed Feb 09, 2010 1 2 3 4 // ============================================================================ // == == // == AMDiS - Adaptive multidimensional simulations == // == ==  Thomas Witkowski committed Dec 16, 2010 5 // == http://www.amdis-fem.org ==  Thomas Witkowski committed Feb 09, 2010 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 Feb 09, 2010 20   21 /** \file ParallelDebug.h */  Thomas Witkowski committed Feb 09, 2010 22   23 24 #ifndef AMDIS_PARALLELDEBUG_H #define AMDIS_PARALLELDEBUG_H  Thomas Witkowski committed Feb 09, 2010 25   Thomas Witkowski committed Apr 21, 2011 26 #include "parallel/ParallelTypes.h"  27 #include "parallel/MeshDistributor.h"  Thomas Witkowski committed Feb 09, 2010 28 29  namespace AMDiS {  Thomas Witkowski committed May 11, 2012 30 31 32  using namespace std;  33  class ParallelDebug  Thomas Witkowski committed May 21, 2010 34 35  { protected:  Thomas Witkowski committed May 11, 2012 36  typedef vector > CoordsVec;  Thomas Witkowski committed Jan 12, 2011 37 38  /// Defines a mapping type from rank numbers to sets of coordinates.  Thomas Witkowski committed May 11, 2012 39  typedef map RankToCoords;  Thomas Witkowski committed Jan 12, 2011 40   Thomas Witkowski committed Feb 09, 2010 41 42  public: /** \brief  43 44  * Tests the interior and the periodic boundaries on all ranks if their order * fits together.  Thomas Witkowski committed Feb 09, 2010 45 46 47  * * \param[in] pdb Parallel problem definition used for debugging. */  Thomas Witkowski committed Jun 08, 2010 48  static void testInteriorBoundary(MeshDistributor &pdb);  Thomas Witkowski committed Feb 09, 2010 49   Thomas Witkowski committed Jan 06, 2011 50 51 52 53 54 55 56  /** \brief * Test if all periodic boundaries are set in a consistent way on all ranks. * * \param[in] pdb Parallel problem definition used for debugging. */ static void testPeriodicBoundary(MeshDistributor &pdb);  57 58 59 60 61 62 63 64 65  /** \brief * Test if all periodic boundaries are set in a consistent way on all ranks. * * \param[in] pdb Parallel problem definition used for debugging. * \oaram[in] feSpace FE space for which the DOFs are tested. */ static void testPeriodicBoundary(MeshDistributor &pdb, const FiniteElemSpace *feSpace);  Thomas Witkowski committed Feb 09, 2010 66  /** \brief  Thomas Witkowski committed May 02, 2012 67 68 69 70  * This function is used for debugging only. It traverses all interior * boundaries and compares the DOF indices on them with the DOF indices of * the boundarys neighbours. The function fails, when DOF indices on an * interior boundary do not fit together.  Thomas Witkowski committed Feb 09, 2010 71 72  * * \param[in] pdb Parallel problem definition used for debugging.  Thomas Witkowski committed May 02, 2012 73 74  * \param[in] printCoords If true, the coords of all common dofs are * printed to the screen.  Thomas Witkowski committed Feb 09, 2010 75  */  Thomas Witkowski committed Jun 08, 2010 76  static void testCommonDofs(MeshDistributor &pdb, bool printCoords = false);  Thomas Witkowski committed Feb 09, 2010 77   78  /** \brief  Thomas Witkowski committed May 02, 2012 79 80 81 82  * This function is used for debugging only. It checks if on all ranks DOFs * with the same coordinates have the same global index. For this, the * function genartes on all ranks a list of all DOFs with their coordinates * and global indices and sends the list to all neighbouring ranks.  83 84 85 86 87  * * \param[in] pdb Parallel problem definition used for debugging. */ static void testGlobalIndexByCoords(MeshDistributor &pdb);  Thomas Witkowski committed May 11, 2010 88 89 90 91 92  /** \brief * Tests if all elements in the macro mesh are memeber of exactly one rank. * * \param[in] pdb Parallel problem definition used for debugging. */  Thomas Witkowski committed Jun 08, 2010 93  static void testAllElements(MeshDistributor &pdb);  Thomas Witkowski committed May 11, 2010 94   Thomas Witkowski committed May 21, 2010 95 96 97 98 99 100  /** \brief * Tests for all ranks simultaneously, if the number of all send and received * DOFs fits together for all communication partners. * * \param[in] pdb Parallel problem definition used for debugging. */  Thomas Witkowski committed Apr 30, 2012 101  static void testDofContainerCommunication(MeshDistributor &pdb);  Thomas Witkowski committed May 21, 2010 102   Thomas Witkowski committed Dec 20, 2010 103 104 105  /// Tests if there are multiple DOFs in mesh with the same coords. static void testDoubleDofs(Mesh *mesh);  Thomas Witkowski committed Feb 09, 2010 106 107 108 109 110 111 112 113  /** \brief * This function is used for debugging only. It prints all information from * the local to global dof mapping, see \ref mapLocalGlobalDofs. * * \param[in] pdb Parallel problem definition used for debugging. * \param[in] rank If specified, only the information from the given rank * is printed. */  Thomas Witkowski committed Jun 08, 2010 114  static void printMapLocalGlobal(MeshDistributor &pdb, int rank = -1);  Thomas Witkowski committed Feb 09, 2010 115 116 117 118 119 120 121 122 123  /** \brief * This function is used for debugging only. It prints all information about * the periodic mapping of dofs, that are on periodic boundaries. * * \param[in] pdb Parallel problem definition used for debugging. * \param[in] rank If specified, only the information from the given rank * is printed. */  Thomas Witkowski committed Jun 08, 2010 124  static void printMapPeriodic(MeshDistributor &pdb, int rank = -1);  Thomas Witkowski committed Feb 09, 2010 125 126  /** \brief  Thomas Witkowski committed May 02, 2012 127  * This function is used for debugging only. It prints information about DOFs  Thomas Witkowski committed Feb 09, 2010 128 129 130  * in rank's partition. * * \param[in] pdb Parallel problem definition used for debugging.  Thomas Witkowski committed May 02, 2012 131 132 133 134  * \param[in] rank If specified, only the information from the * given rank is printed. * \param[in] rankDofs List of all dofs in ranks partition that are * owned by rank.  Thomas Witkowski committed Feb 09, 2010 135 136  * \param[in] rankAllDofs List of all dofs in ranks partition. */  Thomas Witkowski committed Jun 08, 2010 137  static void printRankDofs(MeshDistributor &pdb,  Thomas Witkowski committed Feb 09, 2010 138 139 140  int rank, DofContainer& rankDofs, DofContainer& rankAllDofs);  Thomas Witkowski committed May 21, 2010 141 142  /** \brief  Thomas Witkowski committed May 02, 2012 143 144  * This functions prints all information about all interior boundaries on * all ranks.  Thomas Witkowski committed May 21, 2010 145  *  Thomas Witkowski committed May 04, 2012 146  * \param[in] intBoundary The boundary object to be printed.  Thomas Witkowski committed May 02, 2012 147 148 149 150 151 152 153  * \param[in] level Mesh level number for which the boundary should * be printed. * \param[in] force If true, the information is always printed to * screen. Otherwise, this is done only if AMDiS * is compiled in debug mode or if the init file * parameter "parallel->debug->print boundary info" * is set.  Thomas Witkowski committed May 21, 2010 154  */  Thomas Witkowski committed May 04, 2012 155  static void printBoundaryInfo(InteriorBoundary &intBoundary,  Thomas Witkowski committed May 02, 2012 156 157  int level = 0, bool force = false);  Thomas Witkowski committed Jun 18, 2010 158   Thomas Witkowski committed May 11, 2012 159 160 161 162 163  static void writeDebugFile(const FiniteElemSpace *feSpace, ParallelDofMapping &dofMap, string prefix, string postfix);  164 165  /** \brief  Thomas Witkowski committed May 02, 2012 166 167  * This functions create a Paraview file with the macro mesh where the * elements are colored by the partition they are part of.  168 169 170 171  */ static void writePartitioning(MeshDistributor &pdb, string filename); /** \brief  Thomas Witkowski committed May 02, 2012 172 173  * The mesh is written to a value and all values are assigned by the rank * number where the vertex is contained in.  174 175  * * \param[in] filename Name of the output file without extension (.vtu).  Thomas Witkowski committed May 02, 2012 176 177  * \param[in] counter Counter index. If not negative, this number is * added to the filename.  178 179  * \param[in] feSpace */  Thomas Witkowski committed May 11, 2012 180  static void writePartitioningFile(string filename,  181  int counter,  182  const FiniteElemSpace *feSpace);  Thomas Witkowski committed Jan 13, 2012 183 184 185 186 187 188 189 190 191  static bool followThisBound(int rankElIndex, int neighElIndex); static void followBoundary(MeshDistributor &pdb); static void followBoundary(Mesh *mesh, AtomicBoundary &bound, MeshStructure &code);  Nestler, Michael committed Nov 19, 2012 192 193 194 195 196 197 198 199 200 201  /** \brief * Writes Element Map of local Rank * Map containes for each DOF in each Element (resulting in massive doubling of DOFs): * localElementNumber elementLevel localDOFNumber dofType dofCoords(0-2) elementLocalDOFNumber typeOfElement (0-2) */ static void writeCsvElementMap(const FiniteElemSpace *feSpace, ParallelDofMapping &dofMap, string prefix, string postfix);  Thomas Witkowski committed Feb 09, 2010 202 203 204 205 206  }; } // namespace AMDiS #endif