Commit 3222f37e authored by Nestler, Michael's avatar Nestler, Michael
Browse files

Anpassung in Tetrahedron.cc in getHigherOrderDofs

Quadratische Ansatzfunktionen erste Tests bestanden

In ParallelDebug.cc einen SVN Writer für DOFVektoren hinzugefügt
parent 66434cfd
...@@ -227,8 +227,9 @@ namespace AMDiS { ...@@ -227,8 +227,9 @@ namespace AMDiS {
{ {
FUNCNAME("Tetrahedron::getNodeDofsAtFace()"); FUNCNAME("Tetrahedron::getNodeDofsAtFace()");
if (!child[0]) if (!child[0]){
return; return;
}
switch (bound.ithObj) { switch (bound.ithObj) {
case 0: case 0:
...@@ -292,8 +293,10 @@ namespace AMDiS { ...@@ -292,8 +293,10 @@ namespace AMDiS {
{ {
FUNCNAME("Tetrahedron::getNodeDofsAtEdge()"); FUNCNAME("Tetrahedron::getNodeDofsAtEdge()");
if (!child[0])
return; if (!child[0]){
return;
}
int n0 = (baseDofPtr ? 0 : feSpace->getAdmin()->getNumberOfPreDofs(VERTEX)); int n0 = (baseDofPtr ? 0 : feSpace->getAdmin()->getNumberOfPreDofs(VERTEX));
BoundaryObject nextBound0 = bound, nextBound1 = bound; BoundaryObject nextBound0 = bound, nextBound1 = bound;
...@@ -306,13 +309,15 @@ namespace AMDiS { ...@@ -306,13 +309,15 @@ namespace AMDiS {
nextBound1.reverseMode = false; nextBound1.reverseMode = false;
if (bound.reverseMode) { if (bound.reverseMode) {
child[1]->getNodeDofs(feSpace, nextBound0, dofs, baseDofPtr); child[1]->getNodeDofs(feSpace, nextBound0, dofs, baseDofPtr);
dofs.push_back(&(child[0]->getDof()[3][n0])); dofs.push_back(&(child[0]->getDof()[3][n0]));
child[0]->getNodeDofs(feSpace, nextBound1, dofs, baseDofPtr); child[0]->getNodeDofs(feSpace, nextBound1, dofs, baseDofPtr);
} else { } else {
child[0]->getNodeDofs(feSpace, nextBound0, dofs, baseDofPtr); child[0]->getNodeDofs(feSpace, nextBound0, dofs, baseDofPtr);
dofs.push_back(&(child[0]->getDof()[3][n0])); dofs.push_back(&(child[0]->getDof()[3][n0]));
child[1]->getNodeDofs(feSpace, nextBound1, dofs, baseDofPtr); child[1]->getNodeDofs(feSpace, nextBound1, dofs, baseDofPtr);
} }
break; break;
...@@ -333,6 +338,7 @@ namespace AMDiS { ...@@ -333,6 +338,7 @@ namespace AMDiS {
if (nextBound1.ithObj != -1) if (nextBound1.ithObj != -1)
child[1]->getNodeDofs(feSpace, nextBound1, dofs, baseDofPtr); child[1]->getNodeDofs(feSpace, nextBound1, dofs, baseDofPtr);
} }
} }
...@@ -365,21 +371,30 @@ namespace AMDiS { ...@@ -365,21 +371,30 @@ namespace AMDiS {
// element is also refined. Then we have go down further in refinement // element is also refined. Then we have go down further in refinement
// hierarchie. // hierarchie.
if (bound.reverseMode) { // Additonal Check if Boundary Edge is NOT Refinement Edge of BoundaryObject
if (nextBound1.ithObj >= 0) // AND the complete Edge is part of both childs
child[1]->getHigherOrderDofs(feSpace, nextBound1, dofs, // therefore only recursion on ONE child is necessary
baseDofPtr, dofGeoIndex); if ( (bound.ithObj > 0) && (nextBound0.ithObj >= 0 && nextBound1.ithObj >= 0) ){
if (nextBound0.ithObj >= 0) child[0]->getHigherOrderDofs(feSpace, nextBound0, dofs,
child[0]->getHigherOrderDofs(feSpace, nextBound0, dofs, baseDofPtr, dofGeoIndex);
baseDofPtr, dofGeoIndex);
} else { } else {
if (nextBound0.ithObj >= 0) if (bound.reverseMode) {
child[0]->getHigherOrderDofs(feSpace, nextBound0, dofs, if (nextBound1.ithObj >= 0)
baseDofPtr, dofGeoIndex); child[1]->getHigherOrderDofs(feSpace, nextBound1, dofs,
if (nextBound1.ithObj >= 0) baseDofPtr, dofGeoIndex);
child[1]->getHigherOrderDofs(feSpace, nextBound1, dofs, if (nextBound0.ithObj >= 0)
baseDofPtr, dofGeoIndex); child[0]->getHigherOrderDofs(feSpace, nextBound0, dofs,
baseDofPtr, dofGeoIndex);
} else {
if (nextBound0.ithObj >= 0)
child[0]->getHigherOrderDofs(feSpace, nextBound0, dofs,
baseDofPtr, dofGeoIndex);
if (nextBound1.ithObj >= 0)
child[1]->getHigherOrderDofs(feSpace, nextBound1, dofs,
baseDofPtr, dofGeoIndex);
}
} }
} else { } else {
// Either the edge is not contained in further refined children, or // Either the edge is not contained in further refined children, or
// the element is not refined further on this edge. Then we can get // the element is not refined further on this edge. Then we can get
...@@ -401,9 +416,10 @@ namespace AMDiS { ...@@ -401,9 +416,10 @@ namespace AMDiS {
do { do {
if (elDofIter.getCurrentPos() == 1 && if (elDofIter.getCurrentPos() == 1 &&
elDofIter.getCurrentElementPos() == bound.ithObj) { elDofIter.getCurrentElementPos() == bound.ithObj) {
dofs.push_back(elDofIter.getDofPtr()); dofs.push_back(elDofIter.getDofPtr());
if (dofGeoIndex != NULL)
dofGeoIndex->push_back(EDGE); if (dofGeoIndex != NULL)
dofGeoIndex->push_back(EDGE);
} }
} while (elDofIter.next()); } while (elDofIter.next());
} }
...@@ -474,8 +490,11 @@ namespace AMDiS { ...@@ -474,8 +490,11 @@ namespace AMDiS {
addDof = true; addDof = true;
else else
addDof = false; addDof = false;
break; break;
case 3:
// On CENTER, dof can not be part on internal boundary
addDof = false;
break;
default: default:
ERROR_EXIT("Should not happen!\n"); ERROR_EXIT("Should not happen!\n");
} }
...@@ -483,12 +502,13 @@ namespace AMDiS { ...@@ -483,12 +502,13 @@ namespace AMDiS {
if (addDof) { if (addDof) {
if (baseDofPtr) if (baseDofPtr)
dofs.push_back(elDofIter.getBaseDof()); dofs.push_back(elDofIter.getBaseDof());
else else
dofs.push_back(elDofIter.getDofPtr()); dofs.push_back(elDofIter.getDofPtr());
if (dofGeoIndex != NULL) if (dofGeoIndex != NULL)
dofGeoIndex->push_back(elDofIter.getPosIndex()); dofGeoIndex->push_back(elDofIter.getPosIndex());
} }
next = (baseDofPtr ? elDofIter.nextStrict() : elDofIter.next()); next = (baseDofPtr ? elDofIter.nextStrict() : elDofIter.next());
...@@ -499,6 +519,7 @@ namespace AMDiS { ...@@ -499,6 +519,7 @@ namespace AMDiS {
default: default:
ERROR_EXIT("Should not happen!\n"); ERROR_EXIT("Should not happen!\n");
} }
} }
......
...@@ -63,31 +63,32 @@ namespace AMDiS { ...@@ -63,31 +63,32 @@ namespace AMDiS {
for (unsigned int i = 0; i < feSpaces.size(); i++) for (unsigned int i = 0; i < feSpaces.size(); i++)
for (int level = 0; level < nLevel; level++) for (int level = 0; level < nLevel; level++)
for (InteriorBoundary::iterator it(boundary, level); !it.end(); ++it) for (InteriorBoundary::iterator it(boundary, level); !it.end(); ++it){
it->rankObj.el->getAllDofs(feSpaces[i], it->rankObj, it->rankObj.el->getAllDofs(feSpaces[i], it->rankObj,
data[level][it.getRank()][feSpaces[i]]); data[level][it.getRank()][feSpaces[i]]);
}
// === Remove empty data containers. === // === Remove empty data containers. ===
for (unsigned int i = 0; i < data.size(); i++) { for (unsigned int i = 0; i < data.size(); i++) {
DataIter dit = data[i].begin(); DataIter dit = data[i].begin();
while (dit != data[i].end()) { while (dit != data[i].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) {
const FiniteElemSpace *fe = it->first; const FiniteElemSpace *fe = it->first;
++it; ++it;
dit->second.erase(fe); dit->second.erase(fe);
} else } else
++it; ++it;
} }
if (dit->second.size() == 0) if (dit->second.size() == 0)
data[i].erase(dit++); data[i].erase(dit++);
else else
++dit; ++dit;
} }
} }
} }
......
...@@ -228,7 +228,7 @@ namespace AMDiS { ...@@ -228,7 +228,7 @@ namespace AMDiS {
Parameters::get("parallel->debug->write mesh partitioning", writePartMesh); Parameters::get("parallel->debug->write mesh partitioning", writePartMesh);
if (writePartMesh > 0) { if (writePartMesh > 0) {
debug::writeElementIndexMesh(mesh, debugOutputDir + "elementIndex"); debug::writeElementIndexMesh(mesh , debugOutputDir + "elementIndex");
ParallelDebug::writePartitioning(*this, debugOutputDir + "part.vtu"); ParallelDebug::writePartitioning(*this, debugOutputDir + "part.vtu");
} }
} }
...@@ -1803,13 +1803,23 @@ namespace AMDiS { ...@@ -1803,13 +1803,23 @@ namespace AMDiS {
} }
// === Update DOF admins due to new number of DOFs. === // === Update DOF admins due to new number of DOFs. ===
lastMeshChangeIndex = mesh->getChangeIndex(); lastMeshChangeIndex = mesh->getChangeIndex();
#if (DEBUG != 0) #if (DEBUG != 0)
static int fileNumber(0); //improvised counter for adapt Iteration
stringstream ss;
ss << debugOutputDir << "elementMaps." << fileNumber ;
//write local Element Maps to csv file
ParallelDebug::writeCsvElementMap(feSpaces[0],
*(dofMaps[0]),
ss.str(), "csv");
fileNumber++;
ParallelDebug::testDofContainerCommunication(*this); ParallelDebug::testDofContainerCommunication(*this);
MSG("------------- Debug information -------------\n"); MSG("------------- Debug information -------------\n");
...@@ -1838,11 +1848,20 @@ namespace AMDiS { ...@@ -1838,11 +1848,20 @@ namespace AMDiS {
int test = 0; int test = 0;
Parameters::get("parallel->remove periodic boundary", test); Parameters::get("parallel->remove periodic boundary", test);
if (test == 0) {
ParallelDebug::testCommonDofs(*this, true); // if (test == 0) {
ParallelDebug::testGlobalIndexByCoords(*this); //121106 replaced if statement
if(true){
//write latest mesh properties to vtu file
debug::writeElementIndexMesh(mesh , debugOutputDir + "elementIndex");
ParallelDebug::writePartitioning(*this, debugOutputDir + "part.vtu");
ParallelDebug::testCommonDofs(*this, true);
ParallelDebug::testGlobalIndexByCoords(*this);
} }
#else #else
for (int i = 0; i < static_cast<int>(dofMaps.size()); i++) { for (int i = 0; i < static_cast<int>(dofMaps.size()); i++) {
vector<const FiniteElemSpace*>& dofMapSpaces = dofMaps[i]->getFeSpaces(); vector<const FiniteElemSpace*>& dofMapSpaces = dofMaps[i]->getFeSpaces();
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "StdMpi.h" #include "StdMpi.h"
#include "Debug.h" #include "Debug.h"
#include "io/VtkWriter.h" #include "io/VtkWriter.h"
#include "ElementDofIterator.h"
namespace AMDiS { namespace AMDiS {
...@@ -914,4 +915,87 @@ namespace AMDiS { ...@@ -914,4 +915,87 @@ namespace AMDiS {
bound.neighObj.elIndex, mesh->getDim(), bound.neighObj.elIndex, mesh->getDim(),
code.toStr().c_str()); code.toStr().c_str());
} }
void ParallelDebug::writeCsvElementMap(const FiniteElemSpace *feSpace,
ParallelDofMapping &dofMap,
string prefix,
string postfix)
{
FUNCNAME("ParallelDebug::writeCsvElementMap()");
MSG("writing local Element map to CSV File \n");
Mesh *mesh = feSpace->getMesh();
stringstream filename;
filename << prefix << "-" << MPI::COMM_WORLD.Get_rank() << "." << postfix;
ofstream file;
file.open(filename.str().c_str());
DOFVector<WorldVector<double> > dofCoords(feSpace, "DOF coords");
mesh->getDofIndexCoords(dofCoords);
TraverseStack stack;
ElInfo *elInfo = stack.traverseFirst(mesh,
-1,
Mesh::CALL_EVERY_EL_POSTORDER);
while (elInfo) {
/*
MSG("Start traverse element %d in level %d\n",
elInfo->getElement()->getIndex(),
elInfo->getLevel());
*/
// check if Element is Leaflevel
// because higherOrderDofs(=NON VERTICES DOFS) are not saved in nonleaf Elements
if (elInfo->getElement()->isLeaf()) {
//traverse ALL DOFS
ElementDofIterator elDofIter(feSpace, true);
elDofIter.reset(elInfo->getElement());
int locDofNumber = 0;
do {
WorldVector<double> c = dofCoords[elDofIter.getDof()];
file << elInfo->getElement()->getIndex() << "\t"; //element number
file << elInfo->getLevel() << "\t"; //element Level
file << elDofIter.getDof() << "\t"; //dof number
file << elDofIter.getCurrentPos()+1 << "\t"; //dof type (+1 to pseudo convert to geoIndex, does not work for CENTER DOFS( geoIndex=0))
file << c[0] << "\t"; //dof coords
file << c[1] << "\t";
file << c[2] << "\t";
file << locDofNumber << "\t"; //local Dof number
file << elInfo->getType() << "\n"; //element Type
locDofNumber++;
} while (elDofIter.next());
} else {
// traverse only VERTEX DOFS
for (int i = 0; i < mesh->getGeo(VERTEX); i++) {
DegreeOfFreedom dof = elInfo->getElement()->getDof(i, 0);
WorldVector<double> c = dofCoords[dof];
file << elInfo->getElement()->getIndex() << "\t"; //element number
file << elInfo->getLevel() << "\t"; //element Level
file << dof << "\t"; //dof number
file << VERTEX << "\t"; //dof type
file << c[0] << "\t"; //dof coords
file << c[1] << "\t";
file << c[2] << "\t";
file << i << "\t"; //local Dof number
file << elInfo->getType() << "\n"; //element Type
}
}
elInfo = stack.traverseNext(elInfo);
}
}
} }
...@@ -189,6 +189,16 @@ namespace AMDiS { ...@@ -189,6 +189,16 @@ namespace AMDiS {
static void followBoundary(Mesh *mesh, static void followBoundary(Mesh *mesh,
AtomicBoundary &bound, AtomicBoundary &bound,
MeshStructure &code); MeshStructure &code);
/** \brief
* Writes Element Map of local Rank
* Map containes for each DOF in each Element (resulting in massive doubling of DOFs):
* localElementNumber elementLevel localDOFNumber dofType dofCoords(0-2) elementLocalDOFNumber typeOfElement (0-2)
*/
static void writeCsvElementMap(const FiniteElemSpace *feSpace,
ParallelDofMapping &dofMap,
string prefix,
string postfix);
}; };
} // namespace AMDiS } // namespace AMDiS
......
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