Commit 2f0ed3ea authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

To debug on juropa.

parent 4c2e86e3
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "Triangle.h" #include "Triangle.h"
#include "Tetrahedron.h" #include "Tetrahedron.h"
#include "Parametric.h" #include "Parametric.h"
#include "Debug.h"
namespace AMDiS { namespace AMDiS {
...@@ -1212,6 +1213,8 @@ namespace AMDiS { ...@@ -1212,6 +1213,8 @@ namespace AMDiS {
for (int i = 1; i < n; i++) { for (int i = 1; i < n; i++) {
el = list->getElement(i); el = list->getElement(i);
TEST_EXIT_DBG(el)("Should not happen!\n");
basFct->getLocalIndices(el, admin, pdof); basFct->getLocalIndices(el, admin, pdof);
int lr_set = 0; int lr_set = 0;
...@@ -1221,7 +1224,13 @@ namespace AMDiS { ...@@ -1221,7 +1224,13 @@ namespace AMDiS {
if (list->getNeighbourElement(i, 1) && list->getNeighbourNr(i, 1) < i) if (list->getNeighbourElement(i, 1) && list->getNeighbourNr(i, 1) < i)
lr_set += 2; lr_set += 2;
TEST_EXIT(lr_set)("no values set on both neighbours\n"); if (lr_set == 0 && el->getIndex() == 450) {
Element *del = debug::getLevel0ParentElement(drv->getFeSpace()->getMesh(), 450);
MSG("MACRO EL = %d\n", del->getIndex());
}
TEST_EXIT(lr_set > 0)
("No values set on both neighbours of element %d\n", el->getIndex());
/****************************************************************************/ /****************************************************************************/
/* values on child[0] */ /* values on child[0] */
......
...@@ -52,6 +52,7 @@ namespace AMDiS { ...@@ -52,6 +52,7 @@ namespace AMDiS {
int rankStartRowIndex = rowDofMap.getStartDofs(); int rankStartRowIndex = rowDofMap.getStartDofs();
int nRankCols = colDofMap.getRankDofs(); int nRankCols = colDofMap.getRankDofs();
int nOverallCols = colDofMap.getOverallDofs();
int rankStartColIndex = colDofMap.getStartDofs(); int rankStartColIndex = colDofMap.getStartDofs();
create(nRankRows, (!localMatrix ? nRankRows : -1)); create(nRankRows, (!localMatrix ? nRankRows : -1));
...@@ -311,9 +312,10 @@ namespace AMDiS { ...@@ -311,9 +312,10 @@ namespace AMDiS {
// matrices, the problem may arise, that the result is larger than the // matrices, the problem may arise, that the result is larger than the
// number of elements in a row. This is fixed in the following. // number of elements in a row. This is fixed in the following.
if (nRankRows < 100 || nRankCols < 100) for (int i = 0; i < nRankRows; i++) {
for (int i = 0; i < nRankRows; i++) dnnz[i] = std::min(dnnz[i], nRankCols);
dnnz[i] = std::min(dnnz[i], nRankCols); onnz[i] = std::min(onnz[i], nOverallCols - nRankCols);
}
#if (DEBUG != 0) #if (DEBUG != 0)
int nMax = 0; int nMax = 0;
......
...@@ -574,7 +574,21 @@ namespace AMDiS { ...@@ -574,7 +574,21 @@ namespace AMDiS {
dofMaps.push_back(&dofMap); dofMaps.push_back(&dofMap);
} }
void MeshDistributor::removeDofMap(ParallelDofMapping &dofMap)
{
FUNCNAME("MeshDistributor::removeDofMap()");
vector<ParallelDofMapping*>::iterator it =
find(dofMaps.begin(), dofMaps.end(), &dofMap);
TEST_EXIT(it != dofMaps.end())
("Cannot find Parallel DOF mapping object which should be removed!\n");
dofMaps.erase(it);
}
void MeshDistributor::testForMacroMesh() void MeshDistributor::testForMacroMesh()
{ {
FUNCNAME("MeshDistributor::testForMacroMesh()"); FUNCNAME("MeshDistributor::testForMacroMesh()");
......
...@@ -77,6 +77,13 @@ namespace AMDiS { ...@@ -77,6 +77,13 @@ namespace AMDiS {
*/ */
void registerDofMap(ParallelDofMapping &dofMap); void registerDofMap(ParallelDofMapping &dofMap);
/** \brief
* Removes a registered DOF mapping from the mesh distributor.
*
* \param[in] dofMap Parallel DOF mapping object to be removed.
*/
void removeDofMap(ParallelDofMapping &dofMap);
/// Adds a DOFVector to the set of \ref interchangeVecs. Thus, this vector /// Adds a DOFVector to the set of \ref interchangeVecs. Thus, this vector
/// will be automatically interchanged between ranks when mesh is /// will be automatically interchanged between ranks when mesh is
/// repartitioned. /// repartitioned.
......
...@@ -24,6 +24,7 @@ namespace AMDiS { ...@@ -24,6 +24,7 @@ namespace AMDiS {
: ParallelCoarseSpaceSolver(name), : ParallelCoarseSpaceSolver(name),
dofMap(FESPACE_WISE, true), dofMap(FESPACE_WISE, true),
dofMapSd(FESPACE_WISE, true), dofMapSd(FESPACE_WISE, true),
parallelDofMappingsRegistered(false),
kspPrefix(""), kspPrefix(""),
removeRhsNullspace(false), removeRhsNullspace(false),
hasConstantNullspace(false), hasConstantNullspace(false),
...@@ -44,6 +45,17 @@ namespace AMDiS { ...@@ -44,6 +45,17 @@ namespace AMDiS {
} }
PetscSolver::~PetscSolver()
{
if (parallelDofMappingsRegistered) {
meshDistributor->removeDofMap(dofMap);
int nLevels = meshDistributor->getMeshLevelData().getLevelNumber();
if (nLevels > 1)
meshDistributor->removeDofMap(dofMapSd);
}
}
void PetscSolver::init(vector<const FiniteElemSpace*> &fe0, void PetscSolver::init(vector<const FiniteElemSpace*> &fe0,
vector<const FiniteElemSpace*> &fe1, vector<const FiniteElemSpace*> &fe1,
bool createGlobalMapping) bool createGlobalMapping)
...@@ -62,6 +74,8 @@ namespace AMDiS { ...@@ -62,6 +74,8 @@ namespace AMDiS {
TEST_EXIT_DBG(nLevels >= 1)("Should not happen!\n"); TEST_EXIT_DBG(nLevels >= 1)("Should not happen!\n");
if (createGlobalMapping) { if (createGlobalMapping) {
parallelDofMappingsRegistered = true;
dofMap.init(levelData, componentSpaces, feSpaces); dofMap.init(levelData, componentSpaces, feSpaces);
dofMap.setMpiComm(levelData.getMpiComm(0), 0); dofMap.setMpiComm(levelData.getMpiComm(0), 0);
dofMap.setDofComm(meshDistributor->getDofComm()); dofMap.setDofComm(meshDistributor->getDofComm());
......
...@@ -52,7 +52,7 @@ namespace AMDiS { ...@@ -52,7 +52,7 @@ namespace AMDiS {
public: public:
PetscSolver(string name); PetscSolver(string name);
virtual ~PetscSolver() {} virtual ~PetscSolver();
void init(vector<const FiniteElemSpace*> &componentSpaces, void init(vector<const FiniteElemSpace*> &componentSpaces,
vector<const FiniteElemSpace*> &feSpaces, vector<const FiniteElemSpace*> &feSpaces,
...@@ -183,6 +183,11 @@ namespace AMDiS { ...@@ -183,6 +183,11 @@ namespace AMDiS {
/// ///
ParallelDofMapping dofMap, dofMapSd; ParallelDofMapping dofMap, dofMapSd;
/// If the parallel DOF mappaings of this solver are registered to the
/// mesh distributor object, this variable is set to true to remove them
/// in the destructor.
bool parallelDofMappingsRegistered;
/// PETSc solver object /// PETSc solver object
KSP kspInterior; KSP kspInterior;
......
Supports Markdown
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