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

Just some small changes.

parent bb1e643b
......@@ -24,7 +24,7 @@ namespace AMDiS {
mtl::par::environment* mtl_environment=NULL;
#endif
void init(int argc, char **argv)
void init(int argc, char **argv, std::string initFileName)
{
FUNCNAME("AMDiS::init()");
......@@ -42,9 +42,13 @@ namespace AMDiS {
#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);
}
......
......@@ -153,8 +153,8 @@
namespace AMDiS {
void init(int argc, char **argv);
void init(int argc, char **argv, std::string initFileName = "");
void init(std::string initFileName);
void finalize();
......
......@@ -451,7 +451,12 @@ namespace AMDiS {
/// Adds a stationary problem to the global mesh distributor objects.
static void addProblemStatGlobal(ProblemStatSeq *probStat);
MeshLevelData& getMeshLevelData()
{
return levelData;
}
protected:
void addProblemStat(ProblemStatSeq *probStat);
......
......@@ -10,6 +10,7 @@
// See also license.opensource.txt in the distribution.
#include <boost/lexical_cast.hpp>
#include "parallel/MeshLevelData.h"
#include "Global.h"
......@@ -24,8 +25,8 @@ namespace AMDiS {
levelRanks[0].insert(-1);
nLevel = 1;
levelNeighbour.resize(1);
levelNeighbour[0] = neighbourRanks;
levelNeighbours.resize(1);
levelNeighbours[0] = neighbourRanks;
}
......@@ -39,13 +40,13 @@ namespace AMDiS {
levelRanks.insert(levelRanks.begin(), ranksInDomain);
nLevel++;
levelNeighbour.resize(2);
levelNeighbour[1] = levelNeighbour[0];
levelNeighbour[0].clear();
for (std::set<int>::iterator it = levelNeighbour[1].begin();
it != levelNeighbour[1].end(); ++it)
levelNeighbours.resize(2);
levelNeighbours[1] = levelNeighbours[0];
levelNeighbours[0].clear();
for (std::set<int>::iterator it = levelNeighbours[1].begin();
it != levelNeighbours[1].end(); ++it)
if (levelRanks[0].count(*it) == 0)
levelNeighbour[0].insert(*it);
levelNeighbours[0].insert(*it);
}
......@@ -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 @@
#include <iostream>
#include <set>
#include <vector>
#include "Global.h"
namespace AMDiS {
......@@ -49,12 +50,28 @@ namespace AMDiS {
// Reads the object data from an input stream.
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:
vector<std::set<int> > levelRanks;
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