Liebe Gitlab-Nutzerin, lieber Gitlab-Nutzer,
es ist nun möglich sich mittels des ZIH-Logins/LDAP an unserem Dienst anzumelden. Die Konten der externen Nutzer:innen sind über den Reiter "Standard" erreichbar.
Die Administratoren


Dear Gitlab user,
it is now possible to log in to our service using the ZIH login/LDAP. The accounts of external users can be accessed via the "Standard" tab.
The administrators

ParallelDebug.h 6.37 KB
Newer Older
Thomas Witkowski's avatar
Thomas Witkowski committed
1 2 3 4
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
5
// ==  http://www.amdis-fem.org                                              ==
Thomas Witkowski's avatar
Thomas Witkowski committed
6 7
// ==                                                                        ==
// ============================================================================
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's avatar
Thomas Witkowski committed
20

21
/** \file ParallelDebug.h */
Thomas Witkowski's avatar
Thomas Witkowski committed
22

23 24
#ifndef AMDIS_PARALLELDEBUG_H
#define AMDIS_PARALLELDEBUG_H
Thomas Witkowski's avatar
Thomas Witkowski committed
25

26
#include "parallel/MeshDistributor.h"
Thomas Witkowski's avatar
Thomas Witkowski committed
27 28 29

namespace AMDiS {
   
30
  class ParallelDebug 
31 32
  {
  protected:
33
    typedef MeshDistributor::RankToDofContainer RankToDofContainer;
34

35 36 37 38 39
    typedef std::vector<WorldVector<double> > CoordsVec;

    /// Defines a mapping type from rank numbers to sets of coordinates.
    typedef std::map<int, CoordsVec> RankToCoords;

Thomas Witkowski's avatar
Thomas Witkowski committed
40 41
  public:
    /** \brief
42 43
     * Tests the interior and the periodic boundaries on all ranks if their order
     * fits together.
Thomas Witkowski's avatar
Thomas Witkowski committed
44 45 46
     *
     * \param[in]  pdb   Parallel problem definition used for debugging.
     */
47
    static void testInteriorBoundary(MeshDistributor &pdb);
Thomas Witkowski's avatar
Thomas Witkowski committed
48

49 50 51 52 53 54 55
    /** \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);

Thomas Witkowski's avatar
Thomas Witkowski committed
56 57
    /** \brief
     * This function is used for debugging only. It traverses all interior boundaries
58
     * and compares the DOF indices on them with the dof indices of the boundarys
Thomas Witkowski's avatar
Thomas Witkowski committed
59 60 61 62 63 64 65
     * neighbours. The function fails, when dof indices on an interior boundary do
     * not fit together.
     *
     * \param[in]  pdb           Parallel problem definition used for debugging.
     * \param[in]  printCoords   If true, the coords of all common dofs are printed
     *                           to the screen.
     */
66
    static void testCommonDofs(MeshDistributor &pdb, bool printCoords = false);
Thomas Witkowski's avatar
Thomas Witkowski committed
67

68 69 70 71 72 73 74 75 76 77
    /** \brief
     * 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.
     *
     * \param[in]  pdb           Parallel problem definition used for debugging.
     */
    static void testGlobalIndexByCoords(MeshDistributor &pdb);

78 79 80 81 82
    /** \brief
     * Tests if all elements in the macro mesh are memeber of exactly one rank.
     *
     * \param[in]  pdb           Parallel problem definition used for debugging.
     */
83
    static void testAllElements(MeshDistributor &pdb);
84

85 86 87 88 89 90 91 92
    /** \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.
     * \param[in]  sendDofs   The map of all DOFs the rank will send.
     * \param[in]  recvDofs   The map of all DOFs the rank will receive.
     */
93
    static void testDofContainerCommunication(MeshDistributor &pdb, 
94 95 96
					      RankToDofContainer &sendDofs,
					      RankToDofContainer &recvDofs);

97 98 99
    /// Tests if there are multiple DOFs in mesh with the same coords.
    static void testDoubleDofs(Mesh *mesh);

Thomas Witkowski's avatar
Thomas Witkowski committed
100 101 102 103 104 105 106 107
    /** \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.
     */
108
    static void printMapLocalGlobal(MeshDistributor &pdb, int rank = -1);
Thomas Witkowski's avatar
Thomas Witkowski committed
109 110 111 112 113 114 115 116 117

    /** \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.
     */
118
    static void printMapPeriodic(MeshDistributor &pdb, int rank = -1);
Thomas Witkowski's avatar
Thomas Witkowski committed
119 120 121 122 123 124 125 126 127 128 129 130

    /** \brief
     * This function is used for debugging only. It prints information about dofs
     * in rank's partition.
     *
     * \param[in]  pdb           Parallel problem definition used for debugging.
     * \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.
     * \param[in]  rankAllDofs   List of all dofs in ranks partition.
     */
131
    static void printRankDofs(MeshDistributor &pdb,
Thomas Witkowski's avatar
Thomas Witkowski committed
132 133 134
			      int rank, 
			      DofContainer& rankDofs, 
			      DofContainer& rankAllDofs);
135 136 137 138 139 140

    /** \brief
     * This functions prints all information about all interior boundaries on all ranks.
     *
     * \param[in]  pdb           Parallel problem definition used for debugging.
     */
141
    static void printBoundaryInfo(MeshDistributor &pdb);
142

143 144
    static void writeDebugFile(MeshDistributor &pdb,
			       std::string prefix, std::string postfix);
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163

    /** \brief
     * This functions create a Paraview file with the macro mesh where the elements
     * are colored by the partition they are part of.
     */
    static void writePartitioning(MeshDistributor &pdb, string filename);

    /** \brief
     * The mesh is written to a value and all values are assigned by the rank number
     * where the vertex is contained in.
     *
     * \param[in]  filename    Name of the output file without extension (.vtu).
     * \param[in]  counter     Counter index. If not negative, this number is added
     *                         to the filename.
     * \param[in]  feSpace
     */
    static void writePartitioningFile(std::string filename,
				      int counter,
				      FiniteElemSpace *feSpace);
Thomas Witkowski's avatar
Thomas Witkowski committed
164 165 166 167 168
  };
  
} // namespace AMDiS

#endif