From 97744a09beda28e58e8eb6b9aba2fffc197288ee Mon Sep 17 00:00:00 2001 From: Soeren Peters <peters@irmb.tu-bs.de> Date: Thu, 4 Jan 2018 14:15:43 +0100 Subject: [PATCH] - remove mpi calculate --- .../Grid/CalculationManager.cpp | 58 ++++++++++--------- .../Grid/CalculationManager.h | 1 - 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/source/VirtualFluidsCore/Grid/CalculationManager.cpp b/source/VirtualFluidsCore/Grid/CalculationManager.cpp index dd5e481a4..d685bc736 100644 --- a/source/VirtualFluidsCore/Grid/CalculationManager.cpp +++ b/source/VirtualFluidsCore/Grid/CalculationManager.cpp @@ -42,41 +42,43 @@ CalculationManager::~CalculationManager() { } -////////////////////////////////////////////////////////////////////////// -void CalculationManager::mpiCalculate() -{ - try - { - std::dynamic_pointer_cast<MPICalculator>(calcThreads[0])->calculate(endTime, shared_from_this()); - } - catch (std::exception& e) - { - UBLOG(logERROR, e.what()); - //throw e; - exit(EXIT_FAILURE); - } -} ////////////////////////////////////////////////////////////////////////// void CalculationManager::calculate() { - try + if (type == CalculatorType::MPI) { - boost::thread_group threads; - boost::exception_ptr error; - - for (int i = 1; i < calcThreads.size(); i++) - threads.create_thread(boost::bind(&Calculator::calculate, calcThreads[i], endTime, shared_from_this(), boost::ref(error))); - - calcThreads[0]->calculate(endTime, shared_from_this(), boost::ref(error)); - - threads.join_all(); + try + { + std::dynamic_pointer_cast<MPICalculator>(calcThreads[0])->calculate(endTime, shared_from_this()); + } + catch (std::exception& e) + { + UBLOG(logERROR, e.what()); + //throw e; + exit(EXIT_FAILURE); + } } - catch (std::exception& e) + else { - UBLOG(logERROR, e.what()); - //throw e; - exit(EXIT_FAILURE); + try + { + boost::thread_group threads; + boost::exception_ptr error; + + for (int i = 1; i < calcThreads.size(); i++) + threads.create_thread(boost::bind(&Calculator::calculate, calcThreads[i], endTime, shared_from_this(), boost::ref(error))); + + calcThreads[0]->calculate(endTime, shared_from_this(), boost::ref(error)); + + threads.join_all(); + } + catch (std::exception& e) + { + UBLOG(logERROR, e.what()); + //throw e; + exit(EXIT_FAILURE); + } } } ////////////////////////////////////////////////////////////////////////// diff --git a/source/VirtualFluidsCore/Grid/CalculationManager.h b/source/VirtualFluidsCore/Grid/CalculationManager.h index ec41e466a..325d5e654 100644 --- a/source/VirtualFluidsCore/Grid/CalculationManager.h +++ b/source/VirtualFluidsCore/Grid/CalculationManager.h @@ -26,7 +26,6 @@ public: virtual ~CalculationManager(); void calculate(); - void mpiCalculate(); bool balance(); void setTimeAveragedValuesCoProcessor(std::shared_ptr<TimeAveragedValuesCoProcessor> coProcessor); -- GitLab