Skip to content
Snippets Groups Projects
ParallelDomainDbg.h 5.23 KiB
Newer Older
Thomas Witkowski's avatar
Thomas Witkowski committed
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  TU Dresden                                                            ==
// ==                                                                        ==
// ==  Institut für Wissenschaftliches Rechnen                               ==
// ==  Zellescher Weg 12-14                                                  ==
// ==  01069 Dresden                                                         ==
// ==  germany                                                               ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  https://gforge.zih.tu-dresden.de/projects/amdis/                      ==
// ==                                                                        ==
// ============================================================================

/** \file ParallelDomainDbg.h */

#ifndef AMDIS_PARALLELDOMAINDBG_H
#define AMDIS_PARALLELDOMAINDBG_H

#include "parallel/ParallelDomainBase.h"

namespace AMDiS {
   
  class ParallelDomainDbg 
  {
  protected:
    typedef MeshDistributor::RankToDofContainer RankToDofContainer;
Thomas Witkowski's avatar
Thomas Witkowski committed
  public:
    /** \brief
     * Tests the interior boundaries on all ranks if their order fits together.
     *
     * \param[in]  pdb   Parallel problem definition used for debugging.
     */
    static void testInteriorBoundary(MeshDistributor &pdb);
Thomas Witkowski's avatar
Thomas Witkowski committed

    /** \brief
     * 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.
     *
     * \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.
     */
    static void testCommonDofs(MeshDistributor &pdb, bool printCoords = false);
    /** \brief
     * Tests if all elements in the macro mesh are memeber of exactly one rank.
     *
     * \param[in]  pdb           Parallel problem definition used for debugging.
     */
    static void testAllElements(MeshDistributor &pdb);
    /** \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.
     */
    static void testDofContainerCommunication(MeshDistributor &pdb, 
					      RankToDofContainer &sendDofs,
					      RankToDofContainer &recvDofs);

Thomas Witkowski's avatar
Thomas Witkowski committed
    /** \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.
     */
    static void printMapLocalGlobal(MeshDistributor &pdb, int rank = -1);
Thomas Witkowski's avatar
Thomas Witkowski committed

    /** \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.
     */
    static void printMapPeriodic(MeshDistributor &pdb, int rank = -1);
Thomas Witkowski's avatar
Thomas Witkowski committed

    /** \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.
     */
    static void printRankDofs(MeshDistributor &pdb,
Thomas Witkowski's avatar
Thomas Witkowski committed
			      int rank, 
			      DofContainer& rankDofs, 
			      DofContainer& rankAllDofs);

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

    static void writeCoordsFile(MeshDistributor &pdb, 
				std::string prefix, std::string postfix);
Thomas Witkowski's avatar
Thomas Witkowski committed
  };
  
} // namespace AMDiS

#endif