diff --git a/bhtree_mpi/CMakeLists.txt b/bhtree_mpi/CMakeLists.txt index b92d5ef3e27d1fa66432a6b35741bb2bf72b6a93..368e02890c9199c1f8146e4e701f4f028f711a1d 100644 --- a/bhtree_mpi/CMakeLists.txt +++ b/bhtree_mpi/CMakeLists.txt @@ -25,7 +25,8 @@ include(CheckCXXCompilerFlag) CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) set(CXX11 ${COMPILER_SUPPORTS_CXX11}) set(CXX11_FLAGS -std=c++11) -set(CMAKE_CXX_FLAGS "-std=c++11") +set(CMAKE_CXX_FLAGS "-std=c++11 -Wall") +set(CMAKE_BUILD_TYPE RelWithDebInfo) find_package(MPI REQUIRED) diff --git a/bhtree_mpi/src/datastructures/BarnesHutTree.cpp b/bhtree_mpi/src/datastructures/BarnesHutTree.cpp index e652a69c40e160ae559c47466a8772e02254d60d..6bdd1cb67aabf09daf609300e757c09c8f66ab78 100644 --- a/bhtree_mpi/src/datastructures/BarnesHutTree.cpp +++ b/bhtree_mpi/src/datastructures/BarnesHutTree.cpp @@ -8,8 +8,6 @@ namespace nbody { BarnesHutTree::BarnesHutTree(int parallelId) : Tree(parallelId) { } - BarnesHutTree::~BarnesHutTree() { - } //determine octree subboxes std::vector BarnesHutTree::splitBB(const Node* node) { @@ -143,9 +141,7 @@ namespace nbody { while (child != nullptr && !contained(child->getBB(), it->position)) { child = child->nextSibling; } - if (child != nullptr) { - current = child; - } + //TODO(pheinzlr): check for child == nullptr? current = child; } current->bodies.push_back(*it); diff --git a/bhtree_mpi/src/datastructures/BarnesHutTree.hpp b/bhtree_mpi/src/datastructures/BarnesHutTree.hpp index 9772f466b51bad44638a125a1a7c21153ded909e..ff5a4e6210760bb4a9965530def896ce3953edeb 100644 --- a/bhtree_mpi/src/datastructures/BarnesHutTree.hpp +++ b/bhtree_mpi/src/datastructures/BarnesHutTree.hpp @@ -16,7 +16,6 @@ namespace nbody { static void split(Node* current); public: BarnesHutTree(int parallelId); - virtual ~BarnesHutTree(); virtual void build(const std::vector& bodies); virtual void build(const std::vector& bodies, const Box& domain); virtual void mergeLET(const std::vector& bodies); diff --git a/bhtree_mpi/src/datastructures/Body.cpp b/bhtree_mpi/src/datastructures/Body.cpp index 27dc9e0474c3c8bb472748afde7caa3990502945..a924c998cbbcbc3f28cd35805cfc12204ef89b6d 100644 --- a/bhtree_mpi/src/datastructures/Body.cpp +++ b/bhtree_mpi/src/datastructures/Body.cpp @@ -1,12 +1,8 @@ #include "Body.hpp" -#include #include #include #include -#include #include -#include -#include #include #include diff --git a/bhtree_mpi/src/datastructures/Node.cpp b/bhtree_mpi/src/datastructures/Node.cpp index be93dabbfceaf78c9d44ce9b4cbaf7ebf25341d5..8ce3a48bcc2ba09050aa06b27495b5ba27387a91 100644 --- a/bhtree_mpi/src/datastructures/Node.cpp +++ b/bhtree_mpi/src/datastructures/Node.cpp @@ -1,4 +1,3 @@ -#include #include #include #include @@ -18,10 +17,6 @@ namespace nbody { this->parent = nullptr; } - Node::~Node() { - } - - Box Node::getBB() const { return this->bb; } @@ -75,7 +70,7 @@ namespace nbody { } bool Node::isCorrect() const { - if (this->afterSubtree == NULL) { + if (this->afterSubtree == nullptr) { std::cerr << "after subtree null\n"; return false; } @@ -97,11 +92,11 @@ namespace nbody { Node* current = this->next; int children = 0; - while (current != NULL && current != this->afterSubtree) { + while (current != nullptr && current != this->afterSubtree) { current = current->afterSubtree; children++; } - if (current == NULL) { + if (current == nullptr) { std::cerr << "afterSubtree null\n"; return false; } @@ -122,7 +117,7 @@ namespace nbody { std::cerr << "non-empty inner node\n"; return false; } - if (this->leaf && this->nextSibling != NULL && this->next != this->nextSibling) { + if (this->leaf && this->nextSibling != nullptr && this->next != this->nextSibling) { std::cerr << "wrong next sibling\n"; return false; } @@ -142,7 +137,7 @@ namespace nbody { } } } else { - for (Node* node = this->next; node != NULL; node = node->nextSibling) { + for (Node* node = this->next; node != nullptr; node = node->nextSibling) { mass += node->representative.mass; } } diff --git a/bhtree_mpi/src/datastructures/Node.hpp b/bhtree_mpi/src/datastructures/Node.hpp index 83c4c815d68a25e470ab011d326858731d53b44b..96332903fbf925b264898fbcd0cd067839783130 100644 --- a/bhtree_mpi/src/datastructures/Node.hpp +++ b/bhtree_mpi/src/datastructures/Node.hpp @@ -27,7 +27,6 @@ namespace nbody { Body representative; public: Node(Tree* tree); - virtual ~Node(); virtual bool isSplitable() const; virtual void extendBBforBodies(); virtual void extendBBtoCube(); diff --git a/bhtree_mpi/src/datastructures/Tree.cpp b/bhtree_mpi/src/datastructures/Tree.cpp index ba111fb0dd18514a1bbb1021811d7fe4b47206ee..5f5c06107a101e21d64b1a9a93ba1d4539625ddc 100644 --- a/bhtree_mpi/src/datastructures/Tree.cpp +++ b/bhtree_mpi/src/datastructures/Tree.cpp @@ -13,7 +13,7 @@ namespace nbody { this->nodes = new Node(this); this->maxLeafBodies = 16; this->parallelId = parallelId; - this->simulation = NULL; + this->simulation = nullptr; } Tree::~Tree() { @@ -162,7 +162,6 @@ namespace nbody { if (n->leaf) { for (auto& b : n->bodies) { if (!b.refinement) { - double pos[3] = {b.position[0], b.position[1], b.position[2]}; integrate(b); extend(bb, b); } diff --git a/bhtree_mpi/src/mpimain.cpp b/bhtree_mpi/src/mpimain.cpp index 686355e3917d8dc07cf89b8746c095152b08977f..bd058f963d0dcde3ef4eae49002c978b41510b3e 100644 --- a/bhtree_mpi/src/mpimain.cpp +++ b/bhtree_mpi/src/mpimain.cpp @@ -2,7 +2,6 @@ #include #include #include -#include #include using namespace nbody; diff --git a/bhtree_mpi/src/simulation/MpiSimulation.cpp b/bhtree_mpi/src/simulation/MpiSimulation.cpp index 9643f72713bb7aaf7b5d65e168688b02d80afa86..b7de8e5088904d3e6edc2057148002e57145ba01 100644 --- a/bhtree_mpi/src/simulation/MpiSimulation.cpp +++ b/bhtree_mpi/src/simulation/MpiSimulation.cpp @@ -95,7 +95,7 @@ namespace nbody { } //mpi send wrapper - void MpiSimulation::send(std::vector bodies, int target) { + void MpiSimulation::send(std::vector bodies, int target) { //TODO(steinret): MPI_BSend, remove SendStore int bodySize = bodies.size(); SendStore* store = this->availableSendStore(bodySize); diff --git a/bhtree_mpi/src/simulation/Simulation.cpp b/bhtree_mpi/src/simulation/Simulation.cpp index 9c127c57f5ef63309813bc501b17c267a54f83ab..c8551832cb4fa4ba713e8f289552775694140932 100644 --- a/bhtree_mpi/src/simulation/Simulation.cpp +++ b/bhtree_mpi/src/simulation/Simulation.cpp @@ -7,10 +7,7 @@ namespace nbody { this->parallelRank = -1; this->parallelSize = -1; this->correctState = 0; - this->tree = NULL; - } - - Simulation::~Simulation() { + this->tree = nullptr; } void Simulation::clearBodies() { diff --git a/bhtree_mpi/src/simulation/Simulation.hpp b/bhtree_mpi/src/simulation/Simulation.hpp index 723ac21c6465fc68feee67b9d75c9f551cd32d5e..7bb0f66947ea353d1d1547f21f49d1fadc21e4bc 100644 --- a/bhtree_mpi/src/simulation/Simulation.hpp +++ b/bhtree_mpi/src/simulation/Simulation.hpp @@ -16,7 +16,6 @@ namespace nbody { BarnesHutTree* tree; public: Simulation(); - virtual ~Simulation(); virtual void initialize(const std::string& inputFile) = 0; virtual void cleanup() = 0; virtual void clearBodies();