Commit 8cce62bb authored by Thomas Witkowski's avatar Thomas Witkowski

Just some small changes.

parent bb1e643b
...@@ -24,7 +24,7 @@ namespace AMDiS { ...@@ -24,7 +24,7 @@ namespace AMDiS {
mtl::par::environment* mtl_environment=NULL; mtl::par::environment* mtl_environment=NULL;
#endif #endif
void init(int argc, char **argv) void init(int argc, char **argv, std::string initFileName)
{ {
FUNCNAME("AMDiS::init()"); FUNCNAME("AMDiS::init()");
...@@ -42,9 +42,13 @@ namespace AMDiS { ...@@ -42,9 +42,13 @@ namespace AMDiS {
#endif #endif
#endif #endif
TEST_EXIT(argc >= 2)("No init file!\n"); if (initFileName == "") {
TEST_EXIT(argc >= 2)("No init file!\n");
Parameters::init(string(argv[1]));
} else {
Parameters::init(initFileName);
}
Parameters::init(string(argv[1]));
Parameters::readArgv(argc, argv); Parameters::readArgv(argc, argv);
} }
......
...@@ -153,8 +153,8 @@ ...@@ -153,8 +153,8 @@
namespace AMDiS { namespace AMDiS {
void init(int argc, char **argv); void init(int argc, char **argv, std::string initFileName = "");
void init(std::string initFileName); void init(std::string initFileName);
void finalize(); void finalize();
......
...@@ -451,7 +451,12 @@ namespace AMDiS { ...@@ -451,7 +451,12 @@ namespace AMDiS {
/// Adds a stationary problem to the global mesh distributor objects. /// Adds a stationary problem to the global mesh distributor objects.
static void addProblemStatGlobal(ProblemStatSeq *probStat); static void addProblemStatGlobal(ProblemStatSeq *probStat);
MeshLevelData& getMeshLevelData()
{
return levelData;
}
protected: protected:
void addProblemStat(ProblemStatSeq *probStat); void addProblemStat(ProblemStatSeq *probStat);
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
// See also license.opensource.txt in the distribution. // See also license.opensource.txt in the distribution.
#include <boost/lexical_cast.hpp>
#include "parallel/MeshLevelData.h" #include "parallel/MeshLevelData.h"
#include "Global.h" #include "Global.h"
...@@ -24,8 +25,8 @@ namespace AMDiS { ...@@ -24,8 +25,8 @@ namespace AMDiS {
levelRanks[0].insert(-1); levelRanks[0].insert(-1);
nLevel = 1; nLevel = 1;
levelNeighbour.resize(1); levelNeighbours.resize(1);
levelNeighbour[0] = neighbourRanks; levelNeighbours[0] = neighbourRanks;
} }
...@@ -39,13 +40,13 @@ namespace AMDiS { ...@@ -39,13 +40,13 @@ namespace AMDiS {
levelRanks.insert(levelRanks.begin(), ranksInDomain); levelRanks.insert(levelRanks.begin(), ranksInDomain);
nLevel++; nLevel++;
levelNeighbour.resize(2); levelNeighbours.resize(2);
levelNeighbour[1] = levelNeighbour[0]; levelNeighbours[1] = levelNeighbours[0];
levelNeighbour[0].clear(); levelNeighbours[0].clear();
for (std::set<int>::iterator it = levelNeighbour[1].begin(); for (std::set<int>::iterator it = levelNeighbours[1].begin();
it != levelNeighbour[1].end(); ++it) it != levelNeighbours[1].end(); ++it)
if (levelRanks[0].count(*it) == 0) if (levelRanks[0].count(*it) == 0)
levelNeighbour[0].insert(*it); levelNeighbours[0].insert(*it);
} }
...@@ -58,4 +59,35 @@ namespace AMDiS { ...@@ -58,4 +59,35 @@ namespace AMDiS {
{ {
} }
void MeshLevelData::print()
{
FUNCNAME("MeshLevelData::print()");
using boost::lexical_cast;
MSG("Print mesh level structure with %d levels: \n", nLevel);
for (int i = 0; i < nLevel; i++) {
string ranks = "ranks in level " + lexical_cast<string>(i) + ":";
for (std::set<int>::iterator it = levelRanks[i].begin();
it != levelRanks[i].end(); ++it)
ranks += " " + lexical_cast<string>(*it);
string neighbours = "neighbours in level " + lexical_cast<string>(i) + ": ";
for (std::set<int>::iterator it = levelNeighbours[i].begin();
it != levelNeighbours[i].end(); ++it)
neighbours += " " + lexical_cast<string>(*it);
if (ranks.length() < 250)
MSG(" %s\n", ranks.c_str());
else
MSG(" ranks string to long!\n");
if (neighbours.length() < 250)
MSG("%s\n", neighbours.c_str());
else
MSG(" neighbours string to long!\n");
}
}
} }
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <iostream> #include <iostream>
#include <set> #include <set>
#include <vector> #include <vector>
#include "Global.h"
namespace AMDiS { namespace AMDiS {
...@@ -49,12 +50,28 @@ namespace AMDiS { ...@@ -49,12 +50,28 @@ namespace AMDiS {
// Reads the object data from an input stream. // Reads the object data from an input stream.
void deserialize(istream &in); void deserialize(istream &in);
void print();
std::set<int>& getLevelRanks(int level)
{
TEST_EXIT_DBG(level < nLevel)("Should not happen!\n");
return levelRanks[level];
}
std::set<int>& getLevelNeighbours(int level)
{
TEST_EXIT_DBG(level < nLevel)("Should not happen!\n");
return levelNeighbours[level];
}
protected: protected:
vector<std::set<int> > levelRanks; vector<std::set<int> > levelRanks;
int nLevel; int nLevel;
vector<std::set<int> > levelNeighbour; vector<std::set<int> > levelNeighbours;
}; };
} }
......
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