diff --git a/source/VirtualFluidsCore/Grid/CalculationManager.cpp b/source/VirtualFluidsCore/Grid/CalculationManager.cpp index dd5e481a4b4ede8ea1649eed99529429e5e9ab8b..d685bc73685cf929d8a6bca0d013a3e0562efbb3 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 ec41e466acd6a6bedf31fe3a4023a7b651d5081f..325d5e654fc85e154c033d53f4e02089a294cf14 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);