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

Commit 334a275f authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Moved all general debug functions to Debug.h and Debug.cc

parent 73afa800
......@@ -216,6 +216,7 @@ $(SOURCE_DIR)/SubElInfo.h $(SOURCE_DIR)/SubElInfo.cc \
$(SOURCE_DIR)/SolutionDataStorage.h $(SOURCE_DIR)/SolutionDataStorage.hh \
$(SOURCE_DIR)/InteriorBoundary.h $(SOURCE_DIR)/InteriorBoundary.cc \
$(SOURCE_DIR)/ElementDofIteartor.h $(SOURCE_DIR)/ElementDofIterator.cc \
$(SOURCE_DIR)/Debug.h $(SOURCE_DIR)/Debug.cc \
$(SOURCE_DIR)/parareal/ProblemBase.h \
$(SOURCE_DIR)/parareal/AdaptParaReal.h $(SOURCE_DIR)/parareal/AdaptParaReal.cc
......
......@@ -225,8 +225,8 @@ am__libamdis_la_SOURCES_DIST = $(PARALLEL_DIR)/ParallelDomainBase.h \
$(SOURCE_DIR)/InteriorBoundary.h \
$(SOURCE_DIR)/InteriorBoundary.cc \
$(SOURCE_DIR)/ElementDofIteartor.h \
$(SOURCE_DIR)/ElementDofIterator.cc \
$(SOURCE_DIR)/parareal/ProblemBase.h \
$(SOURCE_DIR)/ElementDofIterator.cc $(SOURCE_DIR)/Debug.h \
$(SOURCE_DIR)/Debug.cc $(SOURCE_DIR)/parareal/ProblemBase.h \
$(SOURCE_DIR)/parareal/AdaptParaReal.h \
$(SOURCE_DIR)/parareal/AdaptParaReal.cc
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@am__objects_1 = libamdis_la-ParallelDomainBase.lo \
......@@ -290,7 +290,8 @@ am_libamdis_la_OBJECTS = $(am__objects_2) libamdis_la-DOFIndexed.lo \
libamdis_la-PngWriter.lo libamdis_la-PovrayWriter.lo \
libamdis_la-DataCollector.lo libamdis_la-ScalableQuadrature.lo \
libamdis_la-SubElInfo.lo libamdis_la-InteriorBoundary.lo \
libamdis_la-ElementDofIterator.lo libamdis_la-AdaptParaReal.lo
libamdis_la-ElementDofIterator.lo libamdis_la-Debug.lo \
libamdis_la-AdaptParaReal.lo
libamdis_la_OBJECTS = $(am_libamdis_la_OBJECTS)
libcompositeFEM_la_LIBADD =
am_libcompositeFEM_la_OBJECTS = libcompositeFEM_la-CFE_Integration.lo \
......@@ -629,6 +630,7 @@ $(SOURCE_DIR)/SubElInfo.h $(SOURCE_DIR)/SubElInfo.cc \
$(SOURCE_DIR)/SolutionDataStorage.h $(SOURCE_DIR)/SolutionDataStorage.hh \
$(SOURCE_DIR)/InteriorBoundary.h $(SOURCE_DIR)/InteriorBoundary.cc \
$(SOURCE_DIR)/ElementDofIteartor.h $(SOURCE_DIR)/ElementDofIterator.cc \
$(SOURCE_DIR)/Debug.h $(SOURCE_DIR)/Debug.cc \
$(SOURCE_DIR)/parareal/ProblemBase.h \
$(SOURCE_DIR)/parareal/AdaptParaReal.h $(SOURCE_DIR)/parareal/AdaptParaReal.cc
......@@ -747,6 +749,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-DOFMatrix.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-DOFVector.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-DataCollector.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-Debug.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-DirichletBC.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-DualTraverse.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-ElInfo.Plo@am__quote@
......@@ -1532,6 +1535,13 @@ libamdis_la-ElementDofIterator.lo: $(SOURCE_DIR)/ElementDofIterator.cc
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -c -o libamdis_la-ElementDofIterator.lo `test -f '$(SOURCE_DIR)/ElementDofIterator.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/ElementDofIterator.cc
libamdis_la-Debug.lo: $(SOURCE_DIR)/Debug.cc
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -MT libamdis_la-Debug.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-Debug.Tpo" -c -o libamdis_la-Debug.lo `test -f '$(SOURCE_DIR)/Debug.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/Debug.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-Debug.Tpo" "$(DEPDIR)/libamdis_la-Debug.Plo"; else rm -f "$(DEPDIR)/libamdis_la-Debug.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(SOURCE_DIR)/Debug.cc' object='libamdis_la-Debug.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -c -o libamdis_la-Debug.lo `test -f '$(SOURCE_DIR)/Debug.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/Debug.cc
libamdis_la-AdaptParaReal.lo: $(SOURCE_DIR)/parareal/AdaptParaReal.cc
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -MT libamdis_la-AdaptParaReal.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-AdaptParaReal.Tpo" -c -o libamdis_la-AdaptParaReal.lo `test -f '$(SOURCE_DIR)/parareal/AdaptParaReal.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/parareal/AdaptParaReal.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-AdaptParaReal.Tpo" "$(DEPDIR)/libamdis_la-AdaptParaReal.Plo"; else rm -f "$(DEPDIR)/libamdis_la-AdaptParaReal.Tpo"; exit 1; fi
......
#include <boost/lexical_cast.hpp>
#include "Debug.h"
#include "DOFVector.h"
#include "MacroElement.h"
#include "VtkWriter.h"
namespace AMDiS {
namespace debug {
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
void writeLocalElementDofs(int rank, int elIdx, FiniteElemSpace *feSpace)
{
using boost::lexical_cast;
if (MPI::COMM_WORLD.Get_rank() == rank) {
DOFVector<double> tmp(feSpace, "tmp");
colorDofVectorByLocalElementDofs(tmp, feSpace->getMesh(), elIdx);
VtkWriter::writeFile(tmp, "tmp" + lexical_cast<std::string>(elIdx) + ".vtu");
}
}
void writeDofMesh(int rank, DegreeOfFreedom dof, FiniteElemSpace *feSpace)
{
using boost::lexical_cast;
if (MPI::COMM_WORLD.Get_rank() == rank) {
DOFVector<double> tmp(feSpace, "tmp");
tmp.set(0.0);
tmp[dof] = 1.0;
VtkWriter::writeFile(tmp, "dofmesh" + lexical_cast<std::string>(rank) + ".vtu");
}
}
void writeMesh(FiniteElemSpace *feSpace, int rank, std::string filename)
{
using boost::lexical_cast;
int myRank = MPI::COMM_WORLD.Get_rank();
if (rank == -1 || myRank == rank) {
DOFVector<double> tmp(feSpace, "tmp");
VtkWriter::writeFile(tmp, filename + lexical_cast<std::string>(myRank) + ".vtu");
}
}
#endif
void colorDofVectorByLocalElementDofs(DOFVector<double>& vec, Element *el)
{
// === Get local indices of the given element. ===
const BasisFunction *basisFcts = vec.getFESpace()->getBasisFcts();
int nBasisFcts = basisFcts->getNumber();
std::vector<DegreeOfFreedom> localDofs(nBasisFcts);
basisFcts->getLocalIndices(el, vec.getFESpace()->getAdmin(), localDofs);
// === Set the values of the dof vector. ===
vec.set(0.0);
for (int i = 0; i < nBasisFcts; i++)
vec[localDofs[i]] = static_cast<double>(i);
}
bool colorDofVectorByLocalElementDofs(DOFVector<double>& vec, Mesh *mesh,
int elIndex)
{
FUNCNAME("colorDofVectorByLocalElementDofs()");
TraverseStack stack;
ElInfo *elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_LEAF_EL);
while (elInfo) {
if (elInfo->getElement()->getIndex() == elIndex) {
colorDofVectorByLocalElementDofs(vec, elInfo->getElement());
return true;
}
elInfo = stack.traverseNext(elInfo);
}
return false;
}
Element* getDofIndexElement(FiniteElemSpace *feSpace, DegreeOfFreedom dof)
{
const BasisFunction* basFcts = feSpace->getBasisFcts();
int nBasFcts = basFcts->getNumber();
std::vector<DegreeOfFreedom> dofVec(nBasFcts);
TraverseStack stack;
ElInfo *elInfo = stack.traverseFirst(feSpace->getMesh(), -1,
Mesh::CALL_EVERY_EL_PREORDER);
while (elInfo) {
basFcts->getLocalIndices(elInfo->getElement(), feSpace->getAdmin(), dofVec);
for (int i = 0; i < nBasFcts; i++)
if (dofVec[i] == dof)
return elInfo->getElement();
elInfo = stack.traverseNext(elInfo);
}
return NULL;
}
Element* getLevel0ParentElement(Mesh *mesh, Element *el)
{
TraverseStack stack;
ElInfo *elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_EVERY_EL_PREORDER);
while (elInfo) {
if (elInfo->getElement() == el)
return elInfo->getMacroElement()->getElement();
elInfo = stack.traverseNext(elInfo);
}
return NULL;
}
void printInfoByDof(FiniteElemSpace *feSpace, DegreeOfFreedom dof)
{
Element *el = getDofIndexElement(feSpace, dof);
Element *parEl = getLevel0ParentElement(feSpace->getMesh(), el);
std::cout << "DOF-INFO: dof = " << dof
<< " elidx = " << el->getIndex()
<< " pelidx = " << parEl->getIndex() << std::endl;
TraverseStack stack;
ElInfo *elInfo = stack.traverseFirst(feSpace->getMesh(), -1,
Mesh::CALL_EVERY_EL_PREORDER);
while (elInfo) {
if (elInfo->getElement()->getIndex() == parEl->getIndex())
std::cout << "EL INFO TO " << parEl->getIndex() << ": "
<< elInfo->getType() << std::endl;
elInfo = stack.traverseNext(elInfo);
}
}
} // namespace debug
} // namespace AMDiS
// ============================================================================
// == ==
// == AMDiS - Adaptive multidimensional simulations ==
// == ==
// ============================================================================
// == ==
// == TU Dresden ==
// == ==
// == Institut fr Wissenschaftliches Rechnen ==
// == Zellescher Weg 12-14 ==
// == 01069 Dresden ==
// == germany ==
// == ==
// ============================================================================
// == ==
// == https://gforge.zih.tu-dresden.de/projects/amdis/ ==
// == ==
// ============================================================================
/** \file Debug.h */
#ifndef AMDIS_DEBUG_H
#define AMDIS_DEBUG_H
#include "AMDiS_fwd.h"
#include "Global.h"
namespace AMDiS {
namespace debug {
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
void writeLocalElementDofs(int rank, int elIdx, FiniteElemSpace *feSpace);
void writeMesh(FiniteElemSpace *feSpace, int rank, std::string filename);
void writeDofMesh(int rank, DegreeOfFreedom dof, FiniteElemSpace *feSpace);
#endif
void colorDofVectorByLocalElementDofs(DOFVector<double>& vec, Element *el);
bool colorDofVectorByLocalElementDofs(DOFVector<double>& vec,
Mesh *mesh,
int elIndex);
Element* getDofIndexElement(FiniteElemSpace *feSpace, DegreeOfFreedom dof);
Element* getLevel0ParentElement(Mesh *mesh, Element *el);
void printInfoByDof(FiniteElemSpace *feSpace, DegreeOfFreedom dof);
}
}
#endif
This diff is collapsed.
......@@ -178,8 +178,6 @@ namespace AMDiS {
return nRankDofs;
}
void fillPetscMatrix(Matrix<DOFMatrix*> *mat, SystemVector *vec);
void solvePetscMatrix(SystemVector &vec);
virtual ProblemStatBase *getProblem(int number = 0)
......@@ -218,7 +216,7 @@ namespace AMDiS {
/** \brief
* This function create new mappings from local to global indices,
* \ref mapLocalGlobalDOFs, and from local to dof indices, \ref mapLocalToDofIndex.
* \ref mapLocalGlobalDofs, and from local to dof indices, \ref mapLocalToDofIndex.
* Furthermore, using the first argument the dof indices in ranks partition are
* changed.
*
......@@ -239,11 +237,11 @@ namespace AMDiS {
* be used, if \ref partitionVec is set correctly. This is only the case, when
* the macro mesh is partitioned.
*
* \param[out] partionDOFs Stores to each DOF pointer the set of ranks the DOF is
* part of.
* \param[out] rankDOFs Stores all rank DOFs.
* \param[out] boundaryDOFs Stores all DOFs in ranks partition that are on an
* interior boundary but correspond to another rank.
* \param[out] partitionDOFs Stores to each DOF pointer the set of ranks the DOF
* is part of.
* \param[out] rankDOFs Stores all rank DOFs.
* \param[out] boundaryDOFs Stores all DOFs in ranks partition that are on an
* interior boundary but correspond to another rank.
*/
void createDofMemberInfo(DofToPartitions& partitionDofs,
DofContainer& rankOwnedDofs,
......@@ -251,6 +249,16 @@ namespace AMDiS {
DofToRank& boundaryDofs,
DofToBool& vertexDof);
/** \brief
* Create a PETSc matrix and PETSc vectors. The given DOF matrices are used to
* create the nnz structure of the PETSc matrix and the values are transfered to it.
* The given DOF vectors are used to the the values of the PETSc rhs vector.
*
* \param[in] mat
* \param[in] vec
*/
void fillPetscMatrix(Matrix<DOFMatrix*> *mat, SystemVector *vec);
/// Takes a dof matrix and sends the values to the global petsc matrix.
void setDofMatrix(DOFMatrix* mat, int dispMult = 1,
int dispAddRow = 0, int dispAddCol = 0);
......@@ -301,7 +309,7 @@ namespace AMDiS {
/** \brief
* This function is used for debugging only. It prints all information from
* the local to global dof mapping, see \ref mapLocalGlobalDOFs.
* the local to global dof mapping, see \ref mapLocalGlobalDofs.
*
* \param rank If specified, only the information from the given rank is printed.
*/
......@@ -537,13 +545,14 @@ namespace AMDiS {
RankToDofContainer sendDofs;
/** \brief
* This map contains for each rank the list of dofs from which the current rank
* must receive solution values of dofs at the interior boundaries.
* This map contains for each rank the list of DOFs from which the current rank
* will receive DOF values (i.e., this are all DOFs at an interior boundary). The
* DOF indices are given in rank's local numbering.
*/
RankToDofContainer recvDofs;
/// Maps local to global dof indices.
DofMapping mapLocalGlobalDOFs;
DofMapping mapLocalGlobalDofs;
/// Maps local dof indices to real dof indices.
DofMapping mapLocalToDofIndex;
......@@ -597,20 +606,6 @@ namespace AMDiS {
*/
long lastMeshChangeIndex;
};
void writeLocalElementDofs(int rank, int elIdx, FiniteElemSpace *feSpace);
void writeMesh(FiniteElemSpace *feSpace, int rank = -1);
void colorDofVectorByLocalElementDofs(DOFVector<double>& vec, Element *el);
bool colorDofVectorByLocalElementDofs(DOFVector<double>& vec, Mesh *mesh, int elIndex);
Element* getDofIndexElement(FiniteElemSpace *feSpace, DegreeOfFreedom dof);
Element* getLevel0ParentElement(Mesh *mesh, Element *el);
void printInfoByDof(FiniteElemSpace *feSpace, DegreeOfFreedom dof);
}
#endif // AMDIS_PARALLELDOMAINBASE_H
......@@ -47,6 +47,11 @@ namespace AMDiS {
return data.size() * Global::getGeo(WORLD);
}
int intSizeOf(std::vector<std::pair<int, int> > &data)
{
return data.size() * 2;
}
void makeBuf(std::map<const DegreeOfFreedom*, DegreeOfFreedom> &data, int* buf)
{
int i = 0;
......@@ -63,14 +68,13 @@ namespace AMDiS {
if (bufSize == 0)
return;
TEST_EXIT(bufSize % 2 == 0)("This should not happen!\n");
data.clear();
data.reserve(bufSize / 2);
int i = 0;
do {
data.push_back(std::make_pair(buf[i], buf[i + 1]));
i += 2;
} while (i < bufSize);
for (int i = 0; i < (bufSize / 2); i++)
data.push_back(std::make_pair(buf[i * 2], buf[i * 2 + 1]));
}
void makeBuf(std::vector<MeshStructure> &data, unsigned long int *buf)
......@@ -126,6 +130,14 @@ namespace AMDiS {
data[i][j] = buf[pos++];
}
void makeBuf(std::vector<std::pair<int, int> > &data, int *buf)
{
for (unsigned int i = 0; i < data.size(); i++) {
buf[i * 2] = data[i].first;
buf[i * 2 + 1] = data[i].second;
}
}
template<typename SendT, typename RecvT>
class StdMpi
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment