From 29a2c34d96ee4d8eaab84728f83ab7c0e79563d9 Mon Sep 17 00:00:00 2001 From: Simon Homes Date: Fri, 26 Jul 2024 15:34:36 +0200 Subject: [PATCH 01/13] Replace Simulation::exit with mardyn_exit --- src/Domain.cpp | 10 +++ src/Domain.h | 8 +- src/MarDyn.cpp | 4 +- src/Simulation.cpp | 77 +++++++++---------- src/Simulation.h | 8 -- src/bhfmm/FastMultipoleMethod.cpp | 7 +- src/bhfmm/containers/DttNode.cpp | 2 +- .../UniformPseudoParticleContainer.cpp | 7 +- ...PseudoParticleContainer_old_Wigner_cpp.txt | 12 +-- src/ensemble/CanonicalEnsemble.cpp | 3 +- src/ensemble/CavityEnsemble.cpp | 12 +-- src/ensemble/ChemicalPotential.cpp | 6 +- src/ensemble/EnsembleBase.cpp | 5 +- src/ensemble/GrandCanonicalEnsemble.cpp | 1 + src/ensemble/GrandCanonicalEnsemble.h | 6 +- src/ensemble/PressureGradient.cpp | 4 +- src/integrators/Leapfrog.cpp | 2 +- src/integrators/LeapfrogRMM.cpp | 2 +- src/io/ASCIIReader.cpp | 19 ++--- src/io/BinaryReader.cpp | 17 ++-- src/io/CavityWriter.cpp | 15 ++-- src/io/CheckpointWriter.cpp | 6 +- src/io/CommunicationPartnerWriter.cpp | 4 +- src/io/CubicGridGeneratorInternal.cpp | 8 +- src/io/FlopRateWriter.cpp | 3 +- src/io/GammaWriter.cpp | 1 + src/io/HaloParticleWriter.cpp | 4 +- src/io/KDTreePrinter.cpp | 3 +- src/io/LoadBalanceWriter.cpp | 1 + src/io/MPICheckpointWriter.cpp | 1 + src/io/MPI_IOCheckpointWriter.cpp | 4 +- src/io/MPI_IOReader.cpp | 15 ++-- src/io/Mkesfera.cpp | 5 +- src/io/MmpldWriter.cpp | 10 +-- src/io/MmspdWriter.cpp | 2 +- src/io/MultiObjectGenerator.cpp | 1 - src/io/ODF.cpp | 2 + src/io/ObjectGenerator.cpp | 10 +-- src/io/PerCellGenerator.cpp | 5 +- src/io/RDF.cpp | 3 +- src/io/ReplicaGenerator.cpp | 19 ++--- src/io/TimerProfiler.cpp | 1 - src/io/TimerWriter.cpp | 3 +- src/io/vtk/VTKGridWriter.cpp | 4 +- src/longRange/Homogeneous.cpp | 3 +- src/longRange/Planar.cpp | 9 ++- src/longRange/Planar.h | 2 + src/molecules/AutoPasSimpleMolecule.cpp | 4 +- src/molecules/Component.cpp | 6 +- src/molecules/MoleculeInterface.cpp | 3 +- src/molecules/MoleculeRMM.cpp | 1 + src/parallel/CollectiveCommunication.h | 5 +- .../CollectiveCommunicationNonBlocking.h | 6 +- src/parallel/CommunicationBuffer.cpp | 1 + src/parallel/CommunicationPartner.cpp | 5 +- src/parallel/DomainDecompBase.cpp | 3 +- src/parallel/DomainDecompMPIBase.cpp | 5 +- src/parallel/DomainDecomposition.cpp | 6 +- src/parallel/ForceHelper.cpp | 10 ++- src/parallel/ForceHelper.h | 3 + src/parallel/GeneralDomainDecomposition.cpp | 15 ++-- src/parallel/GeneralDomainDecomposition.h | 3 + src/parallel/KDDecomposition.cpp | 29 +++---- src/parallel/LoadCalc.cpp | 14 ++-- src/parallel/LoadCalc.h | 2 - src/parallel/NeighbourCommunicationScheme.cpp | 11 +-- src/parallel/NonBlockingMPIHandlerBase.cpp | 1 + src/parallel/ParticleDataRMM.cpp | 3 +- src/parallel/ParticleForceData.cpp | 2 +- src/parallel/ResilienceComm.cpp | 2 + src/parallel/ResilienceComm.h | 1 - .../StaticIrregDomainDecomposition.cpp | 2 +- src/parallel/ZonalMethods/Midpoint.h | 1 - src/parallel/ZonalMethods/ZonalMethod.cpp | 3 +- src/particleContainer/AutoPasContainer.cpp | 6 +- src/particleContainer/FullParticleCell.cpp | 3 +- .../C08CellPairTraversal.h | 2 +- .../NeutralTerritoryTraversal.h | 4 +- .../OriginalCellPairTraversal.h | 2 +- .../QuickschedTraversal.h | 4 +- src/particleContainer/LinkedCells.cpp | 22 +++--- src/particleContainer/TraversalTuner.h | 8 +- .../adapter/ParticlePairs2PotForceAdapter.h | 2 +- .../adapter/tests/RealAccumVecTest.cpp | 1 - .../adapter/tests/RealCalcVecTest.cpp | 1 - .../adapter/vectorization/RealVec.h | 2 +- .../adapter/vectorization/RealVecDouble.h | 2 + .../adapter/vectorization/RealVecFloat.h | 2 + .../tests/ParticleContainerFactory.cpp | 1 + src/plugins/COMaligner.cpp | 2 +- src/plugins/DirectedPM.cpp | 2 +- src/plugins/Dropaccelerator.cpp | 5 +- src/plugins/Dropaligner.cpp | 2 +- src/plugins/ExamplePlugin.cpp | 4 +- src/plugins/FixRegion.cpp | 2 +- src/plugins/MaxCheck.cpp | 6 +- src/plugins/Mirror.cpp | 17 ++-- src/plugins/MirrorSystem.cpp | 1 + src/plugins/NEMD/DensityControl.cpp | 6 +- src/plugins/NEMD/DistControl.cpp | 27 +++---- src/plugins/NEMD/DriftCtrl.cpp | 1 + src/plugins/NEMD/ExtractPhase.cpp | 1 + src/plugins/NEMD/MettDeamon.cpp | 36 +++++---- src/plugins/NEMD/MettDeamon.h | 1 + .../NEMD/MettDeamonFeedrateDirector.cpp | 6 +- src/plugins/NEMD/PosNegComp.cpp | 1 + src/plugins/NEMD/RegionSampling.cpp | 41 +++++----- src/plugins/NEMD/VelocityExchange.cpp | 1 + src/plugins/Permittivity.cpp | 3 + src/plugins/PluginFactory.cpp | 4 +- src/plugins/SpatialProfile.cpp | 4 +- src/plugins/VectorizationTuner.cpp | 7 +- src/plugins/WallPotential.cpp | 7 +- src/plugins/profiles/Virial2DProfile.cpp | 2 + src/plugins/profiles/VirialProfile.cpp | 2 + src/thermostats/TemperatureControl.cpp | 10 ++- src/utils/MPI_Info_object.cpp | 1 - src/utils/OptionParser.cpp | 11 +-- src/utils/SigsegvHandler.h | 4 +- src/utils/Testing.cpp | 6 +- src/utils/generator/ReplicaFiller.cpp | 13 ++-- src/utils/xmlfile.cpp | 9 +-- tools/gui/generators/MDGenerator.cpp | 2 +- 123 files changed, 449 insertions(+), 363 deletions(-) diff --git a/src/Domain.cpp b/src/Domain.cpp index 879a2d5f71..6934866569 100644 --- a/src/Domain.cpp +++ b/src/Domain.cpp @@ -11,6 +11,7 @@ #include "molecules/Molecule.h" //#include "CutoffCorrections.h" #include "Simulation.h" +#include "utils/mardyn_assert.h" #include "ensemble/EnsembleBase.h" #ifdef ENABLE_MPI @@ -703,6 +704,15 @@ void Domain::enableComponentwiseThermostat() } } +void Domain::setComponentThermostat(int cid, int thermostat) { + if ((0 > cid) || (0 >= thermostat)) { + Log::global_log->error() << "Domain::setComponentThermostat: cid or thermostat id too low" << std::endl; + mardyn_exit(787); + } + this->_componentToThermostatIdMap[cid] = thermostat; + this->_universalThermostatN[thermostat] = 0; +} + void Domain::enableUndirectedThermostat(int tst) { this->_universalUndirectedThermostat[tst] = true; diff --git a/src/Domain.h b/src/Domain.h index 332dacedcc..7e9b083ae0 100644 --- a/src/Domain.h +++ b/src/Domain.h @@ -10,7 +10,6 @@ #include "molecules/Comp2Param.h" #include "molecules/Component.h" #include "ensemble/EnsembleBase.h" -#include "Simulation.h" #include "utils/CommVar.h" /* * TODO add comments for variables @@ -349,11 +348,8 @@ class Domain { //! @brief associates a component with a thermostat //! @param cid internal ID of the component //! @param th internal ID of the thermostat - void setComponentThermostat(int cid, int thermostat) { - if((0 > cid) || (0 >= thermostat)) Simulation::exit(787); - this->_componentToThermostatIdMap[cid] = thermostat; - this->_universalThermostatN[thermostat] = 0; - } + void setComponentThermostat(int cid, int thermostat); + //! @brief enables the "undirected" flag for the specified thermostat //! @param tst internal ID of the respective thermostat void enableUndirectedThermostat(int thermostat); diff --git a/src/MarDyn.cpp b/src/MarDyn.cpp index a1468b90b5..9a4cf21924 100644 --- a/src/MarDyn.cpp +++ b/src/MarDyn.cpp @@ -194,7 +194,7 @@ int main(int argc, char** argv) { if(numArgs != 1) { Log::global_log->error() << "Incorrect number of arguments provided." << std::endl; op.print_usage(); - Simulation::exit(-1); + mardyn_exit(-1); } /* First read the given config file if it exists, then overwrite parameters with command line arguments. */ std::string configFileName(args[0]); @@ -203,7 +203,7 @@ int main(int argc, char** argv) { simulation.readConfigFile(configFileName); } else { Log::global_log->error() << "Cannot open config file '" << configFileName << "'" << std::endl; - Simulation::exit(-2); + mardyn_exit(-2); } /* processing command line arguments */ diff --git a/src/Simulation.cpp b/src/Simulation.cpp index 9955c532f0..0539cb6a03 100644 --- a/src/Simulation.cpp +++ b/src/Simulation.cpp @@ -157,11 +157,6 @@ Simulation::~Simulation() { _plugins.remove_if([](PluginBase *pluginPtr) {delete pluginPtr; return true;} ); } -void Simulation::exit(int exitcode) { - // .. to avoid code duplication .. - mardyn_exit(exitcode); -} - void Simulation::readXML(XMLfileUnits& xmlconfig) { /* timers */ if(xmlconfig.changecurrentnode("programtimers")) { @@ -177,14 +172,14 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { if(integratorType == "Leapfrog") { #ifdef ENABLE_REDUCED_MEMORY_MODE Log::global_log->error() << "The reduced memory mode (RMM) requires the LeapfrogRMM integrator." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); #endif _integrator = new Leapfrog(); } else if (integratorType == "LeapfrogRMM") { _integrator = new LeapfrogRMM(); } else { Log::global_log-> error() << "Unknown integrator " << integratorType << std::endl; - Simulation::exit(1); + mardyn_exit(1); } _integrator->readXML(xmlconfig); _integrator->init(); @@ -227,7 +222,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { _ensemble = new GrandCanonicalEnsemble(); } else { Log::global_log->error() << "Unknown ensemble type: " << ensembletype << std::endl; - Simulation::exit(1); + mardyn_exit(1); } _ensemble->readXML(xmlconfig); /** @todo Here we store data in the _domain member as long as we do not use the ensemble everywhere */ @@ -240,7 +235,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { } else { Log::global_log->error() << "Ensemble section missing." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } //The mixing coefficents have to be read in the ensemble part @@ -276,13 +271,13 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { _cutoffRadius = std::max(_cutoffRadius, _LJCutoffRadius); if(_cutoffRadius <= 0) { Log::global_log->error() << "cutoff radius <= 0." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } Log::global_log->info() << "dimensionless cutoff radius:\t" << _cutoffRadius << std::endl; xmlconfig.changecurrentnode(".."); } else { Log::global_log->error() << "Cutoff section missing." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } /* electrostatics */ @@ -295,7 +290,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { xmlconfig.changecurrentnode(".."); } else { Log::global_log->error() << "Electrostatics section for reaction field setup missing." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } if (xmlconfig.changecurrentnode("electrostatic[@type='FastMultipoleMethod']")) { @@ -303,7 +298,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { Log::global_log->fatal() << "The fast multipole method is not compatible with AutoPas. Please disable the AutoPas mode (ENABLE_AUTOPAS)!" << std::endl; - Simulation::exit(1); + mardyn_exit(1); #endif _FMM = new bhfmm::FastMultipoleMethod(); _FMM->readXML(xmlconfig); @@ -362,7 +357,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { "vs the GeneralDomainDecomposition which can lead ALL to shrink the " "domain too small." << std::endl; - this->exit(512435340); + mardyn_exit(512435340); } } else { Log::global_log->warning() << "Using the GeneralDomainDecomposition without AutoPas is not " @@ -378,17 +373,17 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { Log::global_log->info() << "Using skin = " << skin << " for the GeneralDomainDecomposition." << std::endl; } else { Log::global_log->error() << "Datastructure section missing" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } if(not xmlconfig.changecurrentnode("../parallelisation")){ Log::global_log->error() << "Could not go back to parallelisation path. Aborting." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } delete _domainDecomposition; _domainDecomposition = new GeneralDomainDecomposition(getcutoffRadius() + skin, _domain, forceLatchingToLinkedCellsGrid); } else { Log::global_log->error() << "Unknown parallelisation type: " << parallelisationtype << std::endl; - Simulation::exit(1); + mardyn_exit(1); } #else /* serial */ if(parallelisationtype != "DummyDecomposition") { @@ -396,7 +391,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { << "Executable was compiled without support for parallel execution: " << parallelisationtype << " not available. Using serial mode." << std::endl; - //Simulation::exit(1); + //mardyn_exit(1); } //_domainDecomposition = new DomainDecompBase(); // already set in initialize() #endif @@ -423,7 +418,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { << "time steps for the load calculation." << std::endl; if(timerForLoadAveragingLength < 1ul) { Log::global_log->fatal() << "timerForLoadAveragingLength has to be at least 1" << std::endl; - Simulation::exit(15843); + mardyn_exit(15843); } _lastTraversalTimeHistory.setCapacity(timerForLoadAveragingLength); @@ -432,7 +427,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { else { #ifdef ENABLE_MPI Log::global_log->error() << "Parallelisation section missing." << std::endl; - Simulation::exit(1); + mardyn_exit(1); #else /* serial */ // set _timerForLoad, s.t. it always exists. _timerForLoad = timers()->getTimer("SIMULATION_COMPUTATION"); @@ -450,7 +445,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { Log::global_log->fatal() << "LinkedCells not compiled (use AutoPas instead, or compile with disabled autopas mode)!" << std::endl; - Simulation::exit(33); + mardyn_exit(33); #else _moleculeContainer = new LinkedCells(); /** @todo Review if we need to know the max cutoff radius usable with any datastructure. */ @@ -459,7 +454,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { #endif } else if(datastructuretype == "AdaptiveSubCells") { Log::global_log->warning() << "AdaptiveSubCells no longer supported." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } else if(datastructuretype == "AutoPas" || datastructuretype == "AutoPasContainer") { #ifdef MARDYN_AUTOPAS Log::global_log->info() << "Using AutoPas container." << std::endl; @@ -467,12 +462,12 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { Log::global_log->info() << "Setting cell cutoff radius for AutoPas container to " << _cutoffRadius << std::endl; #else Log::global_log->fatal() << "AutoPas not compiled (use LinkedCells instead, or compile with enabled autopas mode)!" << std::endl; - Simulation::exit(33); + mardyn_exit(33); #endif } else { Log::global_log->error() << "Unknown data structure type: " << datastructuretype << std::endl; - Simulation::exit(1); + mardyn_exit(1); } _moleculeContainer->readXML(xmlconfig); @@ -484,7 +479,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { xmlconfig.changecurrentnode(".."); } else { Log::global_log->error() << "Datastructure section missing" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } // TODO: move parts to readXML in TemperatureControl? @@ -528,7 +523,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { } else { Log::global_log->error() << "Instance of TemperatureControl allready exist! Programm exit ..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } } else @@ -551,7 +546,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { if( !xmlconfig.getNodeValue("@type", type) ) { Log::global_log->error() << "LongRangeCorrection: Missing type specification. Program exit ..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } if("planar" == type) { @@ -575,7 +570,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { else { Log::global_log->error() << "LongRangeCorrection: Wrong type. Expected type == homogeneous|planar|none. Program exit ..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } xmlconfig.changecurrentnode(".."); } else { @@ -641,7 +636,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { #endif else { Log::global_log->error() << "Unknown phase space file type" << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } } xmlconfig.changecurrentnode(oldpath); @@ -671,7 +666,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { } else { Log::global_log->error() << "Unknown generator: " << generatorName << std::endl; - Simulation::exit(1); + mardyn_exit(1); } _inputReader->readXML(xmlconfig); } @@ -706,7 +701,7 @@ void Simulation::readConfigFile(std::string filename) { } else { Log::global_log->error() << "Unknown config file extension '" << extension << "'." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } } @@ -721,7 +716,7 @@ void Simulation::initConfigXML(const std::string& inputfilename) { if(inp.changecurrentnode("/mardyn") < 0) { Log::global_log->error() << "Cound not find root node /mardyn in XML input file." << std::endl; Log::global_log->fatal() << "Not a valid MarDyn XML input file." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } std::string version("unknown"); @@ -736,7 +731,7 @@ void Simulation::initConfigXML(const std::string& inputfilename) { } // simulation-section else { Log::global_log->error() << "Simulation section missing" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } parseMiscOptions(inp); @@ -749,7 +744,7 @@ void Simulation::initConfigXML(const std::string& inputfilename) { } catch (const std::exception& e) { Log::global_log->error() << "Error in XML config. Please check your input file!" << std::endl; Log::global_log->error() << "Exception: " << e.what() << std::endl; - Simulation::exit(7); + mardyn_exit(7); } #ifdef ENABLE_MPI @@ -875,7 +870,7 @@ void Simulation::prepare_start() { _longRangeCorrection->init(); } else { Log::global_log->fatal() << "No _longRangeCorrection set!" << std::endl; - Simulation::exit(93742); + mardyn_exit(93742); } // longRangeCorrection is a site-wise force plugin, so we have to call it before updateForces() _longRangeCorrection->calculateLongRange(); @@ -970,7 +965,7 @@ void Simulation::preSimLoopSteps() { Log::global_log->error() << "Unexpected call to preSimLoopSteps()! Status: (pre sim loop steps done:" << preSimLoopStepsDone << ", simulation done: " << simulationDone << ", post sim loop steps done: " << postSimLoopStepsDone << std::endl; - Simulation::exit(1); + mardyn_exit(1); } @@ -1032,7 +1027,7 @@ void Simulation::simulateOneTimestep() { Log::global_log->error() << "Unexpected call to simulateOneTimeStep()! Status: (pre sim loop steps done:" << preSimLoopStepsDone << ", simulation done: " << simulationDone << ", post sim loop steps done: " << postSimLoopStepsDone << std::endl; - Simulation::exit(1); + mardyn_exit(1); } #ifdef MAMICO_COUPLING @@ -1263,7 +1258,7 @@ void Simulation::postSimLoopSteps() { Log::global_log->error() << "Unexpected call to postSimLoopSteps()! Status: (pre sim loop steps done:" << preSimLoopStepsDone << ", simulation done: " << simulationDone << ", post sim loop steps done: " << postSimLoopStepsDone << std::endl; - Simulation::exit(1); + mardyn_exit(1); } @@ -1328,7 +1323,7 @@ void Simulation::pluginEndStepCall(unsigned long simstep) { << _domain->getGlobalPressure() << std::endl; if (std::isnan(_domain->getGlobalCurrentTemperature()) || std::isnan(_domain->getGlobalUpot()) || std::isnan(_domain->getGlobalPressure())) { Log::global_log->error() << "NaN detected, exiting." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } } @@ -1398,7 +1393,7 @@ void Simulation::performOverlappingDecompositionAndCellTraversalStep(double etim auto* dd = dynamic_cast(_domainDecomposition); if (not dd) { Log::global_log->fatal() << "DomainDecompMPIBase* required for overlapping comm, but dynamic_cast failed." << std::endl; - Simulation::exit(873456); + mardyn_exit(873456); } NonBlockingMPIMultiStepHandler nonBlockingMPIHandler {dd, _moleculeContainer, _domain, _cellProcessor}; @@ -1407,7 +1402,7 @@ void Simulation::performOverlappingDecompositionAndCellTraversalStep(double etim nonBlockingMPIHandler.performOverlappingTasks(forceRebalancing, etime); #else Log::global_log->fatal() << "performOverlappingDecompositionAndCellTraversalStep() called with disabled MPI." << std::endl; - Simulation::exit(873457); + mardyn_exit(873457); #endif } diff --git a/src/Simulation.h b/src/Simulation.h index 93055edfd2..2de6160f8a 100644 --- a/src/Simulation.h +++ b/src/Simulation.h @@ -125,14 +125,6 @@ class Simulation { */ void readXML(XMLfileUnits& xmlconfig); - /** @brief Terminate simulation with given exit code. - * - * The exit method takes care over the right way to terminate the application in a correct way - * for the different parallelization schemes. e.g. terminating other processes in MPI parallel - * execution mode. - */ - static void exit(int exitcode); - /** @brief process configuration file * * calls initConfigXML diff --git a/src/bhfmm/FastMultipoleMethod.cpp b/src/bhfmm/FastMultipoleMethod.cpp index a0ca09a4a9..3e4533219e 100644 --- a/src/bhfmm/FastMultipoleMethod.cpp +++ b/src/bhfmm/FastMultipoleMethod.cpp @@ -8,6 +8,7 @@ #include #include "FastMultipoleMethod.h" #include "Simulation.h" +#include "utils/mardyn_assert.h" #include "Domain.h" #include "utils/Logger.h" #include "bhfmm/containers/UniformPseudoParticleContainer.h" @@ -69,7 +70,7 @@ void FastMultipoleMethod::init(double globalDomainLength[3], double bBoxMin[3], Log::global_log->error() << "Fast Multipole Method: bad subdivision factor:" << _LJCellSubdivisionFactor << std::endl; Log::global_log->error() << "expected 1,2,4 or 8" << std::endl; - Simulation::exit(5); + mardyn_exit(5); } Log::global_log->info() << "Fast Multipole Method: each LJ cell will be subdivided in " @@ -107,7 +108,7 @@ void FastMultipoleMethod::init(double globalDomainLength[3], double bBoxMin[3], // TODO: Debugging in Progress! #if defined(ENABLE_MPI) Log::global_log->error() << "MPI in combination with adaptive is not supported yet" << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); #endif //int threshold = 100; _pseudoParticleContainer = new AdaptivePseudoParticleContainer( @@ -313,7 +314,7 @@ void FastMultipoleMethod::runner(int type, void *data) { #pragma omp critical { Log::global_log->error() << "Quicksched runner without FMM_FFT not implemented!" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } #endif /* FMM_FFT */ } diff --git a/src/bhfmm/containers/DttNode.cpp b/src/bhfmm/containers/DttNode.cpp index de65c2efd0..4d12a58d84 100644 --- a/src/bhfmm/containers/DttNode.cpp +++ b/src/bhfmm/containers/DttNode.cpp @@ -1,5 +1,5 @@ #include "DttNode.h" -#include "Simulation.h" + #include "Domain.h" #include "UniformPseudoParticleContainer.h" #include "utils/Logger.h" diff --git a/src/bhfmm/containers/UniformPseudoParticleContainer.cpp b/src/bhfmm/containers/UniformPseudoParticleContainer.cpp index 1476d3ce6a..d0a2e37c96 100644 --- a/src/bhfmm/containers/UniformPseudoParticleContainer.cpp +++ b/src/bhfmm/containers/UniformPseudoParticleContainer.cpp @@ -7,6 +7,7 @@ #include "UniformPseudoParticleContainer.h" #include "Simulation.h" +#include "utils/mardyn_assert.h" #include "Domain.h" #include "utils/Logger.h" #include "particleContainer/ParticleContainer.h" @@ -111,7 +112,7 @@ UniformPseudoParticleContainer::UniformPseudoParticleContainer( #endif #if WIGNER == 1 //global_log->error() << "not supported yet" << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); #endif #ifdef ENABLE_MPI /* @@ -175,7 +176,7 @@ UniformPseudoParticleContainer::UniformPseudoParticleContainer( _globalLevel = ceil(log2(numProcessors)/3.0); if(_globalLevel > _maxLevel){ std::cout << "too many MPI ranks \n"; - Simulation::exit(-1); + mardyn_exit(-1); } //numProcessers has to be a power of 2 mardyn_assert(pow(2,log2(numProcessors)) == numProcessors); @@ -378,7 +379,7 @@ UniformPseudoParticleContainer::UniformPseudoParticleContainer( MPI_Comm_size(_neighbourhoodComms[i], &size2); if(size2 > 8){ //neighbourhood comms need to have size 8 std::cout << "Error wrong communicator \n"; - Simulation::exit(1); + mardyn_exit(1); } } #endif diff --git a/src/bhfmm/containers/UniformPseudoParticleContainer_old_Wigner_cpp.txt b/src/bhfmm/containers/UniformPseudoParticleContainer_old_Wigner_cpp.txt index b4ec6dc762..1f81735625 100644 --- a/src/bhfmm/containers/UniformPseudoParticleContainer_old_Wigner_cpp.txt +++ b/src/bhfmm/containers/UniformPseudoParticleContainer_old_Wigner_cpp.txt @@ -6,7 +6,7 @@ */ #include "UniformPseudoParticleContainer.h" -#include "Simulation.h" +#include "utils/mardyn_assert.h" #include "Domain.h" #include "utils/Logger.h" #include "bhfmm/utils/RotationParameterLookUp.h" @@ -45,7 +45,7 @@ UniformPseudoParticleContainer::UniformPseudoParticleContainer( #endif #if WIGNER == 1 //global_log->error() << "not supported yet" << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); #endif #ifdef ENABLE_MPI _timerProcessCells.set_sync(false); @@ -81,7 +81,7 @@ UniformPseudoParticleContainer::UniformPseudoParticleContainer( _globalLevel = log2(numProcessors)/3; if(_globalLevel > _maxLevel){ std::cout << "too many MPI ranks \n"; - Simulation::exit(-1); + mardyn_exit(-1); } //numProcessers has to be a power of 8 mardyn_assert(log2(numProcessors) == _globalLevel * 3); @@ -778,7 +778,7 @@ void UniformPseudoParticleContainer::GatherWellSepLo_MPI(double *cellWid, int lo for (m2z = LoLim(2) + 2; m2z <= HiLim(2) + 2; m2z++) { if (m2z < 0 or m2z >= localMpCells) { std::cout << "Error \n"; - Simulation::exit(-1); + mardyn_exit(-1); } @@ -786,7 +786,7 @@ void UniformPseudoParticleContainer::GatherWellSepLo_MPI(double *cellWid, int lo for (m2y = LoLim(1) + 2; m2y <= HiLim(1) + 2; m2y++) { if (m2y < 0 or m2y >= localMpCells) { std::cout << "Error \n"; - Simulation::exit(-1); + mardyn_exit(-1); } @@ -794,7 +794,7 @@ void UniformPseudoParticleContainer::GatherWellSepLo_MPI(double *cellWid, int lo for (m2x = LoLim(0) + 2; m2x <= HiLim(0) + 2; m2x++) { if (m2x < 0 or m2x >= localMpCells) { std::cout << "Error \n"; - Simulation::exit(-1); + mardyn_exit(-1); } m2v[0] = m2x; diff --git a/src/ensemble/CanonicalEnsemble.cpp b/src/ensemble/CanonicalEnsemble.cpp index 82c61fb963..c79b31be4e 100644 --- a/src/ensemble/CanonicalEnsemble.cpp +++ b/src/ensemble/CanonicalEnsemble.cpp @@ -15,6 +15,7 @@ #include "particleContainer/ParticleContainer.h" #include "parallel/DomainDecompBase.h" #include "Simulation.h" +#include "utils/mardyn_assert.h" #include "utils/Logger.h" #include "utils/xmlfileUnits.h" @@ -195,7 +196,7 @@ void CanonicalEnsemble::readXML(XMLfileUnits& xmlconfig) { _domain = new BoxDomain(); } else { Log::global_log->error() << "Volume type not supported." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } xmlconfig.changecurrentnode("domain"); _domain->readXML(xmlconfig); diff --git a/src/ensemble/CavityEnsemble.cpp b/src/ensemble/CavityEnsemble.cpp index f561e1ad8e..bd65adeade 100644 --- a/src/ensemble/CavityEnsemble.cpp +++ b/src/ensemble/CavityEnsemble.cpp @@ -4,7 +4,7 @@ #include "parallel/DomainDecompBase.h" #include "utils/Logger.h" #include "molecules/Quaternion.h" -#include "Simulation.h" +#include "utils/mardyn_assert.h" #include "particleContainer/ParticleContainer.h" #define COMMUNICATION_THRESHOLD 3 @@ -96,7 +96,7 @@ void CavityEnsemble::setControlVolume(double x0, double y0, double z0, double x1 Log::global_log->error() << "\nInvalid control volume (" << x0 << " / " << y0 << " / " << z0 << ") to (" << x1 << " / " << y1 << " / " << z1 << ")." << std::endl; - Simulation::exit(711); + mardyn_exit(711); } this->restrictedControlVolume = true; @@ -112,19 +112,19 @@ void CavityEnsemble::setControlVolume(double x0, double y0, double z0, double x1 void CavityEnsemble::init(Component *component, unsigned Nx, unsigned Ny, unsigned Nz) { if (this->ownrank < 0) { Log::global_log->error() << "\nInvalid rank " << ownrank << ".\n"; - Simulation::exit(712); + mardyn_exit(712); } if (this->initialized) { Log::global_log->error() << "\nCavity ensemble initialized twice.\n"; - Simulation::exit(713); + mardyn_exit(713); } if (0.0 >= this->T) { Log::global_log->error() << "\nInvalid temperature T = " << T << ".\n"; - Simulation::exit(714); + mardyn_exit(714); } if (0.0 >= this->globalV) { Log::global_log->error() << "\nInvalid control volume V_ctrl = " << globalV << ".\n"; - Simulation::exit(715); + mardyn_exit(715); } this->componentid = component->ID(); diff --git a/src/ensemble/ChemicalPotential.cpp b/src/ensemble/ChemicalPotential.cpp index 744906dab2..a535104e44 100644 --- a/src/ensemble/ChemicalPotential.cpp +++ b/src/ensemble/ChemicalPotential.cpp @@ -285,7 +285,7 @@ bool ChemicalPotential::decideDeletion(double deltaUTilde) return false; } Log::global_log->error() << "No decision is possible." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } float dec = *_remainingDecisions.begin(); _remainingDecisions.erase(_remainingDecisions.begin()); @@ -318,7 +318,7 @@ bool ChemicalPotential::decideInsertion(double deltaUTilde) return false; } Log::global_log->error() << "No decision is possible." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } double acc = _globalReducedVolume * exp(_muTilde - deltaUTilde) / (1.0 + (double) (_globalN)); @@ -376,7 +376,7 @@ void ChemicalPotential::setControlVolume(double x0, double y0, double z0, Log::global_log->error() << "\nInvalid control volume (" << x0 << " / " << y0 << " / " << z0 << ") to (" << x1 << " / " << y1 << " / " << z1 << ")." << std::endl; - Simulation::exit(611); + mardyn_exit(611); } _restrictedControlVolume = true; _globalV = (x1 - x0) * (y1 - y0) * (z1 - z0); diff --git a/src/ensemble/EnsembleBase.cpp b/src/ensemble/EnsembleBase.cpp index f9f99e586f..1d6f269ec6 100644 --- a/src/ensemble/EnsembleBase.cpp +++ b/src/ensemble/EnsembleBase.cpp @@ -4,6 +4,7 @@ #include "molecules/mixingrules/LorentzBerthelot.h" #include "utils/xmlfileUnits.h" #include "utils/Logger.h" +#include "utils/mardyn_assert.h" #include "Simulation.h" #include "Domain.h" @@ -24,7 +25,7 @@ void Ensemble::readXML(XMLfileUnits& xmlconfig) { Log::global_log->info() << "Number of components: " << numComponents << std::endl; if (numComponents == 0) { Log::global_log->fatal() << "No components found. Please verify that you have input them correctly." << std::endl; - Simulation::exit(96123); + mardyn_exit(96123); } _components.resize(numComponents); XMLfile::Query::const_iterator componentIter; @@ -63,7 +64,7 @@ void Ensemble::readXML(XMLfileUnits& xmlconfig) { } else { Log::global_log->error() << "Unknown mixing rule " << mixingruletype << std::endl; - Simulation::exit(1); + mardyn_exit(1); } mixingrule->readXML(xmlconfig); _mixingrules.push_back(mixingrule); diff --git a/src/ensemble/GrandCanonicalEnsemble.cpp b/src/ensemble/GrandCanonicalEnsemble.cpp index 0ef49b1817..f32daf988f 100644 --- a/src/ensemble/GrandCanonicalEnsemble.cpp +++ b/src/ensemble/GrandCanonicalEnsemble.cpp @@ -7,6 +7,7 @@ #include "Domain.h" #include "parallel/DomainDecompBase.h" #include "ChemicalPotential.h" +#include "Simulation.h" GrandCanonicalEnsemble::GrandCanonicalEnsemble() : _N(0), _V(0), _T(0), _mu(0), _p(0), _E(0), _E_trans(0), _E_rot(0) { diff --git a/src/ensemble/GrandCanonicalEnsemble.h b/src/ensemble/GrandCanonicalEnsemble.h index b1ae19b6d6..2249cc0de7 100644 --- a/src/ensemble/GrandCanonicalEnsemble.h +++ b/src/ensemble/GrandCanonicalEnsemble.h @@ -6,7 +6,7 @@ #include "EnsembleBase.h" -#include "Simulation.h" +#include "utils/mardyn_assert.h" #include "ChemicalPotential.h" class Domain; @@ -41,7 +41,7 @@ class GrandCanonicalEnsemble : public Ensemble { // TODO: Implement STUB void readXML(XMLfileUnits& xmlconfig) override { Log::global_log->info() << "[GrandCanonicalEnsemble] readXML not implemented!" << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); }; unsigned long N() override { @@ -71,7 +71,7 @@ class GrandCanonicalEnsemble : public Ensemble { // TODO: Implement void updateGlobalVariable(ParticleContainer* particleContainer, GlobalVariable variable) override { Log::global_log->info() << "[GrandCanonicalEnsemble] updateGlobalVariable not implemented!" << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); }; /*! Runs steps formerly in initConfigXML in simulation.cpp */ diff --git a/src/ensemble/PressureGradient.cpp b/src/ensemble/PressureGradient.cpp index a8fe7e0df7..029a1a9e77 100644 --- a/src/ensemble/PressureGradient.cpp +++ b/src/ensemble/PressureGradient.cpp @@ -7,7 +7,7 @@ #include "parallel/DomainDecompBase.h" #include "particleContainer/ParticleContainer.h" #include "utils/Logger.h" -#include "Simulation.h" +#include "utils/mardyn_assert.h" PressureGradient::PressureGradient(int rank) { @@ -220,7 +220,7 @@ void PressureGradient::specifyTauPrime(double tauPrime, double dt) if(this->_universalConstantAccelerationTimesteps == 0) { Log::global_log->error() << "SEVERE ERROR: unknown UCAT!\n"; - Simulation::exit(78); + mardyn_exit(78); } unsigned int vql = (unsigned int)ceil(tauPrime / (dt*this->_universalConstantAccelerationTimesteps)); std::map::iterator vqlit; diff --git a/src/integrators/Leapfrog.cpp b/src/integrators/Leapfrog.cpp index 6e53e26bed..afa7bbd08a 100644 --- a/src/integrators/Leapfrog.cpp +++ b/src/integrators/Leapfrog.cpp @@ -6,7 +6,7 @@ #include "ensemble/EnsembleBase.h" #include "molecules/Molecule.h" #include "particleContainer/ParticleContainer.h" -#include "Simulation.h" +#include "utils/mardyn_assert.h" #include "utils/Logger.h" #include "utils/xmlfileUnits.h" diff --git a/src/integrators/LeapfrogRMM.cpp b/src/integrators/LeapfrogRMM.cpp index 60105284a9..1c73059bfd 100644 --- a/src/integrators/LeapfrogRMM.cpp +++ b/src/integrators/LeapfrogRMM.cpp @@ -1,6 +1,6 @@ #include "LeapfrogRMM.h" -#include "Simulation.h" +#include "utils/mardyn_assert.h" #include "utils/Logger.h" #include "utils/xmlfileUnits.h" diff --git a/src/io/ASCIIReader.cpp b/src/io/ASCIIReader.cpp index c0d1a6a76a..739e267c68 100644 --- a/src/io/ASCIIReader.cpp +++ b/src/io/ASCIIReader.cpp @@ -20,6 +20,7 @@ #include "particleContainer/ParticleContainer.h" #include "utils/Logger.h" +#include "utils/mardyn_assert.h" ASCIIReader::ASCIIReader() {} @@ -53,7 +54,7 @@ void ASCIIReader::readPhaseSpaceHeader(Domain* domain, double timestep) { _phaseSpaceHeaderFileStream >> token; if(token != "mardyn") { Log::global_log->error() << _phaseSpaceHeaderFile << " not a valid mardyn input file." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } std::string inputversion; @@ -61,12 +62,12 @@ void ASCIIReader::readPhaseSpaceHeader(Domain* domain, double timestep) { // FIXME: remove tag trunk from file specification? if(token != "trunk") { Log::global_log->error() << "Wrong input file specifier (\'" << token << "\' instead of \'trunk\')." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } if(std::stoi(inputversion) < 20080701) { Log::global_log->error() << "Input version too old (" << inputversion << ")" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } Log::global_log->info() << "Reading phase space header from file " << _phaseSpaceHeaderFile << std::endl; @@ -161,7 +162,7 @@ void ASCIIReader::readPhaseSpaceHeader(Domain* domain, double timestep) { if(numtersoff != 0) { Log::global_log->error() << "tersoff no longer supported." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } double x, y, z, m; for(unsigned int j = 0; j < numljcenters; j++) { @@ -263,7 +264,7 @@ ASCIIReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domain _phaseSpaceFileStream.open(_phaseSpaceFile.c_str()); if(!_phaseSpaceFileStream.is_open()) { Log::global_log->error() << "Could not open phaseSpaceFile " << _phaseSpaceFile << std::endl; - Simulation::exit(1); + mardyn_exit(1); } Log::global_log->info() << "Reading phase space file " << _phaseSpaceFile << std::endl; #ifdef ENABLE_MPI @@ -289,7 +290,7 @@ ASCIIReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domain } if((token != "NumberOfMolecules") && (token != "N")) { Log::global_log->error() << "Expected the token 'NumberOfMolecules (N)' instead of '" << token << "'" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } _phaseSpaceFileStream >> nummolecules; #ifdef ENABLE_MPI @@ -316,7 +317,7 @@ ASCIIReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domain else if(ntypestring == "IRV") ntype = Ndatatype::IRV; else { Log::global_log->error() << "Unknown molecule format '" << ntypestring << "'" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } } else { _phaseSpaceFileStream.seekg(spos); @@ -377,7 +378,7 @@ ASCIIReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domain break; default: Log::global_log->error() << "[ASCIIReader.cpp] Unknown ntype" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } if((x < 0.0 || x >= domain->getGlobalLength(0)) || (y < 0.0 || y >= domain->getGlobalLength(1)) @@ -391,7 +392,7 @@ ASCIIReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domain << componentid << ">" << numcomponents << std::endl; - Simulation::exit(1); + mardyn_exit(1); } // ComponentIDs are used as array IDs, hence need to start at 0. // In the input files they always start with 1 so we need to adapt that all the time. diff --git a/src/io/BinaryReader.cpp b/src/io/BinaryReader.cpp index 83875f6e95..95c56fa418 100644 --- a/src/io/BinaryReader.cpp +++ b/src/io/BinaryReader.cpp @@ -26,6 +26,7 @@ #include "utils/Logger.h" #include "utils/Timer.h" #include "utils/xmlfileUnits.h" +#include "utils/mardyn_assert.h" #include #include @@ -77,7 +78,7 @@ void BinaryReader::readPhaseSpaceHeader(Domain* domain, double timestep) { if(not inp.changecurrentnode("/mardyn")) { Log::global_log->error() << "Could not find root node /mardyn in XML input file." << std::endl; Log::global_log->fatal() << "Not a valid MarDyn XML input file." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } bool bInputOk = true; @@ -95,7 +96,7 @@ void BinaryReader::readPhaseSpaceHeader(Domain* domain, double timestep) { if(not bInputOk) { Log::global_log->error() << "Content of file: '" << _phaseSpaceHeaderFile << "' corrupted! Program exit ..." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } if("ICRVQD" == strMoleculeFormat) @@ -106,7 +107,7 @@ void BinaryReader::readPhaseSpaceHeader(Domain* domain, double timestep) { _nMoleculeFormat = ICRV; else { Log::global_log->error() << "Not a valid molecule format: " << strMoleculeFormat << ", program exit ..." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } // Set parameters of Domain and Simulation class @@ -133,7 +134,7 @@ BinaryReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domai if(!_phaseSpaceFileStream.is_open()) { Log::global_log->error() << "Could not open phaseSpaceFile " << _phaseSpaceFile << std::endl; - Simulation::exit(1); + mardyn_exit(1); } Log::global_log->info() << "Reading phase space file " << _phaseSpaceFile << std::endl; @@ -177,7 +178,7 @@ BinaryReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domai if(_phaseSpaceFileStream.eof()) { Log::global_log->error() << "End of file was hit before all " << numMolecules << " expected molecules were read." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } _phaseSpaceFileStream.read(reinterpret_cast (&id), 8); switch (_nMoleculeFormat) { @@ -220,7 +221,7 @@ BinaryReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domai default: Log::global_log->error() << "BinaryReader: Unknown phase space format: " << _nMoleculeFormat << std::endl << "Aborting simulation." << std::endl; - Simulation::exit(12); + mardyn_exit(12); } if ((x < 0.0 || x >= domain->getGlobalLength(0)) || (y < 0.0 || y >= domain->getGlobalLength(1)) || (z < 0.0 || z >= domain->getGlobalLength(2))) { @@ -233,12 +234,12 @@ BinaryReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domai << componentid << ">" << numcomponents << std::endl; - Simulation::exit(1); + mardyn_exit(1); } if(componentid == 0) { Log::global_log->error() << "Molecule id " << id << " has componentID == 0." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } // ComponentIDs are used as array IDs, hence need to start at 0. // In the input files they always start with 1 so we need to adapt that all the time. diff --git a/src/io/CavityWriter.cpp b/src/io/CavityWriter.cpp index 1ae3ff9118..5c6d57601e 100644 --- a/src/io/CavityWriter.cpp +++ b/src/io/CavityWriter.cpp @@ -9,6 +9,7 @@ #include "parallel/DomainDecompBase.h" #include "particleContainer/ParticleContainer.h" #include "utils/Logger.h" +#include "utils/mardyn_assert.h" #include "Simulation.h" #include "ensemble/CavityEnsemble.h" @@ -37,28 +38,28 @@ void CavityWriter::readXML(XMLfileUnits &xmlconfig) { xmlconfig.getNodeValue("maxNeighbours", _maxNeighbors); if (_maxNeighbors <= 0) { Log::global_log->error() << "[CavityWriter] Invalid number of maxNeighbors: " << _maxNeighbors << std::endl; - Simulation::exit(999); + mardyn_exit(999); } xmlconfig.getNodeValue("radius", _radius); if (_radius <= 0.0f) { Log::global_log->error() << "[CavityWriter] Invalid size of radius: " << _radius << std::endl; - Simulation::exit(999); + mardyn_exit(999); } xmlconfig.getNodeValue("Nx", _Nx); if (_Nx <= 0) { Log::global_log->error() << "[CavityWriter] Invalid number of cells Nx: " << _Nx << std::endl; - Simulation::exit(999); + mardyn_exit(999); } xmlconfig.getNodeValue("Ny", _Ny); if (_Ny <= 0) { Log::global_log->error() << "[CavityWriter] Invalid number of cells Ny: " << _Ny << std::endl; - Simulation::exit(999); + mardyn_exit(999); } xmlconfig.getNodeValue("Nz", _Nz); if (_Nz <= 0) { Log::global_log->error() << "[CavityWriter] Invalid number of cells Nz: " << _Nz << std::endl; - Simulation::exit(999); + mardyn_exit(999); } // Default Control Volume is entire Domain @@ -76,13 +77,13 @@ void CavityWriter::readXML(XMLfileUnits &xmlconfig) { if (_controlVolume[d * 2] > _controlVolume[d * 2 + 1]) { Log::global_log->error() << "[CavityWriter] Lower Bound of Control Volume may not be larger than upper bound. " << std::endl; - Simulation::exit(999); + mardyn_exit(999); } if (_controlVolume[d * 2] < 0 || _controlVolume[d * 2 + 1] > global_simulation->getDomain()->getGlobalLength(d)) { Log::global_log->error() << "[CavityWriter] Control volume bounds may not be outside of domain boundaries. " << std::endl; - Simulation::exit(999); + mardyn_exit(999); } } diff --git a/src/io/CheckpointWriter.cpp b/src/io/CheckpointWriter.cpp index da5f5010c0..6d8c4621c7 100644 --- a/src/io/CheckpointWriter.cpp +++ b/src/io/CheckpointWriter.cpp @@ -7,8 +7,10 @@ #include "Common.h" #include "Domain.h" +#include "Simulation.h" #include "parallel/DomainDecompBase.h" #include "utils/Logger.h" +#include "utils/mardyn_assert.h" void CheckpointWriter::readXML(XMLfileUnits& xmlconfig) { @@ -18,7 +20,7 @@ void CheckpointWriter::readXML(XMLfileUnits& xmlconfig) { if(_writeFrequency == 0) { Log::global_log->error() << "Write frequency must be a positive nonzero integer, but is " << _writeFrequency << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } std::string checkpointType = "unknown"; @@ -31,7 +33,7 @@ void CheckpointWriter::readXML(XMLfileUnits& xmlconfig) { } else { Log::global_log->error() << "Unknown CheckpointWriter type '" << checkpointType << "', expected: ASCII|binary." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } _outputPrefix = "mardyn"; diff --git a/src/io/CommunicationPartnerWriter.cpp b/src/io/CommunicationPartnerWriter.cpp index 2d52b7e04c..1a280316e7 100644 --- a/src/io/CommunicationPartnerWriter.cpp +++ b/src/io/CommunicationPartnerWriter.cpp @@ -5,6 +5,8 @@ #include "Common.h" #include "Domain.h" +#include "Simulation.h" +#include "utils/mardyn_assert.h" #include "utils/Logger.h" #include "parallel/DomainDecompBase.h" @@ -16,7 +18,7 @@ void CommunicationPartnerWriter::readXML(XMLfileUnits& xmlconfig) { if(_writeFrequency == 0) { Log::global_log->error() << "Write frequency must be a positive nonzero integer, but is " << _writeFrequency << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } std::string HaloParticleType = "unknown"; diff --git a/src/io/CubicGridGeneratorInternal.cpp b/src/io/CubicGridGeneratorInternal.cpp index 51ece48d6e..8c3e7e85c2 100644 --- a/src/io/CubicGridGeneratorInternal.cpp +++ b/src/io/CubicGridGeneratorInternal.cpp @@ -11,12 +11,14 @@ #include "CubicGridGeneratorInternal.h" #include "Domain.h" +#include "Simulation.h" #include "IOHelpers.h" #include "WrapOpenMP.h" #include "parallel/DomainDecompBase.h" #include "particleContainer/ParticleContainer.h" #include "utils/Logger.h" #include "utils/Random.h" +#include "utils/mardyn_assert.h" #include #include @@ -39,7 +41,7 @@ void CubicGridGeneratorInternal::readXML(XMLfileUnits& xmlconfig) { // setting both or none is not allowed! if((_numMolecules == 0 && density == -1.) || (_numMolecules != 0 && density != -1.) ){ Log::global_log->error() << "Error in CubicGridGeneratorInternal: You have to set either density or numMolecules!" << std::endl; - Simulation::exit(2341); + mardyn_exit(2341); } if(density != -1.){ @@ -48,7 +50,7 @@ void CubicGridGeneratorInternal::readXML(XMLfileUnits& xmlconfig) { Log::global_log->error() << "Error in CubicGridGeneratorInternal: Density has to be positive and non-zero!" << std::endl; - Simulation::exit(2342); + mardyn_exit(2342); } double vol = 1.0; for (int d = 0; d < 3; ++d) @@ -65,7 +67,7 @@ unsigned long CubicGridGeneratorInternal::readPhaseSpace(ParticleContainer *part if(_numMolecules == 0){ Log::global_log->error() << "Error in CubicGridGeneratorInternal: numMolecules is not set!" << std::endl << "Please make sure to run readXML()!" << std::endl; - Simulation::exit(2341); + mardyn_exit(2341); } // create a body centered cubic layout, by creating by placing the molecules on the diff --git a/src/io/FlopRateWriter.cpp b/src/io/FlopRateWriter.cpp index 7854594962..e438a724da 100644 --- a/src/io/FlopRateWriter.cpp +++ b/src/io/FlopRateWriter.cpp @@ -10,6 +10,7 @@ #include "particleContainer/ParticleContainer.h" #include "particleContainer/adapter/FlopCounter.h" #include "parallel/DomainDecompBase.h" +#include "utils/mardyn_assert.h" #include "Simulation.h" void FlopRateWriter::readXML(XMLfileUnits& xmlconfig) { @@ -35,7 +36,7 @@ void FlopRateWriter::readXML(XMLfileUnits& xmlconfig) { // TODO: if(_writeToFile) { Log::global_log->error() << "TODO: file output not yet supported." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } if(_writeToFile) { diff --git a/src/io/GammaWriter.cpp b/src/io/GammaWriter.cpp index 2faa439c1f..c2e1db2642 100644 --- a/src/io/GammaWriter.cpp +++ b/src/io/GammaWriter.cpp @@ -7,6 +7,7 @@ #include "particleContainer/ParticleContainer.h" #include "parallel/DomainDecompBase.h" #include "Domain.h" +#include "Simulation.h" #include "utils/xmlfileUnits.h" #include "utils/FileUtils.h" diff --git a/src/io/HaloParticleWriter.cpp b/src/io/HaloParticleWriter.cpp index c18cbc4c2f..cd6f058252 100644 --- a/src/io/HaloParticleWriter.cpp +++ b/src/io/HaloParticleWriter.cpp @@ -5,8 +5,10 @@ #include "Common.h" #include "Domain.h" +#include "Simulation.h" #include "utils/Logger.h" #include "parallel/DomainDecompBase.h" +#include "utils/mardyn_assert.h" void HaloParticleWriter::readXML(XMLfileUnits& xmlconfig) { @@ -16,7 +18,7 @@ void HaloParticleWriter::readXML(XMLfileUnits& xmlconfig) { if(_writeFrequency == 0) { Log::global_log->error() << "Write frequency must be a positive nonzero integer, but is " << _writeFrequency << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } std::string HaloParticleType = "unknown"; diff --git a/src/io/KDTreePrinter.cpp b/src/io/KDTreePrinter.cpp index 32ffe62c98..132a7e1965 100644 --- a/src/io/KDTreePrinter.cpp +++ b/src/io/KDTreePrinter.cpp @@ -2,6 +2,7 @@ #include "Common.h" #include "Simulation.h" +#include "utils/mardyn_assert.h" #include "utils/Logger.h" #include "utils/xmlfileUnits.h" #include "parallel/DomainDecompBase.h" @@ -19,7 +20,7 @@ void KDTreePrinter::readXML(XMLfileUnits &xmlconfig) { if (_writeFrequency == 0) { Log::global_log->error() << "Write frequency must be a positive nonzero integer, but is " << _writeFrequency << std::endl; - Simulation::exit(948947); + mardyn_exit(948947); } _outputPrefix = "mardyn"; diff --git a/src/io/LoadBalanceWriter.cpp b/src/io/LoadBalanceWriter.cpp index 3d92664404..c59210301b 100644 --- a/src/io/LoadBalanceWriter.cpp +++ b/src/io/LoadBalanceWriter.cpp @@ -1,6 +1,7 @@ #include "io/LoadBalanceWriter.h" #include "Simulation.h" +#include "utils/mardyn_assert.h" #include "TimerProfiler.h" #include "parallel/DomainDecompBase.h" diff --git a/src/io/MPICheckpointWriter.cpp b/src/io/MPICheckpointWriter.cpp index 55c2d44969..8081b0b5b0 100644 --- a/src/io/MPICheckpointWriter.cpp +++ b/src/io/MPICheckpointWriter.cpp @@ -15,6 +15,7 @@ #include "Common.h" #include "Domain.h" +#include "Simulation.h" #include "utils/Logger.h" #include "parallel/DomainDecompBase.h" diff --git a/src/io/MPI_IOCheckpointWriter.cpp b/src/io/MPI_IOCheckpointWriter.cpp index 685f5bd3dc..b160edd7e5 100644 --- a/src/io/MPI_IOCheckpointWriter.cpp +++ b/src/io/MPI_IOCheckpointWriter.cpp @@ -13,7 +13,9 @@ #include "Common.h" #include "Domain.h" +#include "Simulation.h" #include "utils/Logger.h" +#include "utils/mardyn_assert.h" #include "molecules/Molecule.h" #include "particleContainer/ParticleCell.h" @@ -434,6 +436,6 @@ void MPI_IOCheckpointWriter::handle_error(int i) { Log::global_log->error() << "Writing of file was not successfull " << " , " << i << " , " << error_string << std::endl; - Simulation::exit(1); + mardyn_exit(1); #endif } diff --git a/src/io/MPI_IOReader.cpp b/src/io/MPI_IOReader.cpp index f706427b96..b8f7aa3021 100644 --- a/src/io/MPI_IOReader.cpp +++ b/src/io/MPI_IOReader.cpp @@ -16,9 +16,10 @@ #include #include "Domain.h" +#include "Simulation.h" #include "ensemble/BoxDomain.h" #include "ensemble/EnsembleBase.h" -#include "Simulation.h" +#include "utils/mardyn_assert.h" #include "molecules/Molecule.h" #ifdef ENABLE_MPI @@ -58,7 +59,7 @@ void MPI_IOReader::readPhaseSpaceHeader(Domain* domain, double timestep) { _phaseSpaceHeaderFileStream >> token; if(token != "mardyn") { Log::global_log->error() << _phaseSpaceHeaderFile << " not a valid mardyn input file." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } std::string inputversion; @@ -66,12 +67,12 @@ void MPI_IOReader::readPhaseSpaceHeader(Domain* domain, double timestep) { // FIXME: remove tag trunk from file specification? if(token != "trunk") { Log::global_log->error() << "Wrong input file specifier (\'" << token << "\' instead of \'trunk\')." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } if(strtoul(inputversion.c_str(), NULL, 0) < 20080701) { Log::global_log->error() << "Input version tool old (" << inputversion << ")" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } Log::global_log->info() << "Reading phase space header from file " << _phaseSpaceHeaderFile << std::endl; @@ -116,7 +117,7 @@ void MPI_IOReader::readPhaseSpaceHeader(Domain* domain, double timestep) { || ntypestring == "IRV")) { Log::global_log->error() << "Unknown molecule format: '" << ntypestring << "'" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } _moleculeFormat = ntypestring; Log::global_log->info() << " molecule format: " << ntypestring << std::endl; @@ -182,7 +183,7 @@ void MPI_IOReader::readPhaseSpaceHeader(Domain* domain, double timestep) { >> numquadrupoles >> numtersoff; if(numtersoff != 0) { Log::global_log->error() << "tersoff no longer supported." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } double x, y, z, m; for(unsigned int j = 0; j < numljcenters; j++) { @@ -664,6 +665,6 @@ void MPI_IOReader::handle_error(int i) { Log::global_log->error() << "Writing of file was not successfull " << " , " << i << " , " << error_string << std::endl; - Simulation::exit(1); + mardyn_exit(1); #endif } diff --git a/src/io/Mkesfera.cpp b/src/io/Mkesfera.cpp index f227a3f4b2..c374fe6462 100755 --- a/src/io/Mkesfera.cpp +++ b/src/io/Mkesfera.cpp @@ -7,10 +7,11 @@ #include #include "Domain.h" +#include "Simulation.h" #include "ensemble/EnsembleBase.h" #include "molecules/Component.h" #include "particleContainer/ParticleContainer.h" -#include "Simulation.h" +#include "utils/mardyn_assert.h" #include "utils/Logger.h" #include "utils/Random.h" @@ -175,7 +176,7 @@ MkesferaGenerator::readPhaseSpace(ParticleContainer* particleContainer, Domain* idx[2] - startx[2] >= fl_units_local[2] or startx[0] > idx[0] or startx[1] > idx[1] or startx[2] > idx[2]) { Log::global_log->error() << "Error in calculation of start and end values! \n"; - Simulation::exit(0); + mardyn_exit(0); } fill[idx[0] - startx[0]][idx[1] - startx[1]][idx[2] - startx[2]][p] = tfill; if(tfill) { diff --git a/src/io/MmpldWriter.cpp b/src/io/MmpldWriter.cpp index a4fa15ff69..72defd987a 100644 --- a/src/io/MmpldWriter.cpp +++ b/src/io/MmpldWriter.cpp @@ -22,10 +22,10 @@ #include "Common.h" #include "Domain.h" +#include "Simulation.h" #include "molecules/Molecule.h" #include "particleContainer/ParticleContainer.h" #include "parallel/DomainDecompBase.h" -#include "Simulation.h" #include "utils/FileUtils.h" #include "utils/Logger.h" #include "utils/mardyn_assert.h" @@ -56,7 +56,7 @@ MmpldWriter::MmpldWriter(uint64_t startTimestep, uint64_t writeFrequency, uint64 _color_type(MMPLD_COLOR_NONE) { if (0 == _writeFrequency) { - Simulation::exit(-1); + mardyn_exit(-1); } } @@ -89,7 +89,7 @@ void MmpldWriter::readXML(XMLfileUnits& xmlconfig) break; default: Log::global_log->error() << "Unsupported MMPLD version:" << _mmpldversion << std::endl; - Simulation::exit(1); + mardyn_exit(1); break; } xmlconfig.getNodeValue("outputprefix", _outputPrefix); @@ -102,7 +102,7 @@ void MmpldWriter::readXML(XMLfileUnits& xmlconfig) Log::global_log->info() << "[MMPLD Writer] Number of sites: " << numSites << std::endl; if(numSites < 1) { Log::global_log->fatal() << "[MMPLD Writer] No site parameters specified." << std::endl; - Simulation::exit(48973); + mardyn_exit(48973); } std::string oldpath = xmlconfig.getcurrentnodepath(); XMLfile::Query::const_iterator outputSiteIter; @@ -392,7 +392,7 @@ long MmpldWriter::get_data_frame_header_size() { break; default: Log::global_log->error() << "[MMPLD Writer] Unsupported MMPLD version: " << _mmpldversion << std::endl; - Simulation::exit(1); + mardyn_exit(1); break; } return data_frame_header_size; diff --git a/src/io/MmspdWriter.cpp b/src/io/MmspdWriter.cpp index 5d85c6aa02..bcf2c1d8c0 100644 --- a/src/io/MmspdWriter.cpp +++ b/src/io/MmspdWriter.cpp @@ -9,10 +9,10 @@ #include "Common.h" #include "Domain.h" +#include "Simulation.h" #include "molecules/Molecule.h" #include "particleContainer/ParticleContainer.h" #include "parallel/DomainDecompBase.h" -#include "Simulation.h" #include "utils/Logger.h" diff --git a/src/io/MultiObjectGenerator.cpp b/src/io/MultiObjectGenerator.cpp index b5459c7da7..70fb9c4b44 100644 --- a/src/io/MultiObjectGenerator.cpp +++ b/src/io/MultiObjectGenerator.cpp @@ -10,7 +10,6 @@ #endif #include "Domain.h" -#include "Simulation.h" #include "ensemble/EnsembleBase.h" #include "io/ObjectGenerator.h" #include "molecules/MoleculeIdPool.h" diff --git a/src/io/ODF.cpp b/src/io/ODF.cpp index fb426bc7ce..e6346f5f01 100644 --- a/src/io/ODF.cpp +++ b/src/io/ODF.cpp @@ -3,6 +3,8 @@ #include "ODF.h" #include "WrapOpenMP.h" +#include "Simulation.h" + void ODF::readXML(XMLfileUnits& xmlconfig) { Log::global_log->debug() << "[ODF] enabled. Dipole orientations must be set to [0 0 1]!" << std::endl; xmlconfig.getNodeValue("writefrequency", _writeFrequency); diff --git a/src/io/ObjectGenerator.cpp b/src/io/ObjectGenerator.cpp index 25a080147c..c342173c7f 100644 --- a/src/io/ObjectGenerator.cpp +++ b/src/io/ObjectGenerator.cpp @@ -3,7 +3,7 @@ #include #include -#include "Simulation.h" +#include "utils/mardyn_assert.h" #include "ensemble/EnsembleBase.h" #include "molecules/Molecule.h" #include "molecules/MoleculeIdPool.h" @@ -25,14 +25,14 @@ void ObjectGenerator::readXML(XMLfileUnits& xmlconfig) { _filler = std::shared_ptr(objectFillerFactory.create(fillerType)); if(!_filler) { Log::global_log->error() << "Object filler could not be created" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } Log::global_log->debug() << "Using object filler of type: " << _filler->getPluginName() << std::endl; _filler->readXML(xmlconfig); xmlconfig.changecurrentnode(".."); } else { Log::global_log->error() << "No filler specified." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } if(xmlconfig.changecurrentnode("object")) { @@ -49,7 +49,7 @@ void ObjectGenerator::readXML(XMLfileUnits& xmlconfig) { xmlconfig.changecurrentnode(".."); } else { Log::global_log->error() << "No object specified." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } if(xmlconfig.changecurrentnode("velocityAssigner")) { @@ -79,7 +79,7 @@ void ObjectGenerator::readXML(XMLfileUnits& xmlconfig) { _velocityAssigner = std::make_shared(0, seed); } else { Log::global_log->error() << "Unknown velocity assigner specified." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } Ensemble* ensemble = _simulation.getEnsemble(); Log::global_log->info() << "Setting temperature for velocity assigner to " << ensemble->T() << std::endl; diff --git a/src/io/PerCellGenerator.cpp b/src/io/PerCellGenerator.cpp index 673a67dd0d..e0631c6073 100644 --- a/src/io/PerCellGenerator.cpp +++ b/src/io/PerCellGenerator.cpp @@ -6,6 +6,7 @@ #include "Domain.h" #include "IOHelpers.h" #include "Simulation.h" +#include "utils/mardyn_assert.h" #include "ensemble/EnsembleBase.h" #include "molecules/Molecule.h" #include "parallel/DomainDecompBase.h" @@ -42,7 +43,7 @@ void PerCellGenerator::readXML(XMLfileUnits &xmlconfig) { Log::global_log->info() << "numMoleculesPerCell: " << _numMoleculesPerCell << std::endl; } else { Log::global_log->error() << "Missing required field numMoleculesPerCell. Aborting!" << std::endl; - Simulation::exit(1949); + mardyn_exit(1949); } xmlconfig.getNodeValue("initTemperature", _initTemperature); @@ -50,7 +51,7 @@ void PerCellGenerator::readXML(XMLfileUnits &xmlconfig) { Log::global_log->info() << "initTemperature: " << _initTemperature << std::endl; } else { Log::global_log->error() << "Missing required field initTemperature. Aborting!" << std::endl; - Simulation::exit(1949); + mardyn_exit(1949); } xmlconfig.getNodeValue("generateAtLeastTwoParticles", _generateAtLeastTwoParticles); diff --git a/src/io/RDF.cpp b/src/io/RDF.cpp index 2e628a8b95..732e869024 100644 --- a/src/io/RDF.cpp +++ b/src/io/RDF.cpp @@ -3,6 +3,7 @@ #include "Domain.h" #include "molecules/Component.h" #include "parallel/DomainDecompBase.h" +#include "utils/mardyn_assert.h" #include "Simulation.h" #include "utils/Logger.h" @@ -33,7 +34,7 @@ RDF::RDF() : void RDF::init() { if(!_readConfig){ Log::global_log->error() << "RDF initialized without reading the configuration, exiting" << std::endl; - Simulation::exit(25); + mardyn_exit(25); } _cellProcessor = new RDFCellProcessor(global_simulation->getcutoffRadius(), this); diff --git a/src/io/ReplicaGenerator.cpp b/src/io/ReplicaGenerator.cpp index fc505430e0..41e7737f3e 100755 --- a/src/io/ReplicaGenerator.cpp +++ b/src/io/ReplicaGenerator.cpp @@ -9,6 +9,7 @@ #include #include "Domain.h" +#include "Simulation.h" #include "parallel/DomainDecompBase.h" @@ -20,7 +21,7 @@ #include "ensemble/EnsembleBase.h" #include "molecules/Molecule.h" #include "particleContainer/ParticleContainer.h" -#include "Simulation.h" +#include "utils/mardyn_assert.h" #include "utils/Logger.h" @@ -57,7 +58,7 @@ void ReplicaGenerator::readReplicaPhaseSpaceHeader(SubDomain& subDomain) { if(not inp.changecurrentnode("/mardyn")) { Log::global_log->error() << "Could not find root node /mardyn in XML input file." << std::endl; Log::global_log->fatal() << "Not a valid MarDyn XML input file." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } bool bInputOk = true; @@ -81,7 +82,7 @@ void ReplicaGenerator::readReplicaPhaseSpaceHeader(SubDomain& subDomain) { if(not bInputOk) { Log::global_log->error() << "Content of file: '" << subDomain.strFilePathHeader << "' corrupted! Program exit ..." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } if("ICRVQD" == strMoleculeFormat) @@ -92,7 +93,7 @@ void ReplicaGenerator::readReplicaPhaseSpaceHeader(SubDomain& subDomain) { _nMoleculeFormat = ICRV; else { Log::global_log->error() << "Not a valid molecule format: " << strMoleculeFormat << ", program exit ..." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } } @@ -106,7 +107,7 @@ void ReplicaGenerator::readReplicaPhaseSpaceData(SubDomain& subDomain, DomainDec ifs.open(subDomain.strFilePathData.c_str(), std::ios::binary | std::ios::in); if(!ifs.is_open()) { Log::global_log->error() << "Could not open phaseSpaceFile " << subDomain.strFilePathData << std::endl; - Simulation::exit(1); + mardyn_exit(1); } Log::global_log->info() << "Reading phase space file " << subDomain.strFilePathData << std::endl; @@ -189,7 +190,7 @@ void ReplicaGenerator::readXML(XMLfileUnits& xmlconfig) { } else { Log::global_log->error() << "Specified wrong type at XML path: " << xmlconfig.getcurrentnodepath() << "/type" << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } SubDomain sd; @@ -240,7 +241,7 @@ void ReplicaGenerator::readXML(XMLfileUnits& xmlconfig) { Log::global_log->info() << "Number of components to change: " << (uint32_t) numChanges << std::endl; if(numChanges < 1) { Log::global_log->error() << "No component change defined in XML-config file. Program exit ..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } XMLfile::Query::const_iterator changeIter; for(changeIter = query.begin(); changeIter; changeIter++) { @@ -263,7 +264,7 @@ void ReplicaGenerator::readXML(XMLfileUnits& xmlconfig) { Log::global_log->info() << "Number of components to change: " << (uint32_t) numChanges << std::endl; if(numChanges < 1) { Log::global_log->error() << "No component change defined in XML-config file. Program exit ..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } XMLfile::Query::const_iterator changeIter; for(changeIter = query.begin(); changeIter; changeIter++) { @@ -531,7 +532,7 @@ ReplicaGenerator::readPhaseSpace(ParticleContainer* particleContainer, Domain* d " != " << (_numParticlesTotal - numAddedParticlesFreespaceGlobal) << " (expected). Program exit ..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } global_simulation->timers()->stop("REPLICA_GENERATOR_VLE_INPUT"); diff --git a/src/io/TimerProfiler.cpp b/src/io/TimerProfiler.cpp index ed6a1539e7..94bc1fcb2b 100644 --- a/src/io/TimerProfiler.cpp +++ b/src/io/TimerProfiler.cpp @@ -11,7 +11,6 @@ #include "TimerProfiler.h" #include "utils/Logger.h" #include "utils/String_utils.h" -#include "utils/mardyn_assert.h" #include "utils/xmlfileUnits.h" diff --git a/src/io/TimerWriter.cpp b/src/io/TimerWriter.cpp index f027c196f0..7521dd92c9 100644 --- a/src/io/TimerWriter.cpp +++ b/src/io/TimerWriter.cpp @@ -9,6 +9,7 @@ #include "TimerWriter.h" #include "Simulation.h" +#include "utils/mardyn_assert.h" #include "parallel/DomainDecompBase.h" void TimerWriter::readXML(XMLfileUnits& xmlconfig) { @@ -34,7 +35,7 @@ void TimerWriter::readXML(XMLfileUnits& xmlconfig) { } if (_timerNames.empty()) { Log::global_log->error() << "TimerWriter: no timers given. make sure you specify them correctly." << std::endl; - Simulation::exit(242367); + mardyn_exit(242367); } xmlconfig.changecurrentnode(oldpath); } diff --git a/src/io/vtk/VTKGridWriter.cpp b/src/io/vtk/VTKGridWriter.cpp index 07f15fdfa0..e31a1ede79 100644 --- a/src/io/vtk/VTKGridWriter.cpp +++ b/src/io/vtk/VTKGridWriter.cpp @@ -48,7 +48,7 @@ void VTKGridWriter::endStep( #ifndef NDEBUG if (container == NULL) { Log::global_log->error() << "VTKGridWriter works only with plottable LinkedCells!" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } #endif @@ -114,7 +114,7 @@ void VTKGridWriter::init(ParticleContainer *particleContainer, #ifndef NDEBUG if (dynamic_cast(particleContainer) == NULL) { Log::global_log->error() << "VTKGridWriter works only with LinkCells!" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } #endif } diff --git a/src/longRange/Homogeneous.cpp b/src/longRange/Homogeneous.cpp index 3ee022b008..8e25bfd89a 100644 --- a/src/longRange/Homogeneous.cpp +++ b/src/longRange/Homogeneous.cpp @@ -8,6 +8,7 @@ #include "particleContainer/ParticleContainer.h" #include "utils/Logger.h" +#include "utils/mardyn_assert.h" Homogeneous::Homogeneous(double cutoffRadius, double cutoffRadiusLJ, Domain* domain, ParticleContainer* particleContainer, Simulation* simulation) { @@ -81,7 +82,7 @@ void Homogeneous::init() { double tau2 = sqrt(xj * xj + yj * yj + zj * zj); if (tau1 + tau2 >= _cutoffLJ) { Log::global_log->error() << "Error calculating cutoff corrections, rc too small" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } double eps24; params >> eps24; diff --git a/src/longRange/Planar.cpp b/src/longRange/Planar.cpp index 991987a77d..a75a38a8c5 100644 --- a/src/longRange/Planar.cpp +++ b/src/longRange/Planar.cpp @@ -14,6 +14,7 @@ #include "utils/Logger.h" #include "utils/xmlfileUnits.h" #include "utils/FileUtils.h" +#include "utils/mardyn_assert.h" Planar::Planar(double /*cutoffT*/, double cutoffLJ, Domain* domain, DomainDecompBase* domainDecomposition, @@ -149,7 +150,7 @@ void Planar::init() Log::global_log->info() << "Long Range Correction: Subject registered" << std::endl; } else { Log::global_log->error() << "Long Range Correction: Initialization of plugin DistControl is needed before! Program exit..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } } } @@ -194,12 +195,12 @@ void Planar::readXML(XMLfileUnits& xmlconfig) if(_nWriteFreqProfiles < 1) { Log::global_log->error() << "Long Range Correction: Write frequency < 1! Programm exit ..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } if(_nStopWritingProfiles <= _nStartWritingProfiles) { Log::global_log->error() << "Long Range Correction: Writing profiles 'stop' <= 'start'! Programm exit ..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } bool bInputIsValid = (bRet1 && bRet2 && bRet3); if(true == bInputIsValid) @@ -211,7 +212,7 @@ void Planar::readXML(XMLfileUnits& xmlconfig) else { Log::global_log->error() << "Long Range Correction: Write control parameters not valid! Programm exit ..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } } diff --git a/src/longRange/Planar.h b/src/longRange/Planar.h index bc9c1920fc..f522f1a84f 100644 --- a/src/longRange/Planar.h +++ b/src/longRange/Planar.h @@ -13,6 +13,8 @@ #include #include "molecules/MoleculeForwardDeclaration.h" + +class Simulation; class Domain; class ParticleContainer; diff --git a/src/molecules/AutoPasSimpleMolecule.cpp b/src/molecules/AutoPasSimpleMolecule.cpp index dc1cf66198..bdccdc3227 100644 --- a/src/molecules/AutoPasSimpleMolecule.cpp +++ b/src/molecules/AutoPasSimpleMolecule.cpp @@ -5,7 +5,7 @@ */ #include "AutoPasSimpleMolecule.h" -#include "Simulation.h" +#include "utils/mardyn_assert.h" Component* AutoPasSimpleMolecule::_component = nullptr; @@ -20,7 +20,7 @@ AutoPasSimpleMolecule::AutoPasSimpleMolecule(unsigned long id, Component* compon } else if (_component != component and component != nullptr) { Log::global_log->debug() << "AutoPasSimpleMolecule can only handle one component" << std::endl; _component = component; - // Simulation::exit(32); + // mardyn_exit(32); } } diff --git a/src/molecules/Component.cpp b/src/molecules/Component.cpp index 09c657a914..fd1506a78b 100644 --- a/src/molecules/Component.cpp +++ b/src/molecules/Component.cpp @@ -5,7 +5,7 @@ #include "Site.h" #include "utils/xmlfileUnits.h" #include "utils/Logger.h" -#include "Simulation.h" +#include "utils/mardyn_assert.h" Component::Component(unsigned int id) { @@ -77,10 +77,10 @@ void Component::readXML(XMLfileUnits& xmlconfig) { addQuadrupole(quadrupoleSite); } else if (siteType == "Tersoff") { Log::global_log->error() << "Tersoff no longer supported:" << siteType << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } else { Log::global_log->error() << "Unknown site type:" << siteType << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } // go back to initial level, to be consistent, even if no site information is found. xmlconfig.changecurrentnode(".."); diff --git a/src/molecules/MoleculeInterface.cpp b/src/molecules/MoleculeInterface.cpp index e946f5f1f3..4ba56e0dbc 100644 --- a/src/molecules/MoleculeInterface.cpp +++ b/src/molecules/MoleculeInterface.cpp @@ -12,7 +12,6 @@ #include #include "utils/Logger.h" -#include "Simulation.h" bool MoleculeInterface::isLessThan(const MoleculeInterface& m2) const { @@ -32,7 +31,7 @@ bool MoleculeInterface::isLessThan(const MoleculeInterface& m2) const { return false; else { Log::global_log->error() << "LinkedCells::isFirstParticle: both Particles have the same position" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } } } diff --git a/src/molecules/MoleculeRMM.cpp b/src/molecules/MoleculeRMM.cpp index f3da8deb4d..3c39804ca9 100644 --- a/src/molecules/MoleculeRMM.cpp +++ b/src/molecules/MoleculeRMM.cpp @@ -7,6 +7,7 @@ #include "MoleculeRMM.h" #include "Simulation.h" +#include "utils/mardyn_assert.h" #include "molecules/Component.h" #include "molecules/Quaternion.h" #include "ensemble/EnsembleBase.h" diff --git a/src/parallel/CollectiveCommunication.h b/src/parallel/CollectiveCommunication.h index 4f542c0178..7c390fa0ea 100644 --- a/src/parallel/CollectiveCommunication.h +++ b/src/parallel/CollectiveCommunication.h @@ -3,7 +3,6 @@ #include -#include "Simulation.h" #include "utils/Logger.h" #include "CollectiveCommBase.h" #include "CollectiveCommunicationInterface.h" @@ -172,7 +171,7 @@ class CollectiveCommunication: public CollectiveCommBase, public CollectiveCommu break; default: Log::global_log->error()<<"invalid reducetype, aborting." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } MPI_CHECK( @@ -194,7 +193,7 @@ class CollectiveCommunication: public CollectiveCommBase, public CollectiveCommu break; default: Log::global_log->error()<<"invalid reducetype, aborting." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } MPI_CHECK(MPI_Allreduce( MPI_IN_PLACE, &_values[i], 1, _types[i], op, _communicator )); } diff --git a/src/parallel/CollectiveCommunicationNonBlocking.h b/src/parallel/CollectiveCommunicationNonBlocking.h index 3582472c25..d20e1818b7 100644 --- a/src/parallel/CollectiveCommunicationNonBlocking.h +++ b/src/parallel/CollectiveCommunicationNonBlocking.h @@ -11,7 +11,7 @@ #include #include #include "CollectiveCommunicationInterface.h" -#include "Simulation.h" +#include "utils/mardyn_assert.h" #if MPI_VERSION >= 3 @@ -41,7 +41,7 @@ class CollectiveCommunicationNonBlocking: public CollectiveCommunicationInterfac if (_currentKey != -1) { Log::global_log->error() << "CollectiveCommunicationNonBlocking: previous communication with key " << _currentKey << " not yet finalized" << std::endl; - Simulation::exit(234); + mardyn_exit(234); } _currentKey = key; @@ -59,7 +59,7 @@ class CollectiveCommunicationNonBlocking: public CollectiveCommunicationInterfac if (not inserted) { Log::global_log->error() << "CollectiveCommunicationNonBlocking: key " << _currentKey << " could not be inserted. Aborting!" << std::endl; - Simulation::exit(498789); + mardyn_exit(498789); } } _comms.at(_currentKey).init(communicator, numValues, _currentKey); diff --git a/src/parallel/CommunicationBuffer.cpp b/src/parallel/CommunicationBuffer.cpp index 5bd946f986..333f45170a 100644 --- a/src/parallel/CommunicationBuffer.cpp +++ b/src/parallel/CommunicationBuffer.cpp @@ -8,6 +8,7 @@ #include "CommunicationBuffer.h" #include "molecules/Molecule.h" #include "Simulation.h" +#include "utils/mardyn_assert.h" #include "ensemble/EnsembleBase.h" #include /* UINT64_MAX */ diff --git a/src/parallel/CommunicationPartner.cpp b/src/parallel/CommunicationPartner.cpp index c43812d911..90d99e1ded 100644 --- a/src/parallel/CommunicationPartner.cpp +++ b/src/parallel/CommunicationPartner.cpp @@ -12,6 +12,7 @@ #include "ForceHelper.h" #include "ParticleData.h" #include "Simulation.h" +#include "utils/mardyn_assert.h" #include "WrapOpenMP.h" #include "molecules/Molecule.h" #include "parallel/DomainDecompBase.h" @@ -195,7 +196,7 @@ void CommunicationPartner::initSend(ParticleContainer* moleculeContainer, const } default: Log::global_log->error() << "[CommunicationPartner] MessageType unknown!" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } #ifndef NDEBUG @@ -599,7 +600,7 @@ void CommunicationPartner::collectLeavingMoleculesFromInvalidParticles(std::vect auto shiftAndAdd = [domain, lowCorner, highCorner, shift, this, &numMolsAlreadyIn](Molecule& m) { if (not m.inBox(lowCorner, highCorner)) { Log::global_log->error() << "trying to remove a particle that is not in the halo region" << std::endl; - Simulation::exit(456); + mardyn_exit(456); } for (int dim = 0; dim < 3; dim++) { if (shift[dim] != 0) { diff --git a/src/parallel/DomainDecompBase.cpp b/src/parallel/DomainDecompBase.cpp index 3478ae79d6..c8bb20978f 100644 --- a/src/parallel/DomainDecompBase.cpp +++ b/src/parallel/DomainDecompBase.cpp @@ -2,7 +2,6 @@ #include #include "parallel/DomainDecompBase.h" -#include "Simulation.h" #include "Domain.h" #include "ensemble/EnsembleBase.h" #include "particleContainer/ParticleContainer.h" @@ -233,7 +232,7 @@ void DomainDecompBase::handleDomainLeavingParticlesDirect(const HaloRegion& halo auto shiftAndAdd = [&moleculeContainer, haloRegion, shift](Molecule& m) { if (not m.inBox(haloRegion.rmin, haloRegion.rmax)) { Log::global_log->error() << "trying to remove a particle that is not in the halo region" << std::endl; - Simulation::exit(456); + mardyn_exit(456); } for (int dim = 0; dim < 3; dim++) { if (shift[dim] != 0) { diff --git a/src/parallel/DomainDecompMPIBase.cpp b/src/parallel/DomainDecompMPIBase.cpp index be61e34858..cde084769c 100644 --- a/src/parallel/DomainDecompMPIBase.cpp +++ b/src/parallel/DomainDecompMPIBase.cpp @@ -10,6 +10,7 @@ #include "DomainDecompMPIBase.h" #include "molecules/Molecule.h" #include "particleContainer/ParticleContainer.h" +#include "utils/mardyn_assert.h" #include "Simulation.h" #include "parallel/NeighbourCommunicationScheme.h" #include "ParticleData.h" @@ -150,7 +151,7 @@ void DomainDecompMPIBase::setCommunicationScheme(const std::string& scheme, cons } else { Log::global_log->error() << "DomainDecompMPIBase: invalid zonal method specified. Valid values are 'fs', 'es', 'hs', 'mp' and 'nt'" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } Log::global_log->info() << "Using zonal method: " << zonalMethod << std::endl; @@ -166,7 +167,7 @@ void DomainDecompMPIBase::setCommunicationScheme(const std::string& scheme, cons } else { Log::global_log->error() << "DomainDecompMPIBase: invalid NeighbourCommunicationScheme specified. Valid values are 'direct' and 'indirect'" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } } diff --git a/src/parallel/DomainDecomposition.cpp b/src/parallel/DomainDecomposition.cpp index 2dc05349b2..4aa51be05a 100644 --- a/src/parallel/DomainDecomposition.cpp +++ b/src/parallel/DomainDecomposition.cpp @@ -28,7 +28,7 @@ void DomainDecomposition::initMPIGridDims() { Log::global_log->error() << "\tbut grid is " << _gridSize[0] << " x " << _gridSize[1] << " x " << _gridSize[2] << std::endl; Log::global_log->error() << "\tresulting in " << numProcsGridSize << " subdomains!" << std::endl; Log::global_log->error() << "\tplease check your input file!" << std::endl; - Simulation::exit(2134); + mardyn_exit(2134); } } @@ -62,7 +62,7 @@ void DomainDecomposition::prepareNonBlockingStage(bool /*forceRebalancing*/, Par Log::global_log->error() << "nonblocking P2P using separate messages for leaving and halo is currently not " "supported. Please use the indirect neighbor communication scheme!" << std::endl; - Simulation::exit(235861); + mardyn_exit(235861); } } @@ -75,7 +75,7 @@ void DomainDecomposition::finishNonBlockingStage(bool /*forceRebalancing*/, Part // Would first need to send leaving, then halo -> not good for overlapping! Log::global_log->error() << "nonblocking P2P using separate messages for leaving and halo is currently not supported." << std::endl; - Simulation::exit(235861); + mardyn_exit(235861); } } diff --git a/src/parallel/ForceHelper.cpp b/src/parallel/ForceHelper.cpp index 00c8aaec41..a741c847ec 100644 --- a/src/parallel/ForceHelper.cpp +++ b/src/parallel/ForceHelper.cpp @@ -1,7 +1,13 @@ -#include -#include + +#include "ForceHelper.h" + #include +#include "particleContainer/ParticleContainer.h" +#include "particleContainer/ParticleIterator.h" + +#include "utils/mardyn_assert.h" + std::variant> addValuesAndGetIterator( ParticleContainer* moleculeContainer, const double* position, std::variant> previousIterator, diff --git a/src/parallel/ForceHelper.h b/src/parallel/ForceHelper.h index 4500865a2f..4148be8437 100644 --- a/src/parallel/ForceHelper.h +++ b/src/parallel/ForceHelper.h @@ -2,6 +2,9 @@ #include +#include "particleContainer/ParticleContainer.h" +#include "particleContainer/ParticleIterator.h" + /** * Adds the force values (force (F), torque (M) and virial (Vi)) of haloMolecule to the particle at the given position. * The function will reuse the previousIterator if after an increment it points to a particle at the given position. diff --git a/src/parallel/GeneralDomainDecomposition.cpp b/src/parallel/GeneralDomainDecomposition.cpp index 63e45876fc..fbae56f0e9 100644 --- a/src/parallel/GeneralDomainDecomposition.cpp +++ b/src/parallel/GeneralDomainDecomposition.cpp @@ -12,6 +12,9 @@ #include "NeighborAcquirer.h" #include "NeighbourCommunicationScheme.h" +#include "utils/String_utils.h" +#include "utils/mardyn_assert.h" + #include #include #include @@ -56,7 +59,7 @@ void GeneralDomainDecomposition::initializeALL() { gridCoords, minimalDomainSize); #else Log::global_log->error() << "ALL load balancing library not enabled. Aborting." << std::endl; - Simulation::exit(24235); + mardyn_exit(24235); #endif Log::global_log->info() << "GeneralDomainDecomposition initial box: [" << _boxMin[0] << ", " << _boxMax[0] << "] x [" << _boxMin[1] << ", " << _boxMax[1] << "] x [" << _boxMin[2] << ", " << _boxMax[2] << "]" @@ -193,7 +196,7 @@ void GeneralDomainDecomposition::migrateParticles(Domain* domain, ParticleContai << particleContainer->getBoundingBoxMax(2) << "\n" << "Particle: \n" << *iter << std::endl; - Simulation::exit(2315); + mardyn_exit(2315); } } particleContainer->clear(); @@ -287,7 +290,7 @@ void GeneralDomainDecomposition::readXML(XMLfileUnits& xmlconfig) { Log::global_log->error() << "GeneralDomainDecomposition's gridSize should have three entries if a list is given, but has " << strings.size() << "!" << std::endl; - Simulation::exit(8134); + mardyn_exit(8134); } _gridSize = {std::stod(strings[0]), std::stod(strings[1]), std::stod(strings[2])}; } else { @@ -299,7 +302,7 @@ void GeneralDomainDecomposition::readXML(XMLfileUnits& xmlconfig) { Log::global_log->error() << "GeneralDomainDecomposition's gridSize (" << gridSize << ") is smaller than the interactionLength (" << _interactionLength << "). This is forbidden, as it leads to errors! " << std::endl; - Simulation::exit(8136); + mardyn_exit(8136); } } } @@ -316,12 +319,12 @@ void GeneralDomainDecomposition::readXML(XMLfileUnits& xmlconfig) { } else { Log::global_log->error() << "GeneralDomainDecomposition: Unknown load balancer " << loadBalancerString << ". Aborting! Please select a valid option! Valid options: ALL"; - Simulation::exit(1); + mardyn_exit(1); } _loadBalancer->readXML(xmlconfig); } else { Log::global_log->error() << "loadBalancer section missing! Aborting!" << std::endl; - Simulation::exit(8466); + mardyn_exit(8466); } xmlconfig.changecurrentnode(".."); } diff --git a/src/parallel/GeneralDomainDecomposition.h b/src/parallel/GeneralDomainDecomposition.h index 6d06d36361..7adbde1a76 100644 --- a/src/parallel/GeneralDomainDecomposition.h +++ b/src/parallel/GeneralDomainDecomposition.h @@ -8,6 +8,9 @@ #include +#include "Domain.h" + +#include "particleContainer/ParticleContainer.h" #include "DomainDecompMPIBase.h" #include "LoadBalancer.h" diff --git a/src/parallel/KDDecomposition.cpp b/src/parallel/KDDecomposition.cpp index 212cf76b05..e421d93dd1 100644 --- a/src/parallel/KDDecomposition.cpp +++ b/src/parallel/KDDecomposition.cpp @@ -12,9 +12,10 @@ #endif #include "Domain.h" +#include "Simulation.h" #include "KDNode.h" #include "molecules/Molecule.h" -#include "Simulation.h" +#include "utils/mardyn_assert.h" #include "particleContainer/ParticleContainer.h" #include "utils/Logger.h" #include "utils/xmlfileUnits.h" @@ -67,7 +68,7 @@ void KDDecomposition::init(Domain* domain){ Log::global_log->error() << "KDDecomposition not possible. Each process needs at least " << minCellCountPerProc << " cells." << std::endl; Log::global_log->error() << "The number of Cells is only sufficient for " << _decompTree->getNumMaxProcs() << " Procs!" << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } _decompTree->buildKDTree(); _ownArea = _decompTree->findAreaForProcess(_rank); @@ -103,7 +104,7 @@ void KDDecomposition::readXML(XMLfileUnits& xmlconfig) { << std::endl; if(KDDStaticValues::minNumCellsPerDimension==0u){ Log::global_log->error() << "KDDecomposition minNumCellsPerDimension has to be bigger than zero!" << std::endl; - Simulation::exit(43); + mardyn_exit(43); } xmlconfig.getNodeValue("updateFrequency", _frequency); Log::global_log->info() << "KDDecomposition update frequency: " << _frequency << std::endl; @@ -125,7 +126,7 @@ void KDDecomposition::readXML(XMLfileUnits& xmlconfig) { } else { Log::global_log->fatal() << "Wrong deviationReductionOperation given: " << _deviationReductionOperation << ". Should be 'max' or 'sum'." << std::endl; - Simulation::exit(45681); + mardyn_exit(45681); } } Log::global_log->info() << "KDDecomposition uses " << deviationReductionOperation @@ -317,7 +318,7 @@ void KDDecomposition::balanceAndExchange(double lastTraversalTime, bool forceReb if (not migrationSuccessful) { Log::global_log->error() << "A problem occurred during particle migration between old decomposition and new decomposition of the KDDecomposition." << std::endl; Log::global_log->error() << "Aborting. Please save your input files and last available checkpoint and contact TUM SCCS." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } delete _decompTree; _decompTree = newDecompRoot; @@ -554,7 +555,7 @@ bool KDDecomposition::migrateParticles(const KDNode& newRoot, const KDNode& newO void KDDecomposition::fillTimeVecs(CellProcessor **cellProc){ if(cellProc == nullptr){ Log::global_log->error() << "The cellProcessor was not yet set! Please reorder fillTimeVecs, so that there won't be a problem!"; - Simulation::exit(1); + mardyn_exit(1); } auto _tunerLoadCalc = dynamic_cast(_loadCalc); if(_tunerLoadCalc){ @@ -1024,7 +1025,7 @@ bool KDDecomposition::calculateAllPossibleSubdivisions(KDNode* node, std::listerror() << "no processor speeds given" << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } double optimalLoad = (_accumulatedProcessorSpeeds[node->_owningProc + node->_numProcs] - _accumulatedProcessorSpeeds[node->_owningProc]) * leftRightLoadRatio / (1. + leftRightLoadRatio); @@ -1087,7 +1088,7 @@ bool KDDecomposition::calculateAllPossibleSubdivisions(KDNode* node, std::list_child2->_numProcs <= 0 || clone->_child2->_numProcs >= node->_numProcs) ){ //continue; Log::global_log->error_always_output() << "ERROR in calculateAllPossibleSubdivisions(), part of the domain was not assigned to a proc" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } mardyn_assert( clone->_child1->isResolvable() && clone->_child2->isResolvable() ); @@ -1247,7 +1248,7 @@ void KDDecomposition::calculateCostsPar(KDNode* area, std::vectorerror() << "[KDDecomposition] zeroCounts too large!" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } } } @@ -1432,13 +1433,13 @@ void KDDecomposition::calcNumParticlesPerCell(ParticleContainer* moleculeContain std::vector KDDecomposition::getNeighbourRanks() { //global_log->error() << "not implemented \n"; - Simulation::exit(-1); + mardyn_exit(-1); return std::vector (0); } std::vector KDDecomposition::getNeighbourRanksFullShell() { //global_log->error() << "not implemented \n"; - Simulation::exit(-1); + mardyn_exit(-1); return std::vector (0); } @@ -1772,7 +1773,7 @@ bool KDDecomposition::calculateHeteroSubdivision(KDNode* node, KDNode*& optimalN if (costsLeft[biggestDim].size()<=2){ Log::global_log->error_always_output() << "The domain is far to small!"; - Simulation::exit(1); + mardyn_exit(1); } int startIndex = 1; @@ -1816,7 +1817,7 @@ bool KDDecomposition::calculateHeteroSubdivision(KDNode* node, KDNode*& optimalN if ( (unsigned int) (optimalNode->_child1->_numProcs + optimalNode->_child2->_numProcs) > (optimalNode->_child1->getNumMaxProcs() + optimalNode->_child2->getNumMaxProcs())) { Log::global_log->error() << "Domain is not resolvable at all!" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } while ( (! optimalNode->_child1->isResolvable()) && optimalNode->_child2->isResolvable()) { @@ -1844,7 +1845,7 @@ bool KDDecomposition::calculateHeteroSubdivision(KDNode* node, KDNode*& optimalN (optimalNode->_child2->_numProcs <= 0 || optimalNode->_child2->_numProcs >= node->_numProcs) ){ //continue; Log::global_log->error_always_output() << "ERROR in calculateHeteroSubdivision(), part of the domain was not assigned to a proc" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } mardyn_assert( optimalNode->_child1->isResolvable() && optimalNode->_child2->isResolvable() ); diff --git a/src/parallel/LoadCalc.cpp b/src/parallel/LoadCalc.cpp index 435860cb8c..abe0c2dc33 100644 --- a/src/parallel/LoadCalc.cpp +++ b/src/parallel/LoadCalc.cpp @@ -8,6 +8,8 @@ #include #endif +#include "Simulation.h" +#include "utils/mardyn_assert.h" #include "utils/nnls.h" #include "LoadCalc.h" #include "DomainDecompBase.h" @@ -44,7 +46,7 @@ std::vector TunerLoad::readVec(std::istream& in, int& count1, int& count Log::global_log->error_always_output() << "This means the files is corrupted. Please remove it (or disallow the tuner to read from inputfiles) before restarting!" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } } } @@ -146,7 +148,7 @@ TunerLoad TunerLoad::read(std::istream& stream) { if (inStr != "Vectorization Tuner File") { Log::global_log->error() << "The tunerfile is corrupted! Missing header \"Vectorization Tuner File\""; Log::global_log->error() << "Please remove it or fix it before restarting!"; - Simulation::exit(1); + mardyn_exit(1); } int count1; @@ -156,7 +158,7 @@ TunerLoad TunerLoad::read(std::istream& stream) { if (inStr != "own") { Log::global_log->error() << "The tunerfile is corrupted! Missing Section \"own\""; Log::global_log->error() << "Please remove it or fix it before restarting!"; - Simulation::exit(1); + mardyn_exit(1); } auto ownTime = readVec(stream, count1, count2); std::getline(stream, inStr); @@ -164,7 +166,7 @@ TunerLoad TunerLoad::read(std::istream& stream) { if (inStr != "face") { Log::global_log->error() << "The tunerfile is corrupted! Missing Section \"face\""; Log::global_log->error() << "Please remove it or fix it before restarting!"; - Simulation::exit(1); + mardyn_exit(1); } auto faceTime = readVec(stream, count1, count2); std::getline(stream, inStr); @@ -172,7 +174,7 @@ TunerLoad TunerLoad::read(std::istream& stream) { if (inStr != "edge") { Log::global_log->error() << "The tunerfile is corrupted! Missing Section \"edge\""; Log::global_log->error() << "Please remove it or fix it before restarting!"; - Simulation::exit(1); + mardyn_exit(1); } auto edgeTime = readVec(stream, count1, count2); std::getline(stream, inStr); @@ -180,7 +182,7 @@ TunerLoad TunerLoad::read(std::istream& stream) { if (inStr != "corner") { Log::global_log->error() << "The tunerfile is corrupted! Missing Section \"corner\""; Log::global_log->error() << "Please remove it or fix it before restarting!"; - Simulation::exit(1); + mardyn_exit(1); } auto cornerTime = readVec(stream, count1, count2); return TunerLoad { count1, count2, std::move(ownTime), std::move(faceTime), std::move(edgeTime), std::move( diff --git a/src/parallel/LoadCalc.h b/src/parallel/LoadCalc.h index 61a696df2f..bdb1335abe 100644 --- a/src/parallel/LoadCalc.h +++ b/src/parallel/LoadCalc.h @@ -18,8 +18,6 @@ class DomainDecompBase; -#include "Simulation.h" - class LoadCalc { public: diff --git a/src/parallel/NeighbourCommunicationScheme.cpp b/src/parallel/NeighbourCommunicationScheme.cpp index 750d24e427..7eaa8e94ea 100644 --- a/src/parallel/NeighbourCommunicationScheme.cpp +++ b/src/parallel/NeighbourCommunicationScheme.cpp @@ -11,9 +11,10 @@ class IndirectNeighbourCommunicationScheme; #include #include "NeighbourCommunicationScheme.h" #include "Domain.h" +#include "Simulation.h" #include "DomainDecompMPIBase.h" #include "NeighborAcquirer.h" -#include "Simulation.h" +#include "utils/mardyn_assert.h" #include "ZonalMethods/ZonalMethod.h" #include "molecules/Molecule.h" #include "particleContainer/ParticleContainer.h" @@ -265,7 +266,7 @@ void DirectNeighbourCommunicationScheme::initExchangeMoleculesMPI(ParticleContai neighbour.print(ss); Log::global_log->error_always_output() << ss.str() << std::endl; } - Simulation::exit(544); + mardyn_exit(544); } } @@ -395,7 +396,7 @@ void DirectNeighbourCommunicationScheme::finalizeExchangeMoleculesMPI(ParticleCo }); } - Simulation::exit(457); + mardyn_exit(457); } } // while not allDone @@ -424,7 +425,7 @@ void NeighbourCommunicationScheme::selectNeighbours(MessageType msgType, bool im Log::global_log->error() << "WRONG type in selectNeighbours - this should not be used for push-pull-partners " "selectNeighbours method" << std::endl; - Simulation::exit(1); + mardyn_exit(1); break; } } @@ -593,7 +594,7 @@ void IndirectNeighbourCommunicationScheme::finalizeExchangeMoleculesMPI1D(Partic for (int i = 0; i < numNeighbours; ++i) { (*_neighbours)[d][i].deadlockDiagnosticSendRecv(); } - Simulation::exit(457); + mardyn_exit(457); } } // while not allDone diff --git a/src/parallel/NonBlockingMPIHandlerBase.cpp b/src/parallel/NonBlockingMPIHandlerBase.cpp index 2e590c90ee..d7aa905839 100644 --- a/src/parallel/NonBlockingMPIHandlerBase.cpp +++ b/src/parallel/NonBlockingMPIHandlerBase.cpp @@ -7,6 +7,7 @@ #include "NonBlockingMPIHandlerBase.h" #include "Domain.h" +#include "Simulation.h" #include "parallel/DomainDecompMPIBase.h" #include "particleContainer/ParticleContainer.h" #include "particleContainer/adapter/CellProcessor.h" diff --git a/src/parallel/ParticleDataRMM.cpp b/src/parallel/ParticleDataRMM.cpp index 70e228ecac..9ab4094e93 100644 --- a/src/parallel/ParticleDataRMM.cpp +++ b/src/parallel/ParticleDataRMM.cpp @@ -5,6 +5,7 @@ #include "ensemble/EnsembleBase.h" #include "molecules/Molecule.h" +#include "utils/mardyn_assert.h" #include "Simulation.h" #include "utils/Logger.h" @@ -29,7 +30,7 @@ void ParticleDataRMM::getMPIType(MPI_Datatype &sendPartType) { types[1] = MPI_FLOAT; } else { Log::global_log->error() << "invalid size of vcp_real_calc"; - Simulation::exit(4852); + mardyn_exit(4852); } //if the following statement is not true, then the 6 double values do not follow one after the other. diff --git a/src/parallel/ParticleForceData.cpp b/src/parallel/ParticleForceData.cpp index 7d51034194..8c6c6087fe 100644 --- a/src/parallel/ParticleForceData.cpp +++ b/src/parallel/ParticleForceData.cpp @@ -3,7 +3,7 @@ #include #include "molecules/Molecule.h" -#include "Simulation.h" +#include "utils/mardyn_assert.h" #include "utils/Logger.h" diff --git a/src/parallel/ResilienceComm.cpp b/src/parallel/ResilienceComm.cpp index 60ab271aba..49990daea3 100644 --- a/src/parallel/ResilienceComm.cpp +++ b/src/parallel/ResilienceComm.cpp @@ -11,7 +11,9 @@ #include /* UINT64_MAX */ #include + #include "utils/Logger.h" +#include "utils/mardyn_assert.h" //pretty much default ResilienceComm::ResilienceComm(int numProcs, int rank) diff --git a/src/parallel/ResilienceComm.h b/src/parallel/ResilienceComm.h index e7976e07da..0fe70d32de 100644 --- a/src/parallel/ResilienceComm.h +++ b/src/parallel/ResilienceComm.h @@ -8,7 +8,6 @@ #define SRC_PARALLEL_RESILIENCECOMM_H_ #ifdef ENABLE_MPI -#include "utils/mardyn_assert.h" #include #include diff --git a/src/parallel/StaticIrregDomainDecomposition.cpp b/src/parallel/StaticIrregDomainDecomposition.cpp index e7b674ee7a..16e0ac5901 100644 --- a/src/parallel/StaticIrregDomainDecomposition.cpp +++ b/src/parallel/StaticIrregDomainDecomposition.cpp @@ -74,7 +74,7 @@ void StaticIrregDomainDecomposition::readXML(XMLfileUnits &xmlconfig) { << " axis have a non-natural number! Only integer weights > " "0 allowed, please check XML file!" << std::endl; - Simulation::exit(5003); + mardyn_exit(5003); } _subdomainWeights[i].push_back(temp); if (ss.peek() == ',' || ss.peek() == ' ') // skip commas and spaces diff --git a/src/parallel/ZonalMethods/Midpoint.h b/src/parallel/ZonalMethods/Midpoint.h index 50785840e5..137573b488 100644 --- a/src/parallel/ZonalMethods/Midpoint.h +++ b/src/parallel/ZonalMethods/Midpoint.h @@ -7,7 +7,6 @@ #pragma once -#include "Simulation.h" #include "ZonalMethod.h" /** diff --git a/src/parallel/ZonalMethods/ZonalMethod.cpp b/src/parallel/ZonalMethods/ZonalMethod.cpp index 978ea3cef9..b383ad2021 100644 --- a/src/parallel/ZonalMethods/ZonalMethod.cpp +++ b/src/parallel/ZonalMethods/ZonalMethod.cpp @@ -6,7 +6,8 @@ */ #include "ZonalMethod.h" -#include "Simulation.h" + +#include ZonalMethod::ZonalMethod() = default; diff --git a/src/particleContainer/AutoPasContainer.cpp b/src/particleContainer/AutoPasContainer.cpp index 014c5faf9d..6bddb1e86f 100644 --- a/src/particleContainer/AutoPasContainer.cpp +++ b/src/particleContainer/AutoPasContainer.cpp @@ -8,7 +8,7 @@ #include #include #include "Domain.h" -#include "Simulation.h" +#include "utils/mardyn_assert.h" #include "autopas/utils/StringUtils.h" #include "autopas/utils/logging/Logger.h" #include "parallel/DomainDecompBase.h" @@ -186,7 +186,7 @@ auto parseAutoPasOption(XMLfileUnits &xmlconfig, const std::string &xmlString, Log::global_log->error() << e.what() << std::endl; Log::global_log->error() << "Possible options: " << autopas::utils::ArrayUtils::to_string(OptionType::getAllOptions()) << std::endl; - Simulation::exit(4432); + mardyn_exit(4432); // dummy return return decltype(OptionType::template parseOptions(""))(); } @@ -398,7 +398,7 @@ void AutoPasContainer::update() { "Remaining invalid particles:\n" << autopas::utils::ArrayUtils::to_string(_invalidParticles, "\n", {"", ""}) << std::endl; - Simulation::exit(434); + mardyn_exit(434); } _invalidParticles = _autopasContainer.updateContainer(); diff --git a/src/particleContainer/FullParticleCell.cpp b/src/particleContainer/FullParticleCell.cpp index 4a9f37c1de..0295bd0210 100644 --- a/src/particleContainer/FullParticleCell.cpp +++ b/src/particleContainer/FullParticleCell.cpp @@ -9,9 +9,8 @@ #include "particleContainer/FullParticleCell.h" #include "molecules/Molecule.h" #include "utils/UnorderedVector.h" -#include "Simulation.h" - #include "utils/mardyn_assert.h" + #include diff --git a/src/particleContainer/LinkedCellTraversals/C08CellPairTraversal.h b/src/particleContainer/LinkedCellTraversals/C08CellPairTraversal.h index b14cc74f54..0ef15dc14d 100644 --- a/src/particleContainer/LinkedCellTraversals/C08CellPairTraversal.h +++ b/src/particleContainer/LinkedCellTraversals/C08CellPairTraversal.h @@ -79,7 +79,7 @@ void C08CellPairTraversal::traverseCellPairsOuter( CellProcessor& cellProcessor) { if(eighthShell){ Log::global_log->error() << "eightshell + overlapping not yet supported." << std::endl; - Simulation::exit(-2); + mardyn_exit(-2); } using std::array; diff --git a/src/particleContainer/LinkedCellTraversals/NeutralTerritoryTraversal.h b/src/particleContainer/LinkedCellTraversals/NeutralTerritoryTraversal.h index 6ea14ff247..f4428e7c52 100644 --- a/src/particleContainer/LinkedCellTraversals/NeutralTerritoryTraversal.h +++ b/src/particleContainer/LinkedCellTraversals/NeutralTerritoryTraversal.h @@ -125,14 +125,14 @@ void NeutralTerritoryTraversal::traverseCellPairs(CellProcessor& c template void NeutralTerritoryTraversal::traverseCellPairsOuter(CellProcessor& cellProcessor) { Log::global_log->error() << "NT: overlapping Comm not implemented." << std::endl; - Simulation::exit(46); + mardyn_exit(46); } template void NeutralTerritoryTraversal::traverseCellPairsInner(CellProcessor& cellProcessor, unsigned stage, unsigned stageCount) { Log::global_log->error() << "NT: overlapping Comm not implemented." << std::endl; - Simulation::exit(47); + mardyn_exit(47); } template diff --git a/src/particleContainer/LinkedCellTraversals/OriginalCellPairTraversal.h b/src/particleContainer/LinkedCellTraversals/OriginalCellPairTraversal.h index 3fa7498af6..c54e9045fc 100644 --- a/src/particleContainer/LinkedCellTraversals/OriginalCellPairTraversal.h +++ b/src/particleContainer/LinkedCellTraversals/OriginalCellPairTraversal.h @@ -75,7 +75,7 @@ void OriginalCellPairTraversal::rebuild(std::vector } } else { Log::global_log->error() << "OriginalCellPairTraversalDat::rebuild was called with incompatible Traversal data!" << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } } diff --git a/src/particleContainer/LinkedCellTraversals/QuickschedTraversal.h b/src/particleContainer/LinkedCellTraversals/QuickschedTraversal.h index 829ba57ecf..0298d0142b 100644 --- a/src/particleContainer/LinkedCellTraversals/QuickschedTraversal.h +++ b/src/particleContainer/LinkedCellTraversals/QuickschedTraversal.h @@ -10,7 +10,7 @@ #include "C08BasedTraversals.h" #include "utils/Logger.h" -#include "Simulation.h" +#include "utils/mardyn_assert.h" #include "particleContainer/LinkedCells.h" #ifdef QUICKSCHED @@ -111,7 +111,7 @@ void QuickschedTraversal::init() { Log::global_log->error() << "Blocksize is bigger than number of cells in dimension " << (char) ('x' + i) << ". (" << _taskBlocksize[i] << " > " << this->_dims[i] << ")" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } } diff --git a/src/particleContainer/LinkedCells.cpp b/src/particleContainer/LinkedCells.cpp index 82e8ce1f7a..d214872be7 100644 --- a/src/particleContainer/LinkedCells.cpp +++ b/src/particleContainer/LinkedCells.cpp @@ -95,7 +95,7 @@ LinkedCells::LinkedCells(double bBoxMin[3], double bBoxMax[3], Log::global_log->error_always_output() << "_boxWidthInNumCells: " << _boxWidthInNumCells[0] << " / " << _boxWidthInNumCells[1] << " / " << _boxWidthInNumCells[2] << std::endl; - Simulation::exit(5); + mardyn_exit(5); } initializeCells(); @@ -156,7 +156,7 @@ bool LinkedCells::rebuild(double bBoxMin[3], double bBoxMax[3]) { // in each dimension at least one layer of (inner+boundary) cells necessary if (_cellsPerDimension[dim] == 2 * _haloWidthInNumCells[dim]) { Log::global_log->error_always_output() << "LinkedCells::rebuild: region too small" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } numberOfCells *= _cellsPerDimension[dim]; @@ -233,7 +233,7 @@ void LinkedCells::check_molecules_in_box() { << ") x [" << _haloBoundingBoxMin[1] << ", " << _haloBoundingBoxMax[1] << ") x [" << _haloBoundingBoxMin[2] << ", " << _haloBoundingBoxMax[2] << ")" << std::endl; Log::global_log->error() << "Particles will be lost. Aborting simulation." << std::endl; - Simulation::exit(311); + mardyn_exit(311); } } @@ -293,7 +293,7 @@ void LinkedCells::update() { if (numBadMolecules > 0) { Log::global_log->error() << "Found " << numBadMolecules << " outside of their correct cells. Aborting." << std::endl; - Simulation::exit(311); + mardyn_exit(311); } #endif } @@ -543,7 +543,7 @@ void LinkedCells::addParticles(std::vector& particles, bool checkWheth void LinkedCells::traverseNonInnermostCells(CellProcessor& cellProcessor) { if (not _cellsValid) { Log::global_log->error() << "Cell structure in LinkedCells (traverseNonInnermostCells) invalid, call update first" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } _traversalTuner->traverseCellPairsOuter(cellProcessor); @@ -552,7 +552,7 @@ void LinkedCells::traverseNonInnermostCells(CellProcessor& cellProcessor) { void LinkedCells::traversePartialInnermostCells(CellProcessor& cellProcessor, unsigned int stage, int stageCount) { if (not _cellsValid) { Log::global_log->error() << "Cell structure in LinkedCells (traversePartialInnermostCells) invalid, call update first" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } _traversalTuner->traverseCellPairsInner(cellProcessor, stage, stageCount); @@ -563,7 +563,7 @@ void LinkedCells::traverseCells(CellProcessor& cellProcessor) { Log::global_log->error() << "Cell structure in LinkedCells (traversePairs) invalid, call update first" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } cellProcessor.initTraversal(); @@ -612,7 +612,7 @@ void LinkedCells::deleteOuterParticles() { Log::global_log->error() << "Cell structure in LinkedCells (deleteOuterParticles) invalid, call update first" << std::endl; - Simulation::exit(1); + mardyn_exit(1); }*/ const size_t numHaloCells = _haloCellIndices.size(); @@ -837,7 +837,7 @@ unsigned long int LinkedCells::getCellIndexOfMolecule(Molecule* molecule) const Log::global_log->error() << "Molecule:\n" << *molecule << std::endl; Log::global_log->error() << "_haloBoundingBoxMin = (" << _haloBoundingBoxMin[0] << ", " << _haloBoundingBoxMin[1] << ", " << _haloBoundingBoxMin[2] << ")" << std::endl; Log::global_log->error() << "_haloBoundingBoxMax = (" << _haloBoundingBoxMax[0] << ", " << _haloBoundingBoxMax[1] << ", " << _haloBoundingBoxMax[2] << ")" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } #endif //this version is sensitive to roundoffs, if we have molecules (initialized) precisely at position 0.0: @@ -886,7 +886,7 @@ unsigned long int LinkedCells::getCellIndexOfPoint(const double point[3]) const Log::global_log->error() << "Point p = (" << localPoint[0] << ", " << localPoint[1] << ", " << localPoint[2] << ")" << std::endl; Log::global_log->error() << "_haloBoundingBoxMin = (" << _haloBoundingBoxMin[0] << ", " << _haloBoundingBoxMin[1] << ", " << _haloBoundingBoxMin[2] << ")" << std::endl; Log::global_log->error() << "_haloBoundingBoxMax = (" << _haloBoundingBoxMax[0] << ", " << _haloBoundingBoxMax[1] << ", " << _haloBoundingBoxMax[2] << ")" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } #endif @@ -1009,7 +1009,7 @@ void LinkedCells::deleteMolecule(ParticleIterator &moleculeIter, const bool& reb Log::global_log->error_always_output() << "coordinates for atom deletion lie outside bounding box." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } _cells[cellid].buildSoACaches(); } diff --git a/src/particleContainer/TraversalTuner.h b/src/particleContainer/TraversalTuner.h index 71a34fa1b5..b4f0f27a65 100644 --- a/src/particleContainer/TraversalTuner.h +++ b/src/particleContainer/TraversalTuner.h @@ -155,7 +155,7 @@ void TraversalTuner::findOptimalTraversal() { Log::global_log->info() << "Using QuickschedTraversal." << std::endl; #ifndef QUICKSCHED Log::global_log->error() << "MarDyn was compiled without Quicksched Support. Aborting!" << std::endl; - Simulation::exit(1); + mardyn_exit(1); #endif } else if (dynamic_cast *>(_optimalTraversal)) Log::global_log->info() << "Using SlicedCellPairTraversal." << std::endl; @@ -165,7 +165,7 @@ void TraversalTuner::findOptimalTraversal() { if (_cellsInCutoff > _optimalTraversal->maxCellsInCutoff()) { Log::global_log->error() << "Traversal supports up to " << _optimalTraversal->maxCellsInCutoff() << " cells in cutoff, but value is chosen as " << _cellsInCutoff << std::endl; - Simulation::exit(45); + mardyn_exit(45); } } @@ -245,7 +245,7 @@ void TraversalTuner::readXML(XMLfileUnits &xmlconfig) { << " direction is <2 and thereby invalid! (" << quiData->taskBlockSize[j] << ")" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } } break; @@ -307,7 +307,7 @@ void TraversalTuner::rebuild(std::vector &cells, con } break; default: Log::global_log->error() << "Unknown traversal data found in TraversalTuner._traversals!" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } } traversalPointerReference->rebuild(cells, dims, cellLength, cutoff, traversalData); diff --git a/src/particleContainer/adapter/ParticlePairs2PotForceAdapter.h b/src/particleContainer/adapter/ParticlePairs2PotForceAdapter.h index 108cf7f79c..df57c1bf6d 100644 --- a/src/particleContainer/adapter/ParticlePairs2PotForceAdapter.h +++ b/src/particleContainer/adapter/ParticlePairs2PotForceAdapter.h @@ -175,7 +175,7 @@ class ParticlePairs2PotForceAdapter : public ParticlePairsHandler { FluidPot(molecule1, molecule2, params, distanceVector, dummy1, dummy2, dummy3, calculateLJ); return dummy1 / 6.0 + dummy2 + dummy3; default: - Simulation::exit(666); + mardyn_exit(666); } return 0.0; } diff --git a/src/particleContainer/adapter/tests/RealAccumVecTest.cpp b/src/particleContainer/adapter/tests/RealAccumVecTest.cpp index 79830ed2e0..4f17fccadd 100644 --- a/src/particleContainer/adapter/tests/RealAccumVecTest.cpp +++ b/src/particleContainer/adapter/tests/RealAccumVecTest.cpp @@ -10,7 +10,6 @@ #include "particleContainer/adapter/vectorization/SIMD_DEFINITIONS.h" #include "particleContainer/adapter/vectorization/MaskVec.h" #include "utils/AlignedArray.h" -#include "utils/mardyn_assert.h" TEST_SUITE_REGISTRATION(RealAccumVecTest); diff --git a/src/particleContainer/adapter/tests/RealCalcVecTest.cpp b/src/particleContainer/adapter/tests/RealCalcVecTest.cpp index 2ae860210d..0efb2dbb82 100644 --- a/src/particleContainer/adapter/tests/RealCalcVecTest.cpp +++ b/src/particleContainer/adapter/tests/RealCalcVecTest.cpp @@ -6,7 +6,6 @@ #include "RealCalcVecTest.h" #include "particleContainer/adapter/vectorization/SIMD_DEFINITIONS.h" #include "utils/AlignedArray.h" -#include "utils/mardyn_assert.h" #if VCP_VEC_TYPE == VCP_VEC_AVX2 or \ VCP_VEC_TYPE == VCP_VEC_KNL or \ diff --git a/src/particleContainer/adapter/vectorization/RealVec.h b/src/particleContainer/adapter/vectorization/RealVec.h index 0472f7859f..3f38f395ac 100644 --- a/src/particleContainer/adapter/vectorization/RealVec.h +++ b/src/particleContainer/adapter/vectorization/RealVec.h @@ -10,7 +10,7 @@ #include "SIMD_TYPES.h" #include "MaskVec.h" -#include "utils/mardyn_assert.h" + #include #include diff --git a/src/particleContainer/adapter/vectorization/RealVecDouble.h b/src/particleContainer/adapter/vectorization/RealVecDouble.h index cbcff1f08f..60727e5923 100644 --- a/src/particleContainer/adapter/vectorization/RealVecDouble.h +++ b/src/particleContainer/adapter/vectorization/RealVecDouble.h @@ -10,6 +10,8 @@ #include "RealVec.h" +#include "utils/mardyn_assert.h" + // keep this file and RealVecFloat as close as possible, so that they can be examined via diff! namespace vcp { diff --git a/src/particleContainer/adapter/vectorization/RealVecFloat.h b/src/particleContainer/adapter/vectorization/RealVecFloat.h index dab9f2ee16..5c88a89d3e 100644 --- a/src/particleContainer/adapter/vectorization/RealVecFloat.h +++ b/src/particleContainer/adapter/vectorization/RealVecFloat.h @@ -10,6 +10,8 @@ #include "RealVec.h" +#include "utils/mardyn_assert.h" + // keep this file and RealVecDouble as close as possible, so that they can be examined via diff! namespace vcp { diff --git a/src/particleContainer/tests/ParticleContainerFactory.cpp b/src/particleContainer/tests/ParticleContainerFactory.cpp index 68fe537a99..1e6ebe2ec5 100644 --- a/src/particleContainer/tests/ParticleContainerFactory.cpp +++ b/src/particleContainer/tests/ParticleContainerFactory.cpp @@ -14,6 +14,7 @@ #include "parallel/DomainDecomposition.h" #endif #include "Domain.h" +#include "Simulation.h" #include "io/ASCIIReader.h" #include "utils/Logger.h" diff --git a/src/plugins/COMaligner.cpp b/src/plugins/COMaligner.cpp index f72ca4c378..48f784c59e 100755 --- a/src/plugins/COMaligner.cpp +++ b/src/plugins/COMaligner.cpp @@ -31,7 +31,7 @@ void COMaligner::readXML(XMLfileUnits& xmlconfig){ Log::global_log -> error() << "[COMaligner] HALTING SIMULATION" << std::endl; _enabled = false; // HALT SIM - Simulation::exit(1); + mardyn_exit(1); return; } diff --git a/src/plugins/DirectedPM.cpp b/src/plugins/DirectedPM.cpp index 3af8f591aa..0c37d09842 100644 --- a/src/plugins/DirectedPM.cpp +++ b/src/plugins/DirectedPM.cpp @@ -112,7 +112,7 @@ void DirectedPM::beforeForces(ParticleContainer* particleContainer, DomainDecomp Log::global_log->error() << "Coordinates off center (" << xc << " / " << yc << " / " << zc << ").\n"; Log::global_log->error() << "unID = " << unID << "\n"; - Simulation::exit(707); + mardyn_exit(707); } // ADD VELOCITCY AND VIRIAL TO RESPECTIVE BIN _localnumberOfParticles[unID] += 1.; diff --git a/src/plugins/Dropaccelerator.cpp b/src/plugins/Dropaccelerator.cpp index 2362bca8cb..e0d5d7e4ef 100644 --- a/src/plugins/Dropaccelerator.cpp +++ b/src/plugins/Dropaccelerator.cpp @@ -7,6 +7,9 @@ #include "Dropaccelerator.h" +#include "Simulation.h" +#include "utils/mardyn_assert.h" + #ifdef ENABLE_MPI #include "mpi.h" #endif @@ -32,7 +35,7 @@ void Dropaccelerator::readXML(XMLfileUnits& xmlconfig) { Log::global_log->error() << "[Dropaccelerator] HALTING SIMULATION" << std::endl; _enabled = false; // HALT SIM - Simulation::exit(1); + mardyn_exit(1); return; } diff --git a/src/plugins/Dropaligner.cpp b/src/plugins/Dropaligner.cpp index 04f89d6a63..085add8594 100644 --- a/src/plugins/Dropaligner.cpp +++ b/src/plugins/Dropaligner.cpp @@ -27,7 +27,7 @@ void Dropaligner::readXML(XMLfileUnits& xmlconfig) { Log::global_log->error() << "[Dropaligner] HALTING SIMULATION" << std::endl; _enabled = false; // HALT SIM - Simulation::exit(1); + mardyn_exit(1); return; } diff --git a/src/plugins/ExamplePlugin.cpp b/src/plugins/ExamplePlugin.cpp index 8e65194345..fb12252922 100644 --- a/src/plugins/ExamplePlugin.cpp +++ b/src/plugins/ExamplePlugin.cpp @@ -6,7 +6,7 @@ */ #include "ExamplePlugin.h" -#include "Simulation.h" +#include "utils/mardyn_assert.h" #include "utils/xmlfileUnits.h" #include "utils/Logger.h" @@ -58,7 +58,7 @@ void ExamplePlugin::readXML(XMLfileUnits& xmlconfig) { Log::global_log->error() << "Valid options are: all, beforeEventNewTimestep, beforeForces, afterForces, endStep, init, finish." << std::endl; - Simulation::exit(11); + mardyn_exit(11); } } diff --git a/src/plugins/FixRegion.cpp b/src/plugins/FixRegion.cpp index aa3ca9dbb2..1d11c42c70 100644 --- a/src/plugins/FixRegion.cpp +++ b/src/plugins/FixRegion.cpp @@ -32,7 +32,7 @@ void FixRegion::init(ParticleContainer* particleContainer, DomainDecompBase* dom Log::global_log->error() << "[FixRegion] INVALID INPUT!!! DISABLED!" << std::endl; Log::global_log->error() << "[FixRegion] HALTING SIMULATION" << std::endl; // HALT SIM - Simulation::exit(1); + mardyn_exit(1); return; } diff --git a/src/plugins/MaxCheck.cpp b/src/plugins/MaxCheck.cpp index ca1b6a1360..f61deed1a8 100644 --- a/src/plugins/MaxCheck.cpp +++ b/src/plugins/MaxCheck.cpp @@ -6,11 +6,15 @@ */ #include "MaxCheck.h" + #include "particleContainer/ParticleContainer.h" #include "Domain.h" +#include "Simulation.h" #include "parallel/DomainDecompBase.h" #include "molecules/Molecule.h" #include "utils/Logger.h" +#include "utils/mardyn_assert.h" + #include @@ -72,7 +76,7 @@ void MaxCheck::readXML(XMLfileUnits& xmlconfig) { Log::global_log->info() << "[MaxCheck] Number of component targets: " << numTargets << std::endl; if (numTargets < 1) { Log::global_log->warning() << "[MaxCheck] No target parameters specified. Program exit ..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } std::string oldpath = xmlconfig.getcurrentnodepath(); XMLfile::Query::const_iterator nodeIter; diff --git a/src/plugins/Mirror.cpp b/src/plugins/Mirror.cpp index 631c7f61a7..f13855e1c7 100644 --- a/src/plugins/Mirror.cpp +++ b/src/plugins/Mirror.cpp @@ -1,9 +1,12 @@ #include "Mirror.h" #include "particleContainer/ParticleContainer.h" #include "Domain.h" +#include "Simulation.h" #include "parallel/DomainDecompBase.h" #include "molecules/Molecule.h" #include "utils/Logger.h" +#include "utils/mardyn_assert.h" + #include "plugins/NEMD/DistControl.h" #include @@ -83,7 +86,7 @@ void Mirror::readXML(XMLfileUnits& xmlconfig) subject->registerObserver(this); else { Log::global_log->error() << "[Mirror] Initialization of plugin DistControl is needed before! Program exit..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } } Log::global_log->info() << "[Mirror] Enabled at position: y = " << _position.coord << std::endl; @@ -122,14 +125,14 @@ void Mirror::readXML(XMLfileUnits& xmlconfig) if(MT_ZERO_GRADIENT == _type) { Log::global_log->error() << "[Mirror] Method 3 (MT_ZERO_GRADIENT) is deprecated. Use 5 (MT_MELAND_2004) instead. Program exit ..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } /** normal distributions */ if(MT_NORMDISTR_MB == _type) { Log::global_log->error() << "[Mirror] Method 4 (MT_NORMDISTR_MB) is deprecated. Use 5 (MT_MELAND_2004) instead. Program exit ..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } /** Meland2004 */ @@ -140,7 +143,7 @@ void Mirror::readXML(XMLfileUnits& xmlconfig) if(!xmlconfig.getNodeValue("meland/velo_target", _melandParams.velo_target)) { Log::global_log->error() << "[Mirror] Meland: Parameters for method 5 (MT_MELAND_2004) provided in config-file *.xml corrupted/incomplete. Program exit ..." << std::endl; - Simulation::exit(-2004); + mardyn_exit(-2004); } else { Log::global_log->info() << "[Mirror] Meland: target velocity = " << _melandParams.velo_target << std::endl; @@ -166,12 +169,12 @@ void Mirror::readXML(XMLfileUnits& xmlconfig) if (not bRet) { Log::global_log->error() << "[Mirror] Ramping: Parameters for method 5 (MT_RAMPING) provided in config-file *.xml corrupted/incomplete. Program exit ..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } else { if(_rampingParams.startStep > _rampingParams.stopStep) { Log::global_log->error() << "[Mirror] Ramping: Start > Stop. Program exit ..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } else { Log::global_log->info() << "[Mirror] Ramping from " << _rampingParams.startStep << " to " << _rampingParams.stopStep << std::endl; @@ -183,7 +186,7 @@ void Mirror::readXML(XMLfileUnits& xmlconfig) break; default: Log::global_log->error() << "[Mirror] Ramping: No proper treatment was set. Use 0 (Deletion) or 1 (Transmission). Program exit ..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } Log::global_log->info() << "[Mirror] Ramping: Treatment for non-reflected particles: " << _rampingParams.treatment << " ( " << treatmentStr << " ) " << std::endl; } diff --git a/src/plugins/MirrorSystem.cpp b/src/plugins/MirrorSystem.cpp index 60a994b60f..1e0047768d 100644 --- a/src/plugins/MirrorSystem.cpp +++ b/src/plugins/MirrorSystem.cpp @@ -1,6 +1,7 @@ #include "MirrorSystem.h" #include "particleContainer/ParticleContainer.h" #include "Domain.h" +#include "Simulation.h" #include "parallel/DomainDecompBase.h" #include "molecules/Molecule.h" #include "utils/Logger.h" diff --git a/src/plugins/NEMD/DensityControl.cpp b/src/plugins/NEMD/DensityControl.cpp index a5cff5ebd0..0cd8dd582c 100644 --- a/src/plugins/NEMD/DensityControl.cpp +++ b/src/plugins/NEMD/DensityControl.cpp @@ -22,11 +22,13 @@ #include "DensityControl.h" #include "Domain.h" +#include "Simulation.h" #include "molecules/Molecule.h" #include "parallel/DomainDecompBase.h" #include "particleContainer/ParticleContainer.h" #include "utils/CommVar.h" #include "utils/Logger.h" +#include "utils/mardyn_assert.h" DensityControl::DensityControl() = default; DensityControl::~DensityControl() = default; @@ -85,7 +87,7 @@ void DensityControl::readXML(XMLfileUnits& xmlconfig) { Log::global_log->error() << "[DensityControl] Number of component IDs specified in element ..." << " does not match the number of components in the simulation. Programm exit ..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } // targets @@ -110,7 +112,7 @@ void DensityControl::readXML(XMLfileUnits& xmlconfig) { Log::global_log->info() << "[DensityControl] Number of component targets: " << numTargets << std::endl; if (numTargets < 1) { Log::global_log->error() << "[DensityControl] No target parameters specified. Program exit ..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } const std::string oldpath = xmlconfig.getcurrentnodepath(); XMLfile::Query::const_iterator nodeIter; diff --git a/src/plugins/NEMD/DistControl.cpp b/src/plugins/NEMD/DistControl.cpp index 314cb1742a..0dff820093 100644 --- a/src/plugins/NEMD/DistControl.cpp +++ b/src/plugins/NEMD/DistControl.cpp @@ -15,6 +15,7 @@ #include "utils/DynAlloc.h" #include "utils/Math.h" #include "utils/xmlfileUnits.h" +#include "utils/mardyn_assert.h" #include "plugins/Mirror.h" // TODO: Not so nice that DistControl has to know Mirror plugin explicitly #include @@ -79,7 +80,7 @@ void DistControl::readXML(XMLfileUnits& xmlconfig) if( !xmlconfig.getNodeValue("subdivision@type", strSubdivisionType) ) { Log::global_log->error() << "[DistControl] Missing attribute \"subdivision@type\"! Programm exit..." << std::endl; - exit(-1); + mardyn_exit(-1); } if("number" == strSubdivisionType) { @@ -87,7 +88,7 @@ void DistControl::readXML(XMLfileUnits& xmlconfig) if( !xmlconfig.getNodeValue("subdivision/number", nNumSlabs) ) { Log::global_log->error() << "[DistControl] Missing element \"subdivision/number\"! Programm exit..." << std::endl; - exit(-1); + mardyn_exit(-1); } else this->SetSubdivision(nNumSlabs); @@ -98,7 +99,7 @@ void DistControl::readXML(XMLfileUnits& xmlconfig) if( !xmlconfig.getNodeValue("subdivision/width", dSlabWidth) ) { Log::global_log->error() << "[DistControl] Missing element \"subdivision/width\"! Programm exit..." << std::endl; - exit(-1); + mardyn_exit(-1); } else this->SetSubdivision(dSlabWidth); @@ -106,7 +107,7 @@ void DistControl::readXML(XMLfileUnits& xmlconfig) else { Log::global_log->error() << "[DistControl] Wrong attribute \"subdivision@type\". Expected: type=\"number|width\"! Programm exit..." << std::endl; - exit(-1); + mardyn_exit(-1); } // init method @@ -137,7 +138,7 @@ void DistControl::readXML(XMLfileUnits& xmlconfig) else { Log::global_log->error() << "[DistControl] Missing elements \"init/values/left\" or \"init/values/right\" or both! Programm exit..." << std::endl; - exit(-1); + mardyn_exit(-1); } } else if("file" == strInitMethodType) @@ -154,14 +155,14 @@ void DistControl::readXML(XMLfileUnits& xmlconfig) else { Log::global_log->error() << "[DistControl] Missing elements \"init/file\" or \"init/simstep\" or both! Programm exit..." << std::endl; - exit(-1); + mardyn_exit(-1); } } else { Log::global_log->error() << "[DistControl] Wrong attribute \"init@type\", type = " << strInitMethodType << ", " "expected: type=\"startconfig|values|file\"! Programm exit..." << std::endl; - exit(-1); + mardyn_exit(-1); } // update method @@ -189,7 +190,7 @@ void DistControl::readXML(XMLfileUnits& xmlconfig) else { Log::global_log->error() << "[DistControl] Missing elements \"method/componentID\" or \"method/density\" or both! Programm exit..." << std::endl; - exit(-1); + mardyn_exit(-1); } } else if("denderiv" == strUpdateMethodType) @@ -213,14 +214,14 @@ void DistControl::readXML(XMLfileUnits& xmlconfig) else { Log::global_log->error() << "[DistControl] Missing elements \"method/componentID\" or \"method/density\" or both! Programm exit..." << std::endl; - exit(-1); + mardyn_exit(-1); } } else { Log::global_log->error() << "[DistControl] Wrong attribute \"method@type\", type = " << strUpdateMethodType << ", " "expected: type=\"density|denderiv\"! Programm exit..." << std::endl; - exit(-1); + mardyn_exit(-1); } } @@ -266,7 +267,7 @@ void DistControl::PrepareSubdivision() case SDOPT_UNKNOWN: default: Log::global_log->error() << "[DistControl] PrepareSubdivision(): Neither _binParams.width nor _binParams.count was set correctly! Programm exit..." << std::endl; - exit(-1); + mardyn_exit(-1); } _binParams.invWidth = 1. / _binParams.width; @@ -702,7 +703,7 @@ void DistControl::UpdatePositionsInit(ParticleContainer* particleContainer) case DCIM_UNKNOWN: default: Log::global_log->error() << "[DistControl] Wrong Init Method! Programm exit..." << std::endl; - exit(-1); + mardyn_exit(-1); } #ifndef NDEBUG @@ -738,7 +739,7 @@ void DistControl::UpdatePositions(const uint64_t& simstep) case DCUM_UNKNOWN: default: Log::global_log->error() << "[DistControl] UpdatePositions() Corrupted code!!! Programm exit..." << std::endl; - exit(-1); + mardyn_exit(-1); } // update positions diff --git a/src/plugins/NEMD/DriftCtrl.cpp b/src/plugins/NEMD/DriftCtrl.cpp index b37ea8b6a2..75f593894a 100644 --- a/src/plugins/NEMD/DriftCtrl.cpp +++ b/src/plugins/NEMD/DriftCtrl.cpp @@ -1,6 +1,7 @@ #include "DriftCtrl.h" #include "particleContainer/ParticleContainer.h" #include "Domain.h" +#include "Simulation.h" #include "parallel/DomainDecompBase.h" #include "molecules/Molecule.h" #include "utils/Logger.h" diff --git a/src/plugins/NEMD/ExtractPhase.cpp b/src/plugins/NEMD/ExtractPhase.cpp index 84fd60debc..82c5413220 100644 --- a/src/plugins/NEMD/ExtractPhase.cpp +++ b/src/plugins/NEMD/ExtractPhase.cpp @@ -8,6 +8,7 @@ #include "ExtractPhase.h" #include "particleContainer/ParticleContainer.h" #include "Domain.h" +#include "Simulation.h" #include "parallel/DomainDecompBase.h" #include "molecules/Molecule.h" #include "utils/Logger.h" diff --git a/src/plugins/NEMD/MettDeamon.cpp b/src/plugins/NEMD/MettDeamon.cpp index aa1f0123eb..ec9ed8c18d 100644 --- a/src/plugins/NEMD/MettDeamon.cpp +++ b/src/plugins/NEMD/MettDeamon.cpp @@ -7,6 +7,7 @@ #include "MettDeamon.h" #include "Domain.h" +#include "Simulation.h" #include "molecules/Molecule.h" #include "parallel/DomainDecompBase.h" #ifdef ENABLE_MPI @@ -17,6 +18,7 @@ #include "utils/xmlfileUnits.h" #include "utils/Random.h" #include "utils/FileUtils.h" +#include "utils/mardyn_assert.h" #include "io/ReplicaGenerator.h" // class MoleculeDataReader #include @@ -415,7 +417,7 @@ void MettDeamon::readXML(XMLfileUnits& xmlconfig) Log::global_log->info() << "[MettDeamon] Number of fixed molecules components: " << numChanges << std::endl; if(numChanges < 1) { Log::global_log->error() << "[MettDeamon] No component change defined in XML-config file. Program exit ..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } std::string oldpath = xmlconfig.getcurrentnodepath(); XMLfile::Query::const_iterator changeIter; @@ -433,7 +435,7 @@ void MettDeamon::readXML(XMLfileUnits& xmlconfig) } else { Log::global_log->error() << "[MettDeamon] No component changes defined in XML-config file. Program exit ..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } } @@ -1187,7 +1189,7 @@ void MettDeamon::InsertReservoirSlab(ParticleContainer* particleContainer) _feedrate.feed.sum -= _reservoir->getBinWidth(); // reset feed sum if(not _reservoir->nextBin(_nMaxMoleculeID.global) ) { Log::global_log->error() << "[MettDeamon] Failed to activate new bin of particle Reservoir's BinQueue => Program exit." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } Log::global_log->debug() << "[" << nRank << "]: ADDED " << numAdded.local << "/" << numParticlesCurrentSlab.local << " particles (" << numAdded.local/static_cast(numParticlesCurrentSlab.local)*100 << ")%." << std::endl; // calc global values @@ -1207,7 +1209,7 @@ void MettDeamon::initRestart() if(not bRet) { Log::global_log->info() << "[MettDeamon] Failed to activate reservoir bin after restart! Program exit ... " << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } _feedrate.feed.sum = _restartInfo.dYsum; } @@ -1224,7 +1226,7 @@ void MettDeamon::readNormDistr() //check to see that the file was opened correctly: if (!ifs.vxz.is_open() || !ifs.vy.is_open() ) { std::cerr << "[MettDeamon] There was a problem opening the input file!\n"; - Simulation::exit(-1);//exit or do additional error checking + mardyn_exit(-1);//exit or do additional error checking } double dVal = 0.0; @@ -1238,7 +1240,7 @@ void MettDeamon::readNormDistr() else if (MD_RIGHT_TO_LEFT == _nMovingDirection) _norm.vy.push_back( abs(dVal) * (-1.) ); else - Simulation::exit(-1); + mardyn_exit(-1); } // close files ifs.vxz.close(); @@ -1307,7 +1309,7 @@ void Reservoir::readXML(XMLfileUnits& xmlconfig) } else { Log::global_log->error() << "[MettDeamon] Reservoir file type not specified or unknown. Programm exit ..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } // Possibly change component IDs @@ -1317,7 +1319,7 @@ void Reservoir::readXML(XMLfileUnits& xmlconfig) numChanges = query.card(); if(numChanges < 1) { Log::global_log->error() << "[MettDeamon] No component change defined in XML-config file. Program exit ..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } std::string oldpath = xmlconfig.getcurrentnodepath(); XMLfile::Query::const_iterator changeIter; @@ -1346,7 +1348,7 @@ void Reservoir::readParticleData(DomainDecompBase* domainDecomp, ParticleContain break; default: Log::global_log->error() << "[MettDeamon] Unknown (or ambiguous) method to read reservoir for feature MettDeamon. Program exit ..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } // sort particles into bins @@ -1517,7 +1519,7 @@ void Reservoir::readFromFile(DomainDecompBase* domainDecomp, ParticleContainer* ifs.open( _filepath.data.c_str() ); if (!ifs.is_open()) { Log::global_log->error() << "[MettDeamon] Could not open Mettdeamon Reservoirfile " << _filepath.data << std::endl; - Simulation::exit(1); + mardyn_exit(1); } Log::global_log->info() << "[MettDeamon] Reading Mettdeamon Reservoirfile " << _filepath.data << std::endl; @@ -1546,7 +1548,7 @@ void Reservoir::readFromFile(DomainDecompBase* domainDecomp, ParticleContainer* if((token != "NumberOfMolecules") && (token != "N")) { Log::global_log->error() << "[MettDeamon] Expected the token 'NumberOfMolecules (N)' instead of '" << token << "'" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } ifs >> _numMoleculesRead; @@ -1566,7 +1568,7 @@ void Reservoir::readFromFile(DomainDecompBase* domainDecomp, ParticleContainer* else if (ntypestring == "IRV") ntype = IRV; else { Log::global_log->error() << "[MettDeamon] Unknown molecule format '" << ntypestring << "'" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } } else { ifs.seekg(spos); @@ -1616,7 +1618,7 @@ void Reservoir::readFromFile(DomainDecompBase* domainDecomp, ParticleContainer* << componentid << ">" << numcomponents << std::endl; - Simulation::exit(1); + mardyn_exit(1); } // ComponentIDs are used as array IDs, hence need to start at 0. // In the input files they always start with 1 so we need to adapt that all the time. @@ -1645,7 +1647,7 @@ void Reservoir::readFromFileBinaryHeader() if(not inp.changecurrentnode("/mardyn")) { Log::global_log->error() << "[MettDeamon] Could not find root node /mardyn in XML header file or file itself." << std::endl; Log::global_log->fatal() << "[MettDeamon] Not a valid MarDyn XML header file." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } bool bInputOk = true; @@ -1673,7 +1675,7 @@ void Reservoir::readFromFileBinaryHeader() if(not bInputOk) { Log::global_log->error() << "[MettDeamon] Content of file: '" << _filepath.header << "' corrupted! Program exit ..." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } if("ICRVQD" == strMoleculeFormat) @@ -1685,7 +1687,7 @@ void Reservoir::readFromFileBinaryHeader() else { Log::global_log->error() << "[MettDeamon] Not a valid molecule format: " << strMoleculeFormat << ", program exit ..." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } } @@ -1704,7 +1706,7 @@ void Reservoir::readFromFileBinary(DomainDecompBase* domainDecomp, ParticleConta ifs.open(_filepath.data.c_str(), std::ios::binary | std::ios::in); if (!ifs.is_open()) { Log::global_log->error() << "[MettDeamon] Could not open reservoir phaseSpaceFile " << _filepath.data << std::endl; - Simulation::exit(1); + mardyn_exit(1); } Log::global_log->info() << "[MettDeamon] Reading phase space file " << _filepath.data << std::endl; diff --git a/src/plugins/NEMD/MettDeamon.h b/src/plugins/NEMD/MettDeamon.h index 08aaa91496..935438f018 100644 --- a/src/plugins/NEMD/MettDeamon.h +++ b/src/plugins/NEMD/MettDeamon.h @@ -12,6 +12,7 @@ #include "molecules/Molecule.h" #include "Domain.h" #include "utils/CommVar.h" +#include "utils/Random.h" //#include "NEMD/Request.h" #include diff --git a/src/plugins/NEMD/MettDeamonFeedrateDirector.cpp b/src/plugins/NEMD/MettDeamonFeedrateDirector.cpp index 602b4509a1..62a136d275 100644 --- a/src/plugins/NEMD/MettDeamonFeedrateDirector.cpp +++ b/src/plugins/NEMD/MettDeamonFeedrateDirector.cpp @@ -1,10 +1,12 @@ #include "MettDeamonFeedrateDirector.h" #include "particleContainer/ParticleContainer.h" #include "Domain.h" +#include "Simulation.h" #include "parallel/DomainDecompBase.h" #include "molecules/Molecule.h" #include "utils/Logger.h" #include "utils/FileUtils.h" +#include "utils/mardyn_assert.h" #include "plugins/Mirror.h" #include "plugins/NEMD/MettDeamon.h" @@ -133,11 +135,11 @@ void MettDeamonFeedrateDirector::beforeForces( // Check if other plugins were found if(nullptr == mirror) { Log::global_log->error() << "[MettDeamonFeedrateDirector] No Mirror plugin found in plugin list. Program exit ..." << std::endl; - Simulation::exit(-2004); + mardyn_exit(-2004); } if(nullptr == mettDeamon) { Log::global_log->error() << "[MettDeamonFeedrateDirector] No MettDeamon plugin found in plugin list. Program exit ..." << std::endl; - Simulation::exit(-2004); + mardyn_exit(-2004); } // Get number of deleted/reflected particles from Mirror plugin diff --git a/src/plugins/NEMD/PosNegComp.cpp b/src/plugins/NEMD/PosNegComp.cpp index 10ee154c6f..c5adaffc79 100644 --- a/src/plugins/NEMD/PosNegComp.cpp +++ b/src/plugins/NEMD/PosNegComp.cpp @@ -8,6 +8,7 @@ #include "PosNegComp.h" #include "particleContainer/ParticleContainer.h" #include "Domain.h" +#include "Simulation.h" #include "parallel/DomainDecompBase.h" #include "molecules/Molecule.h" #include "utils/Logger.h" diff --git a/src/plugins/NEMD/RegionSampling.cpp b/src/plugins/NEMD/RegionSampling.cpp index 9457ffbd00..26f7c94062 100644 --- a/src/plugins/NEMD/RegionSampling.cpp +++ b/src/plugins/NEMD/RegionSampling.cpp @@ -13,6 +13,7 @@ #include "molecules/Molecule.h" #include "utils/FileUtils.h" #include "utils/xmlfileUnits.h" +#include "utils/mardyn_assert.h" #include "DistControl.h" #include @@ -171,7 +172,7 @@ void SampleRegion::readXML(XMLfileUnits& xmlconfig) else { Log::global_log->error() << "RegionSampling->region["<GetID()<<"]: Initialization of plugin DistControl is needed before! Program exit..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } } @@ -183,7 +184,7 @@ void SampleRegion::readXML(XMLfileUnits& xmlconfig) Log::global_log->info() << "RegionSampling->region["<GetID()-1<<"]: Number of sampling modules: " << numSamplingModules << std::endl; if(numSamplingModules < 1) { Log::global_log->error() << "RegionSampling->region["<GetID()-1<<"]: No sampling module parameters specified. Program exit ..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } XMLfile::Query::const_iterator outputSamplingIter; @@ -219,7 +220,7 @@ void SampleRegion::readXML(XMLfileUnits& xmlconfig) if( !xmlconfig.getNodeValue("subdivision@type", strSubdivisionType) ) { Log::global_log->error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]: Number of velocity discretizations: " << numDiscretizations << std::endl; if(numDiscretizations < 1) { Log::global_log->error() << "RegionSampling->region["<GetID()-1<<"]: No velocity discretizations specified for VDF sampling. Program exit ..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } XMLfile::Query::const_iterator nodeIter; for( nodeIter = query_vd.begin(); nodeIter != query_vd.end(); nodeIter++ ) @@ -306,7 +307,7 @@ void SampleRegion::readXML(XMLfileUnits& xmlconfig) bool bVal = xmlconfig.getNodeValue("@cid", cid); if( (cid > _numComponents) || ((not bVal) && (not _boolSingleComp)) ){ Log::global_log->error() << "RegionSampling->region["<GetID()-1<<"]: VDF velocity discretization corrupted. Program exit ..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } if(_boolSingleComp){ @@ -333,7 +334,7 @@ void SampleRegion::readXML(XMLfileUnits& xmlconfig) if( !xmlconfig.getNodeValue("subdivision@type", strSubdivisionType) ) { Log::global_log->error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]: Found " << numSubdivisions << " 'subdivision' elements, " "expected: 2. Program exit ..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } std::string oldpath = xmlconfig.getcurrentnodepath(); XMLfile::Query::const_iterator outputSubdivisionIter; @@ -473,7 +474,7 @@ void SampleRegion::readXML(XMLfileUnits& xmlconfig) if(not bInputIsValid) { Log::global_log->error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]: Wrong attribute 'sampling@type', expected type='profiles|VDF|fieldYR'! Program exit..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } } // for( outputSamplingIter = query.begin(); outputSamplingIter; outputSamplingIter++ ) } @@ -554,7 +555,7 @@ void SampleRegion::prepareSubdivisionFieldYR() case SDOPT_UNKNOWN: default: Log::global_log->error() << "SampleRegion::PrepareSubdivisionFieldYR(): Unknown subdivision type! Program exit..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } dWidth = (this->GetWidth(0) < this->GetWidth(2) ) ? this->GetWidth(0) : this->GetWidth(2); @@ -573,7 +574,7 @@ void SampleRegion::prepareSubdivisionFieldYR() case SDOPT_UNKNOWN: default: Log::global_log->error() << "SampleRegion::PrepareSubdivisionFieldYR(): Unknown subdivision type! Program exit..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } } @@ -2047,7 +2048,7 @@ void RegionSampling::readXML(XMLfileUnits& xmlconfig) Log::global_log->info() << "RegionSampling: Number of sampling regions: " << numRegions << std::endl; if(numRegions < 1) { Log::global_log->warning() << "RegionSampling: No region parameters specified. Program exit ..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } std::string oldpath = xmlconfig.getcurrentnodepath(); XMLfile::Query::const_iterator outputRegionIter; diff --git a/src/plugins/NEMD/VelocityExchange.cpp b/src/plugins/NEMD/VelocityExchange.cpp index 2926936e9f..75b11ccc1c 100644 --- a/src/plugins/NEMD/VelocityExchange.cpp +++ b/src/plugins/NEMD/VelocityExchange.cpp @@ -7,6 +7,7 @@ #include "particleContainer/ParticleContainer.h" #include "Domain.h" +#include "Simulation.h" #include "parallel/DomainDecompBase.h" #include "molecules/Molecule.h" #include "utils/Logger.h" diff --git a/src/plugins/Permittivity.cpp b/src/plugins/Permittivity.cpp index 3d2098ffc7..be6e1c54f6 100644 --- a/src/plugins/Permittivity.cpp +++ b/src/plugins/Permittivity.cpp @@ -9,6 +9,9 @@ // Important: Always plot the running average data to make sure convergence has been achieved. Permittivity may take a long time to converge, i.e. a few million steps with ~1000 particles. Reducing number of slabs for the thermostat can drastically improve results/convergence! // If a simulation is resumed from a restart file, then the existing running average file is ammended but the computation of the running averages starts anew at the time step of the restart file #include "Permittivity.h" + +#include "Simulation.h" + void Permittivity::readXML(XMLfileUnits& xmlconfig) { Log::global_log->info() << "Calculation of relative permittivity enabled." << std::endl; xmlconfig.getNodeValue("writefrequency", _writeFrequency); diff --git a/src/plugins/PluginFactory.cpp b/src/plugins/PluginFactory.cpp index e7cc5c86b2..0927e4b9da 100644 --- a/src/plugins/PluginFactory.cpp +++ b/src/plugins/PluginFactory.cpp @@ -4,7 +4,7 @@ #include "PluginFactory.h" #include "Domain.h" -#include "Simulation.h" +#include "utils/mardyn_assert.h" #include #include @@ -194,7 +194,7 @@ long PluginFactory::enablePlugins(std::list& _plugins, } else { Log::global_log->error() << "[MMPLD Writer] Unknown sphere representation type: " << sphere_representation << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } } else if (pluginname == "DomainProfiles") { plugin = this->create("DensityProfileWriter"); diff --git a/src/plugins/SpatialProfile.cpp b/src/plugins/SpatialProfile.cpp index 5f4d8a9315..07ca7397fc 100644 --- a/src/plugins/SpatialProfile.cpp +++ b/src/plugins/SpatialProfile.cpp @@ -46,7 +46,7 @@ void SpatialProfile::readXML(XMLfileUnits& xmlconfig) { samplInfo.cylinder = false; } else { Log::global_log->error() << "[SpatialProfile] Invalid mode. cylinder/cartesian" << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } Log::global_log->info() << "[SpatialProfile] Binning units: " << samplInfo.universalProfileUnit[0] << " " @@ -404,7 +404,7 @@ long SpatialProfile::getCylUID(ParticleIterator& thismol) { Log::global_log->error() << "Severe error!! Invalid profile unit (" << R2 << " / " << yc << " / " << phi << ").\n\n"; Log::global_log->error() << "Coordinates off center (" << xc << " / " << yc << " / " << zc << ").\n"; Log::global_log->error() << "unID = " << unID << "\n"; - Simulation::exit(707); + mardyn_exit(707); } return unID; } diff --git a/src/plugins/VectorizationTuner.cpp b/src/plugins/VectorizationTuner.cpp index 5dae120ef0..6174b59301 100644 --- a/src/plugins/VectorizationTuner.cpp +++ b/src/plugins/VectorizationTuner.cpp @@ -12,6 +12,7 @@ #include "ensemble/EnsembleBase.h" #include "molecules/Component.h" #include "Simulation.h" +#include "utils/mardyn_assert.h" #include "particleContainer/ParticleCell.h" #include "particleContainer/adapter/CellDataSoA.h" #include "Domain.h" @@ -34,7 +35,7 @@ void VectorizationTuner::readXML(XMLfileUnits& xmlconfig) { vtWriter.reset(new VTWriter()); } else { Log::global_log->error() << R"(Unknown FlopRateOutputPlugin::mode. Choose "stdout" or "file".)" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } _outputPrefix = "mardyn"; @@ -63,7 +64,7 @@ void VectorizationTuner::readXML(XMLfileUnits& xmlconfig) { Log::global_log->error() << R"(Unknown FlopRateOutputPlugin::moleculecntincreasetype. Choose "linear" or "exponential" or "both".)" << std::endl; - Simulation::exit(798123); + mardyn_exit(798123); } Log::global_log->info() << "Molecule count increase type: " << incTypeStr << std::endl; @@ -282,7 +283,7 @@ void VectorizationTuner::tune(std::vector& componentList, TunerLoad& if(componentList.size() > 2){ Log::global_log->error_always_output() << "The tuner currently supports only two different particle types!" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } int maxMols = particleNums.at(0); diff --git a/src/plugins/WallPotential.cpp b/src/plugins/WallPotential.cpp index a1b426af27..2d9bda387a 100755 --- a/src/plugins/WallPotential.cpp +++ b/src/plugins/WallPotential.cpp @@ -5,6 +5,9 @@ #include "WallPotential.h" +#include "Simulation.h" +#include "utils/mardyn_assert.h" + /** * @brief reads in configuration from config.xml. see class doc for example .xml * @@ -37,7 +40,7 @@ void WallPotential::readXML(XMLfileUnits &xmlconfig) { _potential = LJ9_3; // TODO: is this allowed or should simulation be halted // HALT SIM - //global_simulation -> exit(1); + //mardyn_exit(1); } XMLfile::Query query = xmlconfig.query("component"); @@ -85,7 +88,7 @@ void WallPotential::readXML(XMLfileUnits &xmlconfig) { } else{ Log::global_log -> error() << "[WallPotential] UNKNOWN WALL POTENTIAL! EXITING!" << std::endl; - global_simulation -> exit(11); + mardyn_exit(11); } } diff --git a/src/plugins/profiles/Virial2DProfile.cpp b/src/plugins/profiles/Virial2DProfile.cpp index 695ddf538d..26c858547f 100644 --- a/src/plugins/profiles/Virial2DProfile.cpp +++ b/src/plugins/profiles/Virial2DProfile.cpp @@ -3,10 +3,12 @@ // #include "Virial2DProfile.h" + #include "DensityProfile.h" #include "DOFProfile.h" #include "KineticProfile.h" #include "../FixRegion.h" +#include "Simulation.h" void Virial2DProfile::output(std::string prefix, long unsigned accumulatedDatasets) { diff --git a/src/plugins/profiles/VirialProfile.cpp b/src/plugins/profiles/VirialProfile.cpp index adba3c3506..2ba84596de 100644 --- a/src/plugins/profiles/VirialProfile.cpp +++ b/src/plugins/profiles/VirialProfile.cpp @@ -3,7 +3,9 @@ // #include "VirialProfile.h" + #include "DensityProfile.h" +#include "Simulation.h" void VirialProfile::output(std::string prefix, long unsigned accumulatedDatasets) { diff --git a/src/thermostats/TemperatureControl.cpp b/src/thermostats/TemperatureControl.cpp index ce91a2e65f..d6156f1e17 100644 --- a/src/thermostats/TemperatureControl.cpp +++ b/src/thermostats/TemperatureControl.cpp @@ -7,12 +7,14 @@ #include "thermostats/TemperatureControl.h" #include "Domain.h" +#include "Simulation.h" #include "WrapOpenMP.h" #include "molecules/Molecule.h" #include "parallel/DomainDecompBase.h" #include "particleContainer/ParticleContainer.h" #include "utils/FileUtils.h" #include "utils/xmlfileUnits.h" +#include "utils/mardyn_assert.h" #include #include @@ -166,7 +168,7 @@ void ControlRegionT::readXML(XMLfileUnits& xmlconfig) { _nuDt = _nuAndersen * _timestep; } else { Log::global_log->error() << "[TemperatureControl] REGION: Invalid 'method' param: " << methods << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } Log::global_log->info() << "[TemperatureControl] REGION 'method' param: " << methods << std::endl; } @@ -190,7 +192,7 @@ void ControlRegionT::VelocityScalingInit(XMLfileUnits& xmlconfig, std::string st xmlconfig.getNodeValue("settings/numslabs", _nNumSlabs); if (_nNumSlabs < 1) { Log::global_log->fatal() << "TemperatureControl: need at least one slab! (settings/numslabs)"; - Simulation::exit(932); + mardyn_exit(932); } xmlconfig.getNodeValue("settings/exponent", _dTemperatureExponent); xmlconfig.getNodeValue("settings/directions", strDirections); @@ -416,7 +418,7 @@ void ControlRegionT::ControlTemperature(Molecule* mol) { } } else { Log::global_log->error() << "[TemperatureControl] Invalid localMethod param: " << _localMethod << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } } @@ -504,7 +506,7 @@ void ControlRegionT::registerAsObserver() { else { Log::global_log->error() << "TemperatureControl->region[" << this->GetID() << "]: Initialization of plugin DistControl is needed before! Program exit..." << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } } } diff --git a/src/utils/MPI_Info_object.cpp b/src/utils/MPI_Info_object.cpp index 6adad0e910..5538d510bb 100644 --- a/src/utils/MPI_Info_object.cpp +++ b/src/utils/MPI_Info_object.cpp @@ -1,6 +1,5 @@ #include "utils/MPI_Info_object.h" -#include "Simulation.h" #include "utils/Logger.h" #ifdef ENABLE_MPI diff --git a/src/utils/OptionParser.cpp b/src/utils/OptionParser.cpp index 37ce4edf0d..80e8baa9e2 100644 --- a/src/utils/OptionParser.cpp +++ b/src/utils/OptionParser.cpp @@ -6,7 +6,8 @@ */ #include "OptionParser.h" -#include "Simulation.h" + +#include "utils/mardyn_assert.h" #include #include @@ -344,11 +345,11 @@ void OptionParser::process_opt(const Option& o, const std::string& opt, const st } else if (o.action() == "help") { print_help(); - Simulation::exit(0); + mardyn_exit(0); } else if (o.action() == "version") { print_version(); - Simulation::exit(0); + mardyn_exit(0); } else if (o.action() == "callback" && o.callback()) { (*o.callback())(o, opt, value, *this); @@ -436,12 +437,12 @@ void OptionParser::print_version() const { } void OptionParser::exit() const { - Simulation::exit(2); + mardyn_exit(2); } void OptionParser::error(const std::string& msg) const { print_usage(std::cerr); std::cerr << prog() << ": " << _("error") << ": " << msg << std::endl; - Simulation::exit(-4); + mardyn_exit(-4); } ////////// } class OptionParser ////////// diff --git a/src/utils/SigsegvHandler.h b/src/utils/SigsegvHandler.h index 1a9033bf5a..f6bcf7c823 100644 --- a/src/utils/SigsegvHandler.h +++ b/src/utils/SigsegvHandler.h @@ -15,7 +15,7 @@ #include #include "mardyn_assert.h" -#include "Simulation.h" +#include "utils/mardyn_assert.h" void handler(int sig) { @@ -28,7 +28,7 @@ void handler(int sig) { // print out all the frames to stderr fprintf(stderr, "Error: signal %d:\n", sig); backtrace_symbols_fd(array, size, STDERR_FILENO); - Simulation::exit(1); + mardyn_exit(1); } void registerSigsegvHandler() { diff --git a/src/utils/Testing.cpp b/src/utils/Testing.cpp index 898c9fb73d..3899af516d 100644 --- a/src/utils/Testing.cpp +++ b/src/utils/Testing.cpp @@ -8,7 +8,7 @@ #include "utils/Testing.h" #include "utils/Logger.h" #include "utils/FileUtils.h" -#include "Simulation.h" +#include "utils/mardyn_assert.h" Log::Logger* test_log; @@ -94,7 +94,7 @@ utils::Test::~Test() { } void utils::Test::setTestDataDirectory(std::string& testDataDir) { if (!fileExists(testDataDir.c_str())) { test_log->error() << "Directory '" << testDataDirectory << "' for test input data does not exist!" << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } testDataDirectory = testDataDir; } @@ -105,7 +105,7 @@ std::string utils::Test::getTestDataFilename(const std::string& file, bool check if (!fileExists(fullPath.c_str()) and checkExistence) { test_log->error() << "File " << fullPath << " for test input data does not exist!" << std::endl; - Simulation::exit(-1); + mardyn_exit(-1); } return fullPath; } diff --git a/src/utils/generator/ReplicaFiller.cpp b/src/utils/generator/ReplicaFiller.cpp index 6e88160d05..f4767918cc 100644 --- a/src/utils/generator/ReplicaFiller.cpp +++ b/src/utils/generator/ReplicaFiller.cpp @@ -6,12 +6,13 @@ #include #include +#include "Simulation.h" #include "molecules/Molecule.h" #include "io/InputBase.h" #include "io/BinaryReader.h" #include "utils/Logger.h" #include "utils/Coordinate3D.h" -#include "Simulation.h" +#include "utils/mardyn_assert.h" #include "particleContainer/ParticleContainer.h" #include "particleContainer/ParticleCellBase.h" @@ -146,18 +147,18 @@ void ReplicaFiller::readXML(XMLfileUnits& xmlconfig) { xmlconfig.getNodeValue("@type", inputPluginName); if (inputPluginName != "BinaryReader") { Log::global_log->error() << "[ReplicaFiller] ReplicaFiller only works with inputPlugins: BinaryReader at the moment" << std::endl; - Simulation::exit(1); + mardyn_exit(1); } setInputReader(std::make_shared()); _inputReader->readXML(xmlconfig); if (_inputReader == nullptr) { Log::global_log->error() << "[ReplicaFiller] Could not create input reader " << inputPluginName << std::endl; - Simulation::exit(1); + mardyn_exit(1); } xmlconfig.changecurrentnode(".."); } else { Log::global_log->error() << "[ReplicaFiller] Input reader for original not specified." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } if (xmlconfig.changecurrentnode("origin")) { Coordinate3D origin; @@ -176,7 +177,7 @@ void ReplicaFiller::readXML(XMLfileUnits& xmlconfig) { const size_t numComps = global_simulation->getEnsemble()->getComponents()->size(); if ((componentid < 1) || (componentid > numComps)) { Log::global_log->error() << "[ReplicaFiller] Specified componentid is invalid. Valid range: 1 <= componentid <= " << numComps << std::endl; - Simulation::exit(1); + mardyn_exit(1); } _componentid = componentid - 1; // Internally stored in array starting at index 0 _keepComponent = false; @@ -205,7 +206,7 @@ void ReplicaFiller::init() { if (numberOfParticles == 0) { Log::global_log->error_always_output() << "[ReplicaFiller] No molecules in replica, aborting! " << std::endl; - Simulation::exit(1); + mardyn_exit(1); } Log::global_log->info() << "[ReplicaFiller] Setting simulation time to 0.0" << std::endl; diff --git a/src/utils/xmlfile.cpp b/src/utils/xmlfile.cpp index 7cb1748193..c781575251 100644 --- a/src/utils/xmlfile.cpp +++ b/src/utils/xmlfile.cpp @@ -16,7 +16,6 @@ #include "utils/mardyn_assert.h" #include "rapidxml/rapidxml_print.hpp" #include "String_utils.h" -#include "Simulation.h" //#include // fseek(),fread(); should be included after mpi.h //#ifdef __linux__ @@ -196,7 +195,7 @@ bool XMLfile::initfile_local(const std::string& filepath) { if(!fstrm) { std::cerr << "ERROR opening " << filepathTrimmed << std::endl; clear(); - Simulation::exit(1); + mardyn_exit(1); } std::ifstream::pos_type filesize=fstrm.tellg(); fstrm.close(); fstrm.clear(); @@ -541,7 +540,7 @@ template bool XMLfile::Node::getValue(T& value) const if (ss.str().find_first_of("-") != std::string::npos) { std::cerr << "ERROR parsing \"" << ss.str() << "\" to data type " << typeid(T).name() << " from tag \"<" << name() << ">\" in xml file" << std::endl; std::cerr << "The tag contains a negative value but an unsigned value was expected." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } } ss >> value; @@ -549,7 +548,7 @@ template bool XMLfile::Node::getValue(T& value) const if (!ss.eof() || ss.fail()) { std::cerr << "ERROR parsing all chars of \"" << ss.str() << "\" from tag \"<" << name() << ">\" in xml file" << std::endl; std::cerr << "This might be the result of using a float while an integer is expected." << std::endl; - Simulation::exit(1); + mardyn_exit(1); } return true; } @@ -585,7 +584,7 @@ template<> bool XMLfile::Node::getValue(bool& value) const } else { std::cerr << "ERROR parsing \"" << v << "\" to boolean from tag \"" << name() << "\" in xml file." << " Valid values are: true, false, yes, no, on, off. " << std::endl; - Simulation::exit(1); + mardyn_exit(1); } } return found; diff --git a/tools/gui/generators/MDGenerator.cpp b/tools/gui/generators/MDGenerator.cpp index 6fcdef6608..0e871f345a 100644 --- a/tools/gui/generators/MDGenerator.cpp +++ b/tools/gui/generators/MDGenerator.cpp @@ -17,7 +17,7 @@ #ifndef MARDYN #include "common/DrawableMolecule.h" #include "QObjects/ScenarioGenerator.h" -#include "Simulation.h" +#include "utils/mardyn_assert.h" #endif From ae2ecee44a99f03b3c8e87aa074bf504c7229a86 Mon Sep 17 00:00:00 2001 From: HomesGH <55833544+HomesGH@users.noreply.github.com> Date: Fri, 26 Jul 2024 15:46:55 +0200 Subject: [PATCH 02/13] Add missing include Simulation.h --- src/ensemble/tests/CanonicalEnsembleTest.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ensemble/tests/CanonicalEnsembleTest.cpp b/src/ensemble/tests/CanonicalEnsembleTest.cpp index 16848904fe..715123092f 100644 --- a/src/ensemble/tests/CanonicalEnsembleTest.cpp +++ b/src/ensemble/tests/CanonicalEnsembleTest.cpp @@ -10,6 +10,7 @@ #include "parallel/DomainDecompBase.h" #include "molecules/Molecule.h" #include "Domain.h" +#include "Simulation.h" #include From 5ee021978fcbd8d494dc75055c093801bc900442 Mon Sep 17 00:00:00 2001 From: HomesGH <55833544+HomesGH@users.noreply.github.com> Date: Fri, 26 Jul 2024 15:59:05 +0200 Subject: [PATCH 03/13] Add missing include for unique_ptr --- src/io/ODF.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/io/ODF.h b/src/io/ODF.h index 9ed44f03fa..1928cf2173 100644 --- a/src/io/ODF.h +++ b/src/io/ODF.h @@ -6,7 +6,9 @@ #pragma once -#include +#include + +#include "particleContainer/adapter/ODFCellProcessor.h" #include "Domain.h" #include "parallel/DomainDecompBase.h" #include "particleContainer/ParticleContainer.h" From db9c540c4c1f3b1ff40527cf987800f03ae1cf7c Mon Sep 17 00:00:00 2001 From: HomesGH <55833544+HomesGH@users.noreply.github.com> Date: Fri, 26 Jul 2024 15:59:47 +0200 Subject: [PATCH 04/13] Delete redundant include --- src/parallel/ForceHelper.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/parallel/ForceHelper.cpp b/src/parallel/ForceHelper.cpp index a741c847ec..86d19a8fff 100644 --- a/src/parallel/ForceHelper.cpp +++ b/src/parallel/ForceHelper.cpp @@ -3,9 +3,6 @@ #include -#include "particleContainer/ParticleContainer.h" -#include "particleContainer/ParticleIterator.h" - #include "utils/mardyn_assert.h" std::variant> addValuesAndGetIterator( From 64b4f6111139da2d8bd94f106d81ea8db70df86a Mon Sep 17 00:00:00 2001 From: HomesGH <55833544+HomesGH@users.noreply.github.com> Date: Fri, 26 Jul 2024 16:04:16 +0200 Subject: [PATCH 05/13] Add missing include --- src/plugins/ExamplePlugin.cpp | 2 +- src/plugins/ExamplePlugin.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/ExamplePlugin.cpp b/src/plugins/ExamplePlugin.cpp index fb12252922..c2bd11cd5b 100644 --- a/src/plugins/ExamplePlugin.cpp +++ b/src/plugins/ExamplePlugin.cpp @@ -6,8 +6,8 @@ */ #include "ExamplePlugin.h" -#include "utils/mardyn_assert.h" +#include "utils/mardyn_assert.h" #include "utils/xmlfileUnits.h" #include "utils/Logger.h" diff --git a/src/plugins/ExamplePlugin.h b/src/plugins/ExamplePlugin.h index 6071459ead..d6e1eeafab 100644 --- a/src/plugins/ExamplePlugin.h +++ b/src/plugins/ExamplePlugin.h @@ -10,6 +10,8 @@ #include "PluginBase.h" +#include + /** * The purpose of this class is to show the basic usage of Plugins. * It just outputs a string that the user specified in the XML at the From 00c3f59d9c421031d3e72b277294a77ebfd7d0ee Mon Sep 17 00:00:00 2001 From: HomesGH <55833544+HomesGH@users.noreply.github.com> Date: Fri, 26 Jul 2024 16:11:08 +0200 Subject: [PATCH 06/13] Add missing include --- src/plugins/ExamplePlugin.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/ExamplePlugin.cpp b/src/plugins/ExamplePlugin.cpp index c2bd11cd5b..f026b4165e 100644 --- a/src/plugins/ExamplePlugin.cpp +++ b/src/plugins/ExamplePlugin.cpp @@ -11,6 +11,8 @@ #include "utils/xmlfileUnits.h" #include "utils/Logger.h" +#include + void ExamplePlugin::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 1; From 9cd1396bf526ef21251a4e116c64eb4cfbf28bf6 Mon Sep 17 00:00:00 2001 From: HomesGH <55833544+HomesGH@users.noreply.github.com> Date: Fri, 26 Jul 2024 16:23:02 +0200 Subject: [PATCH 07/13] Add std to strcmp --- src/plugins/ExamplePlugin.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/plugins/ExamplePlugin.cpp b/src/plugins/ExamplePlugin.cpp index f026b4165e..43d55aa9db 100644 --- a/src/plugins/ExamplePlugin.cpp +++ b/src/plugins/ExamplePlugin.cpp @@ -30,27 +30,27 @@ void ExamplePlugin::readXML(XMLfileUnits& xmlconfig) { << std::endl; const char* str = displaySelectorString.c_str(); - if (strcmp(str, "all") == 0) { + if (std::strcmp(str, "all") == 0) { _displaySelector = WhereToDisplay::ALL; Log::global_log->info() << "Displaying at all plugin positions." << std::endl; - } else if (strcmp(str, "beforeEventNewTimestep") == 0) { + } else if (std::strcmp(str, "beforeEventNewTimestep") == 0) { _displaySelector = WhereToDisplay::BEFORE_EVENT_NEW_TIMESTEP; Log::global_log->info() << "Displaying at beforeEventNewTimestep." << std::endl; - } else if (strcmp(str, "beforeForces") == 0) { + } else if (std::strcmp(str, "beforeForces") == 0) { _displaySelector = WhereToDisplay::BEFORE_FORCES; Log::global_log->info() << "Displaying at beforeForces." << std::endl; - } else if (strcmp(str, "afterForces") == 0) { + } else if (std::strcmp(str, "afterForces") == 0) { _displaySelector = WhereToDisplay::AFTER_FORCES; Log::global_log->info() << "Displaying at afterForces." << std::endl; - } else if (strcmp(str, "endStep") == 0) { + } else if (std::strcmp(str, "endStep") == 0) { _displaySelector = WhereToDisplay::END_STEP; Log::global_log->info() << "Displaying at endStep." << std::endl; - } else if (strcmp(str, "init") == 0) { + } else if (std::strcmp(str, "init") == 0) { _displaySelector = WhereToDisplay::AT_INIT; Log::global_log->info() << "Displaying at init." << std::endl; - } else if (strcmp(str, "finish") == 0) { + } else if (std::strcmp(str, "finish") == 0) { _displaySelector = WhereToDisplay::AT_FINISH; Log::global_log->info() << "Displaying at finish." << std::endl; } else { From 2a6f5982a3149cc42c1dd1907f40d2490460f5c9 Mon Sep 17 00:00:00 2001 From: HomesGH <55833544+HomesGH@users.noreply.github.com> Date: Fri, 26 Jul 2024 16:32:04 +0200 Subject: [PATCH 08/13] Modify string include --- src/plugins/ExamplePlugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/ExamplePlugin.cpp b/src/plugins/ExamplePlugin.cpp index 43d55aa9db..f08e926a30 100644 --- a/src/plugins/ExamplePlugin.cpp +++ b/src/plugins/ExamplePlugin.cpp @@ -11,7 +11,7 @@ #include "utils/xmlfileUnits.h" #include "utils/Logger.h" -#include +#include void ExamplePlugin::readXML(XMLfileUnits& xmlconfig) { From 33d2a1610771a169fcd6c408ee0b5e06774be276 Mon Sep 17 00:00:00 2001 From: Simon Homes Date: Fri, 26 Jul 2024 17:52:33 +0200 Subject: [PATCH 09/13] Add missing include in Autopas --- src/particleContainer/AutoPasContainer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/particleContainer/AutoPasContainer.cpp b/src/particleContainer/AutoPasContainer.cpp index 6bddb1e86f..0a9fa5a8c3 100644 --- a/src/particleContainer/AutoPasContainer.cpp +++ b/src/particleContainer/AutoPasContainer.cpp @@ -8,6 +8,7 @@ #include #include #include "Domain.h" +#include "Simulation.h" #include "utils/mardyn_assert.h" #include "autopas/utils/StringUtils.h" #include "autopas/utils/logging/Logger.h" From f96e840995412862836d6d2903a267b93c55c4f2 Mon Sep 17 00:00:00 2001 From: HomesGH <55833544+HomesGH@users.noreply.github.com> Date: Mon, 29 Jul 2024 15:55:22 +0200 Subject: [PATCH 10/13] Exit with error if AutoPas was started w multicomp --- src/molecules/AutoPasSimpleMolecule.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/molecules/AutoPasSimpleMolecule.cpp b/src/molecules/AutoPasSimpleMolecule.cpp index bdccdc3227..4700aad3fc 100644 --- a/src/molecules/AutoPasSimpleMolecule.cpp +++ b/src/molecules/AutoPasSimpleMolecule.cpp @@ -18,9 +18,8 @@ AutoPasSimpleMolecule::AutoPasSimpleMolecule(unsigned long id, Component* compon if (_component == nullptr) { _component = component; } else if (_component != component and component != nullptr) { - Log::global_log->debug() << "AutoPasSimpleMolecule can only handle one component" << std::endl; - _component = component; - // mardyn_exit(32); + Log::global_log->error() << "AutoPasSimpleMolecule can only handle one component" << std::endl; + mardyn_exit(32); } } From cf6f9784e2b1801d3c07ec39be75bdd78e7aa364 Mon Sep 17 00:00:00 2001 From: HomesGH <55833544+HomesGH@users.noreply.github.com> Date: Mon, 29 Jul 2024 16:50:49 +0200 Subject: [PATCH 11/13] Throw error if sequential run executed but MPI parallelisation specified --- src/Simulation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Simulation.cpp b/src/Simulation.cpp index 0539cb6a03..ab342f9d15 100644 --- a/src/Simulation.cpp +++ b/src/Simulation.cpp @@ -387,11 +387,11 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { } #else /* serial */ if(parallelisationtype != "DummyDecomposition") { - Log::global_log->warning() + Log::global_log->error() << "Executable was compiled without support for parallel execution: " << parallelisationtype << " not available. Using serial mode." << std::endl; - //mardyn_exit(1); + mardyn_exit(1); } //_domainDecomposition = new DomainDecompBase(); // already set in initialize() #endif From a2eae1ed0775f72a48a4de0334b26a81f323293a Mon Sep 17 00:00:00 2001 From: HomesGH <55833544+HomesGH@users.noreply.github.com> Date: Mon, 29 Jul 2024 18:52:05 +0200 Subject: [PATCH 12/13] Undo exit of ls1 regarding Autopas and parallization --- src/Simulation.cpp | 4 ++-- src/molecules/AutoPasSimpleMolecule.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Simulation.cpp b/src/Simulation.cpp index ab342f9d15..0539cb6a03 100644 --- a/src/Simulation.cpp +++ b/src/Simulation.cpp @@ -387,11 +387,11 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { } #else /* serial */ if(parallelisationtype != "DummyDecomposition") { - Log::global_log->error() + Log::global_log->warning() << "Executable was compiled without support for parallel execution: " << parallelisationtype << " not available. Using serial mode." << std::endl; - mardyn_exit(1); + //mardyn_exit(1); } //_domainDecomposition = new DomainDecompBase(); // already set in initialize() #endif diff --git a/src/molecules/AutoPasSimpleMolecule.cpp b/src/molecules/AutoPasSimpleMolecule.cpp index 4700aad3fc..553f21272f 100644 --- a/src/molecules/AutoPasSimpleMolecule.cpp +++ b/src/molecules/AutoPasSimpleMolecule.cpp @@ -18,8 +18,8 @@ AutoPasSimpleMolecule::AutoPasSimpleMolecule(unsigned long id, Component* compon if (_component == nullptr) { _component = component; } else if (_component != component and component != nullptr) { - Log::global_log->error() << "AutoPasSimpleMolecule can only handle one component" << std::endl; - mardyn_exit(32); + Log::global_log->warning() << "AutoPasSimpleMolecule can only handle one component" << std::endl; + // mardyn_exit(32); } } From deffa802be46e0d3f5f5a679bf6dc7d3258ee87d Mon Sep 17 00:00:00 2001 From: HomesGH <55833544+HomesGH@users.noreply.github.com> Date: Mon, 29 Jul 2024 22:55:09 +0200 Subject: [PATCH 13/13] Re-add component Autopas --- src/molecules/AutoPasSimpleMolecule.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/molecules/AutoPasSimpleMolecule.cpp b/src/molecules/AutoPasSimpleMolecule.cpp index 553f21272f..49150cd981 100644 --- a/src/molecules/AutoPasSimpleMolecule.cpp +++ b/src/molecules/AutoPasSimpleMolecule.cpp @@ -19,6 +19,7 @@ AutoPasSimpleMolecule::AutoPasSimpleMolecule(unsigned long id, Component* compon _component = component; } else if (_component != component and component != nullptr) { Log::global_log->warning() << "AutoPasSimpleMolecule can only handle one component" << std::endl; + _component = component; // mardyn_exit(32); } }