Commit b115e944 authored by Thomas Witkowski's avatar Thomas Witkowski

Small changes and code refactoring in parallel AMDiS.

parent a71cce06
...@@ -137,14 +137,18 @@ namespace AMDiS { ...@@ -137,14 +137,18 @@ namespace AMDiS {
if (!reverseOrder) { if (!reverseOrder) {
if (s1 != -1) if (s1 != -1)
addAlongSide(el->getFirstChild(), subObj, s1, el->getChildType(elType), reverseOrder); addAlongSide(el->getFirstChild(), subObj, s1,
el->getChildType(elType), reverseOrder);
if (s2 != -1) if (s2 != -1)
addAlongSide(el->getSecondChild(), subObj, s2, el->getChildType(elType), reverseOrder); addAlongSide(el->getSecondChild(), subObj, s2,
el->getChildType(elType), reverseOrder);
} else { } else {
if (s2 != -1) if (s2 != -1)
addAlongSide(el->getSecondChild(), subObj, s2, el->getChildType(elType), reverseOrder); addAlongSide(el->getSecondChild(), subObj, s2,
el->getChildType(elType), reverseOrder);
if (s1 != -1) if (s1 != -1)
addAlongSide(el->getFirstChild(), subObj, s1, el->getChildType(elType), reverseOrder); addAlongSide(el->getFirstChild(), subObj, s1,
el->getChildType(elType), reverseOrder);
} }
} }
} }
......
...@@ -66,10 +66,8 @@ namespace AMDiS { ...@@ -66,10 +66,8 @@ namespace AMDiS {
reset(); reset();
} }
/** \brief /// Sets all position counters, that are used to traverse the code, to the
* Sets all position counters, that are used to traverse the code, to the starting /// starting position. The code itself is not changed.
* position. The code itself is not changed.
*/
void reset(); void reset();
/// Returns whether the code is empty or not. /// Returns whether the code is empty or not.
......
...@@ -51,7 +51,6 @@ namespace AMDiS { ...@@ -51,7 +51,6 @@ namespace AMDiS {
{ {
FUNCNAME("ArhReader::read()"); FUNCNAME("ArhReader::read()");
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
if (writeParallel) { if (writeParallel) {
using boost::lexical_cast; using boost::lexical_cast;
int sPos = filename.find(".arh"); int sPos = filename.find(".arh");
...@@ -59,8 +58,12 @@ namespace AMDiS { ...@@ -59,8 +58,12 @@ namespace AMDiS {
string name = filename.substr(0, sPos); string name = filename.substr(0, sPos);
if (nProcs == -1) { if (nProcs == -1) {
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
string procFilename = name + "-p" + lexical_cast<string>(MPI::COMM_WORLD.Get_rank()) + "-.arh"; string procFilename = name + "-p" + lexical_cast<string>(MPI::COMM_WORLD.Get_rank()) + "-.arh";
readFile(procFilename, mesh, vecs); readFile(procFilename, mesh, vecs);
#else
ERROR_EXIT("Reading parallel ARH files in sequential computations requires to specify the number of nodes on which the ARH file was created!\n");
#endif
} else { } else {
for (int i = 0; i < nProcs; i++) { for (int i = 0; i < nProcs; i++) {
string procFilename = name + "-p" + lexical_cast<string>(i) + "-.arh"; string procFilename = name + "-p" + lexical_cast<string>(i) + "-.arh";
...@@ -70,10 +73,6 @@ namespace AMDiS { ...@@ -70,10 +73,6 @@ namespace AMDiS {
} else { } else {
readFile(filename, mesh, vecs); readFile(filename, mesh, vecs);
} }
#else
readFile(filename, mesh, vecs);
#endif
MSG("ARH file read from: %s\n", filename.c_str()); MSG("ARH file read from: %s\n", filename.c_str());
} }
......
...@@ -18,7 +18,8 @@ namespace AMDiS { ...@@ -18,7 +18,8 @@ namespace AMDiS {
void DofComm::removeEmpty() void DofComm::removeEmpty()
{ {
for (DataIter dit = data.begin(); dit != data.end(); ++dit) { DataIter dit = data.begin();
while (dit != data.end()) {
FeMapIter it = dit->second.begin(); FeMapIter it = dit->second.begin();
while (it != dit->second.end()) { while (it != dit->second.end()) {
if (it->second.size() == 0) { if (it->second.size() == 0) {
...@@ -28,6 +29,11 @@ namespace AMDiS { ...@@ -28,6 +29,11 @@ namespace AMDiS {
} else } else
++it; ++it;
} }
if (dit->second.size() == 0)
data.erase(dit++);
else
++dit;
} }
} }
......
...@@ -777,6 +777,9 @@ namespace AMDiS { ...@@ -777,6 +777,9 @@ namespace AMDiS {
double first = MPI::Wtime(); double first = MPI::Wtime();
int skip = 0;
Parameters::get("parallel->debug->skip check mesh change", skip);
// === If mesh has not been changed on all ranks, return. === // === If mesh has not been changed on all ranks, return. ===
int recvAllValues = 0; int recvAllValues = 0;
...@@ -788,7 +791,8 @@ namespace AMDiS { ...@@ -788,7 +791,8 @@ namespace AMDiS {
// === At least one rank mesh has been changed, so the boundaries must be === // === At least one rank mesh has been changed, so the boundaries must be ===
// === adapted to the new mesh structure. === // === adapted to the new mesh structure. ===
if (skip == 0)
do { do {
bool meshChanged = false; bool meshChanged = false;
......
...@@ -785,7 +785,7 @@ namespace AMDiS { ...@@ -785,7 +785,7 @@ namespace AMDiS {
{ {
FUNCNAME("ParallelDebug::writeCoordsFile()"); FUNCNAME("ParallelDebug::writeCoordsFile()");
const FiniteElemSpace *feSpace = pdb.feSpaces[0]; const FiniteElemSpace *feSpace = pdb.feSpaces[pdb.feSpaces.size() - 1];
stringstream filename; stringstream filename;
filename << prefix << "-" << pdb.mpiRank << "." << postfix; filename << prefix << "-" << pdb.mpiRank << "." << postfix;
......
...@@ -431,6 +431,7 @@ namespace AMDiS { ...@@ -431,6 +431,7 @@ namespace AMDiS {
("Should not happen!\n"); ("Should not happen!\n");
int rowIndex = rowIt->first; int rowIndex = rowIt->first;
MatSetValues(petscMatrix, 1, &rowIndex, rowIt->second.size(), MatSetValues(petscMatrix, 1, &rowIndex, rowIt->second.size(),
&(rowIt->second[0]), &(valsMap[rowIt->first][0]), ADD_VALUES); &(rowIt->second[0]), &(valsMap[rowIt->first][0]), ADD_VALUES);
} }
......
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