diff --git a/AMDiS/src/AMDiS.cc b/AMDiS/src/AMDiS.cc index 1da66eb4249ecb3186297306b6983cc13a632fca..1343b757b319e43227a88eb677c5fa8f5fb4f659 100644 --- a/AMDiS/src/AMDiS.cc +++ b/AMDiS/src/AMDiS.cc @@ -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); } diff --git a/AMDiS/src/AMDiS.h b/AMDiS/src/AMDiS.h index 402ca5fee42c804e4272da074f7a05319dda5d39..dc878e1d8f5786a0ce08a25d9ba9390743a19575 100644 --- a/AMDiS/src/AMDiS.h +++ b/AMDiS/src/AMDiS.h @@ -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(); diff --git a/AMDiS/src/parallel/MeshDistributor.h b/AMDiS/src/parallel/MeshDistributor.h index f762a8ee45b5558903ca577bd95d0dcd2e969b1f..a4de458d73c94f478bfdad5d7e5936932bbebe78 100644 --- a/AMDiS/src/parallel/MeshDistributor.h +++ b/AMDiS/src/parallel/MeshDistributor.h @@ -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); diff --git a/AMDiS/src/parallel/MeshLevelData.cc b/AMDiS/src/parallel/MeshLevelData.cc index 7df797ef76dac8a195ce659f6bfcbe3f346be02b..3f84bfdb43016b65301b0ca5c7f9ba3e66e38755 100644 --- a/AMDiS/src/parallel/MeshLevelData.cc +++ b/AMDiS/src/parallel/MeshLevelData.cc @@ -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"); + } + } } diff --git a/AMDiS/src/parallel/MeshLevelData.h b/AMDiS/src/parallel/MeshLevelData.h index 832ce999baee258148aabdd1ec61dc0aa5de7d2c..4ccb8122280d9ad4eb8cce8e34e2a0f660640a74 100644 --- a/AMDiS/src/parallel/MeshLevelData.h +++ b/AMDiS/src/parallel/MeshLevelData.h @@ -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; }; }