Commit 5f0d2ca0 authored by Thomas Witkowski's avatar Thomas Witkowski

At least, it compiles. Will never work, never, never ....

parent 9c8a9a5c
...@@ -99,6 +99,7 @@ namespace AMDiS { ...@@ -99,6 +99,7 @@ namespace AMDiS {
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS #ifdef HAVE_PARALLEL_DOMAIN_AMDIS
class FeSpaceDofMap; class FeSpaceDofMap;
class MeshLevelData;
#endif #endif
struct BoundaryObject; struct BoundaryObject;
......
...@@ -238,7 +238,7 @@ namespace AMDiS { ...@@ -238,7 +238,7 @@ namespace AMDiS {
if (condition->applyBoundaryCondition()) { if (condition->applyBoundaryCondition()) {
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS #ifdef HAVE_PARALLEL_DOMAIN_AMDIS
if (dofMap->isRankDof(rowIndices[i])) if (dofMap->isRankDof(rowIndices[i], 0))
applyDBCs.insert(static_cast<int>(row)); applyDBCs.insert(static_cast<int>(row));
#else #else
applyDBCs.insert(static_cast<int>(row)); applyDBCs.insert(static_cast<int>(row));
......
...@@ -248,7 +248,7 @@ namespace AMDiS { ...@@ -248,7 +248,7 @@ namespace AMDiS {
{ {
TEST_EXIT_DBG(dofMap)("No rank dofs set!\n"); TEST_EXIT_DBG(dofMap)("No rank dofs set!\n");
return dofMap->isRankDof(dof); return dofMap->isRankDof(dof, 0);
} }
#endif #endif
......
...@@ -54,6 +54,8 @@ namespace AMDiS { ...@@ -54,6 +54,8 @@ namespace AMDiS {
void Spreadsheet::read(string filename) void Spreadsheet::read(string filename)
{ {
FUNCNAME("Spreadsheet::read()");
data.clear(); data.clear();
string line; string line;
......
...@@ -41,7 +41,26 @@ namespace AMDiS { ...@@ -41,7 +41,26 @@ namespace AMDiS {
} }
} }
int DofComm::getNumberDofs(int level, const FiniteElemSpace *feSpace)
{
FUNCNAME("DofComm::getNumberDofs()");
TEST_EXIT_DBG(level < data.size())("Should not happen!\n");
DofContainerSet dofs;
for (DataIter rankIt = data[level].begin();
rankIt != data[level].end(); ++rankIt)
for (FeMapIter feIt = rankIt->second.begin();
feIt != rankIt->second.end(); ++feIt)
if (feIt->first == feSpace)
dofs.insert(feIt->second.begin(), feIt->second.end());
return static_cast<int>(dofs.size());
}
bool DofComm::Iterator::setNextFeMap() bool DofComm::Iterator::setNextFeMap()
{ {
FUNCNAME("DofComm::Iterator::setNextFeMap()"); FUNCNAME("DofComm::Iterator::setNextFeMap()");
......
...@@ -65,6 +65,8 @@ namespace AMDiS { ...@@ -65,6 +65,8 @@ namespace AMDiS {
return data[level]; return data[level];
} }
int getNumberDofs(int level, const FiniteElemSpace *feSpace);
protected: protected:
LevelDataType data; LevelDataType data;
......
...@@ -376,9 +376,13 @@ namespace AMDiS { ...@@ -376,9 +376,13 @@ namespace AMDiS {
} }
void ElementObjectDatabase::createRankData(map<int, int>& macroElementRankMap) void ElementObjectDatabase::createRankData(map<int, int>& macroElementRankMap,
MeshLevelData& levelData)
{ {
FUNCNAME("ElementObjectDatabase::createRankData()"); FUNCNAME("ElementObjectDatabase::createRankData()");
int nLevel = levelData.getLevelNumber();
TEST_EXIT_DBG(nLevel > 0)("Should not happen!\n");
vertexOwner.clear(); vertexOwner.clear();
vertexInRank.clear(); vertexInRank.clear();
...@@ -391,7 +395,11 @@ namespace AMDiS { ...@@ -391,7 +395,11 @@ namespace AMDiS {
if (it2->elIndex > vertexInRank[it->first][elementInRank].elIndex) if (it2->elIndex > vertexInRank[it->first][elementInRank].elIndex)
vertexInRank[it->first][elementInRank] = *it2; vertexInRank[it->first][elementInRank] = *it2;
vertexOwner[it->first] = std::max(vertexOwner[it->first], elementInRank); for (int level = 0; level < nLevel; level++) {
int levelId = levelData.getLevelId(level, elementInRank);
vertexOwner[it->first][level] =
std::max(vertexOwner[it->first][level], levelId);
}
} }
} }
...@@ -407,7 +415,11 @@ namespace AMDiS { ...@@ -407,7 +415,11 @@ namespace AMDiS {
if (it2->elIndex > edgeInRank[it->first][elementInRank].elIndex) if (it2->elIndex > edgeInRank[it->first][elementInRank].elIndex)
edgeInRank[it->first][elementInRank] = *it2; edgeInRank[it->first][elementInRank] = *it2;
edgeOwner[it->first] = std::max(edgeOwner[it->first], elementInRank); for (int level = 0; level < nLevel; level++) {
int levelId = levelData.getLevelId(level, elementInRank);
edgeOwner[it->first][level] =
std::max(edgeOwner[it->first][level], levelId);
}
} }
} }
...@@ -423,7 +435,11 @@ namespace AMDiS { ...@@ -423,7 +435,11 @@ namespace AMDiS {
if (it2->elIndex > faceInRank[it->first][elementInRank].elIndex) if (it2->elIndex > faceInRank[it->first][elementInRank].elIndex)
faceInRank[it->first][elementInRank] = *it2; faceInRank[it->first][elementInRank] = *it2;
faceOwner[it->first] = std::max(faceOwner[it->first], elementInRank); for (int level = 0; level < nLevel; level++) {
int levelId = levelData.getLevelId(level, elementInRank);
faceOwner[it->first][level] =
std::max(faceOwner[it->first][level], levelId);
}
} }
} }
} }
...@@ -597,11 +613,12 @@ namespace AMDiS { ...@@ -597,11 +613,12 @@ namespace AMDiS {
} }
ERROR_EXIT("REWRITE SERIALIZATION!\n");
/*
SerUtil::serialize(out, vertexOwner); SerUtil::serialize(out, vertexOwner);
SerUtil::serialize(out, edgeOwner); SerUtil::serialize(out, edgeOwner);
SerUtil::serialize(out, faceOwner); SerUtil::serialize(out, faceOwner);
*/
nSize = vertexInRank.size(); nSize = vertexInRank.size();
SerUtil::serialize(out, nSize); SerUtil::serialize(out, nSize);
...@@ -737,6 +754,7 @@ namespace AMDiS { ...@@ -737,6 +754,7 @@ namespace AMDiS {
} }
ERROR_EXIT("REWRITE DESERIALIZATION!\n");
SerUtil::deserialize(in, vertexOwner); SerUtil::deserialize(in, vertexOwner);
SerUtil::deserialize(in, edgeOwner); SerUtil::deserialize(in, edgeOwner);
SerUtil::deserialize(in, faceOwner); SerUtil::deserialize(in, faceOwner);
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <boost/tuple/tuple.hpp> #include <boost/tuple/tuple.hpp>
#include <boost/tuple/tuple_comparison.hpp> #include <boost/tuple/tuple_comparison.hpp>
#include "AMDiS_fwd.h"
#include "Containers.h" #include "Containers.h"
#include "Global.h" #include "Global.h"
#include "Boundary.h" #include "Boundary.h"
...@@ -144,7 +145,8 @@ namespace AMDiS { ...@@ -144,7 +145,8 @@ namespace AMDiS {
* \param[in] macroElementRankMap Maps to each macro element of the mesh * \param[in] macroElementRankMap Maps to each macro element of the mesh
* the rank that owns this macro element. * the rank that owns this macro element.
*/ */
void createRankData(map<int, int>& macroElementRankMap); void createRankData(map<int, int>& macroElementRankMap,
MeshLevelData& levelData);
/** \brief /** \brief
...@@ -257,17 +259,17 @@ namespace AMDiS { ...@@ -257,17 +259,17 @@ namespace AMDiS {
/// Returns the rank owner of the current iterator position. /// Returns the rank owner of the current iterator position.
int getIterateOwner() int getIterateOwner(int level)
{ {
switch (iterGeoPos) { switch (iterGeoPos) {
case VERTEX: case VERTEX:
return vertexOwner[vertexIter->first]; return vertexOwner[vertexIter->first][level];
break; break;
case EDGE: case EDGE:
return edgeOwner[edgeIter->first]; return edgeOwner[edgeIter->first][level];
break; break;
case FACE: case FACE:
return faceOwner[faceIter->first]; return faceOwner[faceIter->first][level];
break; break;
default: default:
ERROR_EXIT("Should not happen!\n"); ERROR_EXIT("Should not happen!\n");
...@@ -279,21 +281,21 @@ namespace AMDiS { ...@@ -279,21 +281,21 @@ namespace AMDiS {
/// Returns the rank owner of a vertex DOF. /// Returns the rank owner of a vertex DOF.
int getOwner(DegreeOfFreedom vertex) int getOwner(DegreeOfFreedom vertex, int level)
{ {
return vertexOwner[vertex]; return vertexOwner[vertex][level];
} }
/// Returns the rank owner of an edge. /// Returns the rank owner of an edge.
int getOwner(DofEdge edge) int getOwner(DofEdge edge, int level)
{ {
return edgeOwner[edge]; return edgeOwner[edge][level];
} }
/// Returns the rank owner of an face. /// Returns the rank owner of an face.
int getOwner(DofFace face) int getOwner(DofFace face, int level)
{ {
return faceOwner[face]; return faceOwner[face][level];
} }
...@@ -540,15 +542,17 @@ namespace AMDiS { ...@@ -540,15 +542,17 @@ namespace AMDiS {
/// Maps to an element object the corresponding face. /// Maps to an element object the corresponding face.
map<ElementObjectData, DofFace> faceLocalMap; map<ElementObjectData, DofFace> faceLocalMap;
/// Maps from level to rank number
typedef map<int, int> LevelRank;
/// Defines for all vertex DOFs the rank that ownes this vertex DOF. /// Defines for all vertex DOFs the rank that ownes this vertex DOF.
map<DegreeOfFreedom, int> vertexOwner; map<DegreeOfFreedom, LevelRank> vertexOwner;
/// Defines for all edges the rank that ownes this edge. /// Defines for all edges the rank that ownes this edge.
map<DofEdge, int> edgeOwner; map<DofEdge, LevelRank> edgeOwner;
/// Defines for all faces the rank that ownes this face. /// Defines for all faces the rank that ownes this face.
map<DofFace, int> faceOwner; map<DofFace, LevelRank> faceOwner;
/// Defines to each vertex DOF a map that maps to each rank number the element /// Defines to each vertex DOF a map that maps to each rank number the element
......
...@@ -18,10 +18,11 @@ ...@@ -18,10 +18,11 @@
namespace AMDiS { namespace AMDiS {
AtomicBoundary& InteriorBoundary::getNewAtomic(int rank) AtomicBoundary& InteriorBoundary::getNewAtomic(int level, int rank)
{ {
boundary[rank].resize(boundary[rank].size() + 1); int size = boundary[level][rank].size();
return boundary[rank][boundary[rank].size() - 1]; boundary[level][rank].resize(size + 1);
return boundary[level][rank][size];
} }
...@@ -29,32 +30,51 @@ namespace AMDiS { ...@@ -29,32 +30,51 @@ namespace AMDiS {
{ {
InteriorBoundary& other2 = const_cast<InteriorBoundary&>(other); InteriorBoundary& other2 = const_cast<InteriorBoundary&>(other);
for (RankToBoundMap::const_iterator it = boundary.begin(); if (boundary.size() != other2.boundary.size())
it != boundary.end(); ++it) { return false;
if (other2.boundary.count(it->first) == 0)
return false; for (unsigned int level = 0; level < boundary.size(); level++) {
for (RankToBoundMap::const_iterator it = boundary[level].begin();
if (other2.boundary[it->first].size() != it->second.size()) it != boundary[level].end(); ++it) {
return false; if (other2.boundary[level].count(it->first) == 0)
return false;
for (unsigned int i = 0; i < it->second.size(); i++) {
std::vector<AtomicBoundary>::iterator bIt = if (other2.boundary[level][it->first].size() != it->second.size())
find(other2.boundary[it->first].begin(), return false;
other2.boundary[it->first].end(), it->second[i]);
if (bIt == other2.boundary[it->first].end()) for (unsigned int i = 0; i < it->second.size(); i++) {
return false; std::vector<AtomicBoundary>::iterator bIt =
} find(other2.boundary[level][it->first].begin(),
other2.boundary[level][it->first].end(), it->second[i]);
if (bIt == other2.boundary[level][it->first].end())
return false;
}
}
} }
return true; return true;
} }
void InteriorBoundary::reset(int level)
{
FUNCNAME("InteriorBoundary::reset()");
nLevel = level;
boundary.clear();
boundary.resize(nLevel);
}
void InteriorBoundary::serialize(std::ostream &out) void InteriorBoundary::serialize(std::ostream &out)
{ {
FUNCNAME("InteriorBoundary::serialize()"); FUNCNAME("InteriorBoundary::serialize()");
ERROR_EXIT("REWRITE TO MULTILEVEL STRUCTURE!\n");
#if 0
int mSize = boundary.size(); int mSize = boundary.size();
SerUtil::serialize(out, mSize); SerUtil::serialize(out, mSize);
for (RankToBoundMap::iterator it = boundary.begin(); for (RankToBoundMap::iterator it = boundary.begin();
...@@ -83,6 +103,7 @@ namespace AMDiS { ...@@ -83,6 +103,7 @@ namespace AMDiS {
SerUtil::serialize(out, bound.type); SerUtil::serialize(out, bound.type);
} }
} }
#endif
} }
...@@ -91,6 +112,9 @@ namespace AMDiS { ...@@ -91,6 +112,9 @@ namespace AMDiS {
{ {
FUNCNAME("InteriorBoundary::deserialize()"); FUNCNAME("InteriorBoundary::deserialize()");
ERROR_EXIT("REWRITE TO MULTILEVEL STRUCTURE!\n");
#if 0
int mSize = 0; int mSize = 0;
SerUtil::deserialize(in, mSize); SerUtil::deserialize(in, mSize);
for (int i = 0; i < mSize; i++) { for (int i = 0; i < mSize; i++) {
...@@ -137,6 +161,7 @@ namespace AMDiS { ...@@ -137,6 +161,7 @@ namespace AMDiS {
bound.neighObj.el = NULL; bound.neighObj.el = NULL;
} }
} }
#endif
} }
......
...@@ -47,34 +47,35 @@ namespace AMDiS { ...@@ -47,34 +47,35 @@ namespace AMDiS {
public: public:
iterator(InteriorBoundary &b) iterator(InteriorBoundary &b)
: bound(b), : bound(b),
levelData(NULL),
level(0) level(0)
{ {
reset(); reset();
} }
iterator(InteriorBoundary &b, MeshLevelData &levelData, int level) iterator(InteriorBoundary &b, int level)
: bound(b), : bound(b),
levelData(&levelData),
level(level) level(level)
{ {
TEST_EXIT_DBG(level < bound.boundary.size())
("Should not happen!\n");
reset(); reset();
} }
/// Set the iterator to the first position. /// Set the iterator to the first position.
void reset() void reset()
{ {
mapIt = bound.boundary.begin(); mapIt = bound.boundary[level].begin();
nextNonempty(); nextNonempty();
if (mapIt != bound.boundary.end()) if (mapIt != bound.boundary[level].end())
vecIt = mapIt->second.begin(); vecIt = mapIt->second.begin();
} }
/// Test if iterator is at the final position. /// Test if iterator is at the final position.
bool end() const bool end() const
{ {
return (mapIt == bound.boundary.end()); return (mapIt == bound.boundary[level].end());
} }
/// Move iterator to the next position. /// Move iterator to the next position.
...@@ -85,7 +86,7 @@ namespace AMDiS { ...@@ -85,7 +86,7 @@ namespace AMDiS {
++mapIt; ++mapIt;
nextNonempty(); nextNonempty();
if (mapIt != bound.boundary.end()) if (mapIt != bound.boundary[level].end())
vecIt = mapIt->second.begin(); vecIt = mapIt->second.begin();
} }
} }
...@@ -105,22 +106,12 @@ namespace AMDiS { ...@@ -105,22 +106,12 @@ namespace AMDiS {
++mapIt; ++mapIt;
nextNonempty(); nextNonempty();
if (mapIt != bound.boundary.end()) if (mapIt != bound.boundary[level].end())
vecIt = mapIt->second.begin(); vecIt = mapIt->second.begin();
} }
inline int getRank() inline int getRank()
{ {
if (level > 0) {
int r = levelData->mapRank(mapIt->first, level - 1, level);
TEST_EXIT_DBG(r >= 0)
("Mapping rank %d from level % to level %d does not work!\n",
mapIt->first, level - 1, level);
return r;
}
return mapIt->first; return mapIt->first;
} }
...@@ -128,25 +119,13 @@ namespace AMDiS { ...@@ -128,25 +119,13 @@ namespace AMDiS {
inline void nextNonempty() inline void nextNonempty()
{ {
if (mapIt == bound.boundary.end()) if (mapIt == bound.boundary[level].end())
return; return;
if (level > 0) { while (mapIt->second.size() == 0) {
TEST_EXIT_DBG(levelData)("No mesh level data object defined!\n"); ++mapIt;
TEST_EXIT_DBG(level == 1)("Only 2-level method supported!\n"); if (mapIt == bound.boundary[level].end())
return;
while (!levelData->rankInSubdomain(mapIt->first, level) ||
mapIt->second.size() == 0) {
++mapIt;
if (mapIt == bound.boundary.end())
return;
}
} else {
while (mapIt->second.size() == 0) {
++mapIt;
if (mapIt == bound.boundary.end())
return;
}
} }
} }
...@@ -157,20 +136,19 @@ namespace AMDiS { ...@@ -157,20 +136,19 @@ namespace AMDiS {
InteriorBoundary &bound; InteriorBoundary &bound;
MeshLevelData *levelData;
int level; int level;
}; };