Skip to content
Snippets Groups Projects
Commit 962dc908 authored by Paul Heinzlreiter's avatar Paul Heinzlreiter
Browse files

* added descriptive output of current program phases being executed

parent 85c7de09
Branches
No related merge requests found
......@@ -20,13 +20,23 @@ int main(int argc, char* argv[]) {
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
//initialize and load particles
cout << " " << "rank " << rank << ": initialize..." << endl;
if (rank == 0) {
cout << " " << "rank 0: load particles ..." << endl;
}
simulation.initialize(string(argv[1]));
//initial particle and domain distribution
if (rank == 0) {
cout << " " << "rank 0: distribute particles to other processes ..." << endl;
}
simulation.distributeBodies();
cout << " " << "rank " << rank << ": distributing initial domains to other processes ..." << endl;
simulation.distributeDomains();
cout << " " << "rank " << rank << ": building initial trees ..." << endl;
simulation.buildTree();
for (int i = 0; i < 3; i++) {
//local tree is built and correct domains are distributed
cout << "running simulation step " << i << " ..." << endl;
simulation.runStep();
}
simulation.cleanup();
......
......@@ -61,11 +61,13 @@ namespace nbody {
this->correctState = true;
this->tree = new BarnesHutTree(this->parallelRank);
//parse input data
if (!inputFile.empty()) {
this->correctState = this->readInputData(inputFile);
} else {
this->correctState = false;
if (this->parallelRank == 0) {
//parse input data
if (!inputFile.empty()) {
this->correctState = this->readInputData(inputFile);
} else {
this->correctState = false;
}
}
//broadcast current state and terminate if input file cannot be read
MPI_Bcast(&this->correctState, 1, MPI_INT, 0, MPI_COMM_WORLD);
......@@ -260,12 +262,16 @@ namespace nbody {
//tree is already built here
//distribute local bodies needed by remote processes
cout << " " << "rank " << this->parallelRank << ": distribute local particles required for remote simulation ..." << endl;
this->distributeLETs();
//force computation
cout << " " << "rank " << this->parallelRank << ": compute forces ..." << endl;
this->tree->computeForces();
//advance/move particles and distribute updated domain to other processes
cout << " " << "rank " << this->parallelRank << ": move particles and redistribute simulation domains ..." << endl;
this->distributeDomains(this->tree->advance());
//rebuild tree with new particle positions
cout << " " << "rank " << this->parallelRank << ": rebuild tree with new particle positions ..." << endl;
this->rebuildTree();
if (!this->tree->isCorrect()) {
cerr << "wrong tree" << endl;
......
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