Commit 8dcb7520 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Work on pdd.

parent 6fd5f942
......@@ -68,6 +68,10 @@ namespace AMDiS {
// and now partition the mesh
partitionMesh(adaptInfo);
#if (DEBUG != 0)
ElementIdxToDofs elMap;
DbgCreateElementMap(elMap);
#endif
// === Create new global and local DOF numbering. ===
......@@ -86,9 +90,12 @@ namespace AMDiS {
createInteriorBoundaryInfo(rankDOFs, boundaryDOFs);
#if (DEBUG != 0)
DbgTestElementMap(elMap);
DbgTestInteriorBoundary();
#endif
exit(0);
// === Remove all macro elements that are not part of the rank partition. ===
removeMacroElements();
......@@ -638,7 +645,7 @@ namespace AMDiS {
mapGlobalLocalDOFs[rstart + i] = i;
isRankDOF[i] = true;
}
#if 0
// === Change dof indices at boundary from other ranks. ===
// Within this small data structure we track which dof index was already changed.
......@@ -690,6 +697,7 @@ namespace AMDiS {
delete [] recvBuffers[i];
}
#endif
}
......@@ -1082,9 +1090,63 @@ namespace AMDiS {
}
}
sort(rankDOFs.begin(), rankDOFs.end(), cmpDofsByValue);
}
void ParallelDomainBase::DbgCreateElementMap(ElementIdxToDofs &elMap)
{
FUNCNAME("ParallelDomainBase::DbgCreateElementMap()");
TEST_EXIT(mesh->getDim() == 2)("Works only for 2d!\n");
elMap.clear();
TraverseStack stack;
ElInfo *elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_LEAF_EL);
while (elInfo) {
Element *el = elInfo->getElement();
if (mpiRank == 0) std::cout << "EL = " << el->getIndex() << std::endl;
orderDOFs(el->getDOF(0), el->getDOF(1), el->getDOF(2), elMap[el->getIndex()]);
elInfo = stack.traverseNext(elInfo);
}
}
void ParallelDomainBase::DbgTestElementMap(ElementIdxToDofs &elMap)
{
FUNCNAME("ParallelDomainbase::DbgTestElementMap()");
TEST_EXIT(mesh->getDim() == 2)("Works only for 2d!\n");
DofContainer vec(3);
TraverseStack stack;
ElInfo *elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_LEAF_EL);
while (elInfo) {
Element *el = elInfo->getElement();
if (mpiRank == 0) std::cout << "EL = " << el->getIndex() << std::endl;
orderDOFs(el->getDOF(0), el->getDOF(1), el->getDOF(2), vec);
for (int i = 0; i < 3; i++) {
if (elMap[el->getIndex()][i] != vec[i]) {
std::cout << "[DBG " << mpiRank
<< "]: Wrong new dof numeration in element = "
<< el->getIndex() << std::endl;
std::cout << "[DBG " << mpiRank << "]: Old numeration was: ";
for (int j = 0; j < 3; j++)
std::cout << elMap[el->getIndex()][j] << " = "
<< *(elMap[el->getIndex()][j]) << " ";
std::cout << std::endl;
std::cout << "[DBG " << mpiRank << "]: New numeration is: ";
for (int j = 0; j < 3; j++)
std::cout << vec[j] << " = " << *(vec[j]) << " ";
std::cout << std::endl;
ERROR_EXIT("WRONG NEW DOF NUMERATION!\n");
}
}
elInfo = stack.traverseNext(elInfo);
}
}
void ParallelDomainBase::DbgTestInteriorBoundary()
{
FUNCNAME("ParallelDomainBase::DbgTestInteriorBoundary()");
......
......@@ -70,6 +70,8 @@ namespace AMDiS {
/// Forward type (it maps rank numbers to the interior boundary objects).
typedef InteriorBoundary::RankToBoundMap RankToBoundMap;
typedef std::map<int, DofContainer> ElementIdxToDofs;
public:
ParallelDomainBase(const std::string& name,
ProblemIterationInterface *iterationIF,
......@@ -202,6 +204,9 @@ namespace AMDiS {
DofContainer& rankDOFs,
DofToRank& boundaryDOFs);
void DbgCreateElementMap(ElementIdxToDofs &elMap);
void DbgTestElementMap(ElementIdxToDofs &elMap);
void DbgTestInteriorBoundary();
......@@ -213,6 +218,42 @@ namespace AMDiS {
*/
void DbgTestCommonDofs();
inline void orderDOFs(const DegreeOfFreedom* dof1,
const DegreeOfFreedom* dof2,
const DegreeOfFreedom* dof3,
DofContainer &vec)
{
vec.resize(3);
if (mpiRank == 0)
std::cout << "DOFS are: "
<< dof1 << " = " << *dof1 << " "
<< dof2 << " = " << *dof2 << " "
<< dof3 << " = " << *dof3 << " "
<< std::endl;
if (*dof1 < *dof2 && *dof1 < *dof3)
vec[0] = dof1;
else if (*dof2 < *dof1 && *dof2 < *dof3)
vec[0] = dof2;
else
vec[0] = dof3;
if (*dof1 > *dof2 && *dof1 > *dof3)
vec[2] = dof1;
else if (*dof2 > *dof1 && *dof2 > *dof3)
vec[2] = dof2;
else
vec[2] = dof3;
if (dof1 != vec[0] && dof1 != vec[2])
vec[1] = dof1;
else if (dof2 != vec[0] && dof2 != vec[2])
vec[1] = dof2;
else
vec[1] = dof3;
}
protected:
///
ProblemIterationInterface *iterationIF;
......@@ -326,6 +367,11 @@ namespace AMDiS {
DofToBool isRankDOF;
};
bool cmpDofsByValue(const DegreeOfFreedom* dof1, const DegreeOfFreedom* dof2)
{
return (*dof1 < *dof2);
}
class ParallelDomainScal : public ParallelDomainBase
{
public:
......
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