Commit f22281e0 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

DOES NOT COMILE .... but must be submitted.

parent 0645a6bf
...@@ -34,16 +34,19 @@ namespace AMDiS { ...@@ -34,16 +34,19 @@ namespace AMDiS {
class DofComm class DofComm
{ {
public: public:
DofComm() {} DofComm()
: data(1)
{}
typedef map<const FiniteElemSpace*, DofContainer> FeMapType; typedef map<const FiniteElemSpace*, DofContainer> FeMapType;
typedef FeMapType::iterator FeMapIter; typedef FeMapType::iterator FeMapIter;
typedef map<int, FeMapType> DataType; // meshLevel: map[rank -> map[feSpace -> DofContainer]]
typedef vector<int, map<int, FeMapType> > DataType;
typedef DataType::iterator DataIter; typedef DataType::iterator DataIter;
DofContainer& getDofCont(int rank, const FiniteElemSpace *feSpace) DofContainer& getDofContainer(int rank, const FiniteElemSpace *feSpace)
{ {
return data[rank][feSpace]; return data[0][rank][feSpace];
} }
void removeEmpty(); void removeEmpty();
...@@ -75,7 +78,7 @@ namespace AMDiS { ...@@ -75,7 +78,7 @@ namespace AMDiS {
{ {
FUNCNAME("DofComm::Iterator::Iterator()"); FUNCNAME("DofComm::Iterator::Iterator()");
dataIter = dofComm.data.begin(); dataIter = dofComm.data[0].begin();
while (setNextFeMap() == false) while (setNextFeMap() == false)
++dataIter; ++dataIter;
...@@ -83,7 +86,7 @@ namespace AMDiS { ...@@ -83,7 +86,7 @@ namespace AMDiS {
inline bool end() inline bool end()
{ {
return (dataIter == dofComm.data.end()); return (dataIter == dofComm.data[0].end());
} }
inline void nextRank() inline void nextRank()
......
...@@ -30,10 +30,13 @@ ...@@ -30,10 +30,13 @@
#include "MacroElement.h" #include "MacroElement.h"
#include "Element.h" #include "Element.h"
#include "Boundary.h" #include "Boundary.h"
#include "parallel/MeshLevelData.h"
namespace AMDiS { namespace AMDiS {
typedef std::vector<std::pair<GeoIndex, int> > ExcludeList; using namespace std;
typedef vector<pair<GeoIndex, int> > ExcludeList;
/// Defines the geometrical objects that forms the boundary; /// Defines the geometrical objects that forms the boundary;
struct BoundaryObject { struct BoundaryObject {
...@@ -128,13 +131,23 @@ namespace AMDiS { ...@@ -128,13 +131,23 @@ namespace AMDiS {
*/ */
class InteriorBoundary { class InteriorBoundary {
public: public:
typedef std::map<int, std::vector<AtomicBoundary> > RankToBoundMap; typedef map<int, vector<AtomicBoundary> > RankToBoundMap;
/// Iterator for the interior boundary object. /// Iterator for the interior boundary object.
class iterator { class iterator {
public: public:
iterator(InteriorBoundary &b) iterator(InteriorBoundary &b)
: bound(b) : bound(b),
levelData(NULL),
level(0)
{
reset();
}
iterator(InteriorBoundary &b, MeshLevelData &levelData, int level)
: bound(b),
levelData(&levelData),
level(level)
{ {
reset(); reset();
} }
...@@ -209,9 +222,13 @@ namespace AMDiS { ...@@ -209,9 +222,13 @@ namespace AMDiS {
protected: protected:
RankToBoundMap::iterator mapIt; RankToBoundMap::iterator mapIt;
std::vector<AtomicBoundary>::iterator vecIt; vector<AtomicBoundary>::iterator vecIt;
InteriorBoundary &bound; InteriorBoundary &bound;
MeshLevelData *levelData;
int level;
}; };
public: public:
...@@ -225,19 +242,19 @@ namespace AMDiS { ...@@ -225,19 +242,19 @@ namespace AMDiS {
AtomicBoundary& getNewAtomic(int rank); AtomicBoundary& getNewAtomic(int rank);
/// Writes this object to a file. /// Writes this object to a file.
void serialize(std::ostream &out); void serialize(ostream &out);
/// Reads the state of an interior boundary from a file. /// Reads the state of an interior boundary from a file.
void deserialize(std::istream &in, std::map<int, Element*> &elIndexMap); void deserialize(istream &in, map<int, Element*> &elIndexMap);
/// Compares this interior boundaries with some other. The order of the /// Compares this interior boundaries with some other. The order of the
/// boundary elements within the object does not play a role. /// boundary elements within the object does not play a role.
bool operator==(const InteriorBoundary& other) const; bool operator==(const InteriorBoundary& other) const;
protected: protected:
void serializeExcludeList(std::ostream &out, ExcludeList &list); void serializeExcludeList(ostream &out, ExcludeList &list);
void deserializeExcludeList(std::istream &in, ExcludeList &list); void deserializeExcludeList(istream &in, ExcludeList &list);
public: public:
RankToBoundMap boundary; RankToBoundMap boundary;
......
...@@ -1874,16 +1874,22 @@ namespace AMDiS { ...@@ -1874,16 +1874,22 @@ namespace AMDiS {
sendDofs.clear(); sendDofs.clear();
recvDofs.clear(); recvDofs.clear();
int nLevels = levelData.getLevelNumber();
for (unsigned int i = 0; i < feSpaces.size(); i++) for (unsigned int i = 0; i < feSpaces.size(); i++)
createBoundaryDofs(feSpaces[i]); for (int j = 0; j < nLevels; j++)
createBoundaryDofs(feSpaces[i], j);
} }
void MeshDistributor::createBoundaryDofs(const FiniteElemSpace *feSpace) void MeshDistributor::createBoundaryDofs(const FiniteElemSpace *feSpace, int level)
{ {
FUNCNAME("MeshDistributor::createBoundaryDofs()"); FUNCNAME("MeshDistributor::createBoundaryDofs()");
if (createBoundaryDofFlag.isSet(BOUNDARY_SUBOBJ_SORTED)) { if (createBoundaryDofFlag.isSet(BOUNDARY_SUBOBJ_SORTED)) {
TEST_EXIT(level == 0)
("This function does not support the usage of multi level structure!\n");
// === Clear data. === // === Clear data. ===
for (int geo = FACE; geo >= VERTEX; geo--) for (int geo = FACE; geo >= VERTEX; geo--)
...@@ -1896,7 +1902,7 @@ namespace AMDiS { ...@@ -1896,7 +1902,7 @@ namespace AMDiS {
DofContainer dofs; DofContainer dofs;
it->rankObj.el->getAllDofs(feSpace, it->rankObj, dofs); it->rankObj.el->getAllDofs(feSpace, it->rankObj, dofs);
DofContainer& tmp = sendDofs.getDofCont(it.getRank(), feSpace); DofContainer& tmp = sendDofs.getDofContainer(it.getRank(), feSpace);
tmp.insert(tmp.end(), dofs.begin(), dofs.end()); tmp.insert(tmp.end(), dofs.begin(), dofs.end());
if (createBoundaryDofFlag.isSet(BOUNDARY_FILL_INFO_SEND_DOFS)) if (createBoundaryDofFlag.isSet(BOUNDARY_FILL_INFO_SEND_DOFS))
...@@ -1912,7 +1918,7 @@ namespace AMDiS { ...@@ -1912,7 +1918,7 @@ namespace AMDiS {
DofContainer dofs; DofContainer dofs;
it->rankObj.el->getAllDofs(feSpace, it->rankObj, dofs); it->rankObj.el->getAllDofs(feSpace, it->rankObj, dofs);
DofContainer& tmp = recvDofs.getDofCont(it.getRank(), feSpace); DofContainer& tmp = recvDofs.getDofContainer(it.getRank(), feSpace);
tmp.insert(tmp.end(), dofs.begin(), dofs.end()); tmp.insert(tmp.end(), dofs.begin(), dofs.end());
if (createBoundaryDofFlag.isSet(BOUNDARY_FILL_INFO_RECV_DOFS)) if (createBoundaryDofFlag.isSet(BOUNDARY_FILL_INFO_RECV_DOFS))
...@@ -1921,13 +1927,15 @@ namespace AMDiS { ...@@ -1921,13 +1927,15 @@ namespace AMDiS {
} }
} }
} else { } else {
for (InteriorBoundary::iterator it(rankIntBoundary); !it.end(); ++it) for (InteriorBoundary::iterator it(rankIntBoundary, levelData, level);
!it.end(); ++it)
it->rankObj.el->getAllDofs(feSpace, it->rankObj, it->rankObj.el->getAllDofs(feSpace, it->rankObj,
sendDofs.getDofCont(it.getRank(), feSpace)); sendDofs.getDofContainer(it.getRank(), feSpace));
for (InteriorBoundary::iterator it(otherIntBoundary); !it.end(); ++it) for (InteriorBoundary::iterator it(otherIntBoundary, levelData, level);
!it.end(); ++it)
it->rankObj.el->getAllDofs(feSpace, it->rankObj, it->rankObj.el->getAllDofs(feSpace, it->rankObj,
recvDofs.getDofCont(it.getRank(), feSpace)); recvDofs.getDofContainer(it.getRank(), feSpace));
} }
// === Delete all empty DOF send and recv positions === // === Delete all empty DOF send and recv positions ===
...@@ -2010,8 +2018,12 @@ namespace AMDiS { ...@@ -2010,8 +2018,12 @@ namespace AMDiS {
sort(rankDofs.begin(), rankDofs.end(), cmpDofsByValue); sort(rankDofs.begin(), rankDofs.end(), cmpDofsByValue);
int nRankAllDofs = rankDofs.size(); int nRankAllDofs = rankDofs.size();
// === Traverse interior boundaries and get all DOFs on them. === // === Traverse interior boundaries and get all DOFs on them. ===
createBoundaryDofs(feSpace);
int nLevels = levelData.getLevelNumber();
for (int i = 0; i < nLevels; i++)
createBoundaryDofs(feSpace, i);
// All DOFs that must be received are DOFs not owned by rank and have // All DOFs that must be received are DOFs not owned by rank and have
// therefore to be removed from the set 'rankDofs'. // therefore to be removed from the set 'rankDofs'.
...@@ -2170,7 +2182,7 @@ namespace AMDiS { ...@@ -2170,7 +2182,7 @@ namespace AMDiS {
// Here we have a periodic boundary between two ranks. // Here we have a periodic boundary between two ranks.
// Create DOF indices on the boundary. // Create DOF indices on the boundary.
DofContainer& dofs = periodicDofs.getDofCont(it->first, feSpace); DofContainer& dofs = periodicDofs.getDofContainer(it->first, feSpace);
for (vector<AtomicBoundary>::iterator boundIt = it->second.begin(); for (vector<AtomicBoundary>::iterator boundIt = it->second.begin();
boundIt != it->second.end(); ++boundIt) { boundIt != it->second.end(); ++boundIt) {
...@@ -2203,7 +2215,7 @@ namespace AMDiS { ...@@ -2203,7 +2215,7 @@ namespace AMDiS {
for (RankToBoundMap::iterator it = periodicBoundary.boundary.begin(); for (RankToBoundMap::iterator it = periodicBoundary.boundary.begin();
it != periodicBoundary.boundary.end(); ++it) { it != periodicBoundary.boundary.end(); ++it) {
DofContainer& dofs = periodicDofs.getDofCont(it->first, feSpace); DofContainer& dofs = periodicDofs.getDofContainer(it->first, feSpace);
vector<int>& types = rankToDofType[it->first]; vector<int>& types = rankToDofType[it->first];
TEST_EXIT_DBG(dofs.size() == types.size())("Should not happen!\n"); TEST_EXIT_DBG(dofs.size() == types.size())("Should not happen!\n");
......
...@@ -472,7 +472,7 @@ namespace AMDiS { ...@@ -472,7 +472,7 @@ namespace AMDiS {
void createBoundaryDofs(); void createBoundaryDofs();
void createBoundaryDofs(const FiniteElemSpace *feSpace); void createBoundaryDofs(const FiniteElemSpace *feSpace, int level);
/// Removes all macro elements from the mesh that are not part of ranks /// Removes all macro elements from the mesh that are not part of ranks
/// partition. /// partition.
......
...@@ -454,7 +454,8 @@ namespace AMDiS { ...@@ -454,7 +454,8 @@ namespace AMDiS {
MSG("%s\n", oss.str().c_str()); MSG("%s\n", oss.str().c_str());
debug::printInfoByDof(feSpace, debug::printInfoByDof(feSpace,
*(pdb.recvDofs.getDofCont(it->first, feSpace)[i])); *(pdb.recvDofs.getDofContainer(it->first,
feSpace)[i]));
} }
ERROR("Wrong DOFs in rank %d!\n", pdb.mpiRank); ERROR("Wrong DOFs in rank %d!\n", pdb.mpiRank);
foundError = 1; foundError = 1;
......
...@@ -188,7 +188,8 @@ namespace AMDiS { ...@@ -188,7 +188,8 @@ namespace AMDiS {
: PetscSolver(), : PetscSolver(),
schurPrimalSolver(0), schurPrimalSolver(0),
multiLevelTest(false), multiLevelTest(false),
subDomainSolver(NULL) subDomainSolver(NULL),
meshLevel(0)
{ {
FUNCNAME("PetscSolverFeti::PetscSolverFeti()"); FUNCNAME("PetscSolverFeti::PetscSolverFeti()");
...@@ -214,6 +215,8 @@ namespace AMDiS { ...@@ -214,6 +215,8 @@ namespace AMDiS {
schurPrimalSolver); schurPrimalSolver);
Parameters::get("parallel->multi level test", multiLevelTest); Parameters::get("parallel->multi level test", multiLevelTest);
if (multiLevelTest)
meshLevel = 1;
} }
...@@ -221,6 +224,9 @@ namespace AMDiS { ...@@ -221,6 +224,9 @@ namespace AMDiS {
{ {
FUNCNAME("PetscSolverFeti::initialize()"); FUNCNAME("PetscSolverFeti::initialize()");
TEST_EXIT_DBG(meshLevel + 1 == meshDistributor->getMeshLevelData().getLevelNumber())
("Mesh hierarchy does not contain %d levels!\n", meshLevel + 1);
if (subDomainSolver == NULL) if (subDomainSolver == NULL)
subDomainSolver = new SubDomainSolver(meshDistributor, mpiComm, mpiSelfComm); subDomainSolver = new SubDomainSolver(meshDistributor, mpiComm, mpiSelfComm);
...@@ -1253,11 +1259,10 @@ namespace AMDiS { ...@@ -1253,11 +1259,10 @@ namespace AMDiS {
int debug = 0; int debug = 0;
Parameters::get("parallel->debug feti", debug); Parameters::get("parallel->debug feti", debug);
if (debug) { if (debug)
solveFetiMatrix(vec); solveFetiMatrix(vec);
} else { else
solveReducedFetiMatrix(vec); solveReducedFetiMatrix(vec);
}
MeshDistributor::globalMeshDistributor->synchVector(vec); MeshDistributor::globalMeshDistributor->synchVector(vec);
} }
......
...@@ -243,6 +243,8 @@ namespace AMDiS { ...@@ -243,6 +243,8 @@ namespace AMDiS {
bool multiLevelTest; bool multiLevelTest;
SubDomainSolver *subDomainSolver; SubDomainSolver *subDomainSolver;
int meshLevel;
}; };
} }
......
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