From ef0eaf70ae81307fbe6520f41ddc17b50e7aca62 Mon Sep 17 00:00:00 2001 From: HomesGH Date: Wed, 24 May 2023 21:12:19 +0200 Subject: [PATCH 01/32] Get rid of using namespace std in tools files --- tools/APE/data/FileStruct.py | 10 +-- tools/APE/data/SettingStruct.py | 16 ++-- tools/accumulate.cpp | 17 ++-- tools/grideval/Domain.cpp | 56 ++++++------ tools/grideval/Domain.h | 13 ++- tools/grideval/grideval.cpp | 90 +++++++++---------- tools/grideval/grideval.h | 1 - tools/gui/generators/AqueousNaClGenerator.cpp | 42 ++++----- .../generators/CrystalLatticeGenerator.cpp | 28 +++--- tools/gui/generators/CubicGridGenerator.cpp | 30 +++---- tools/gui/generators/DropletGenerator.cpp | 84 ++++++++--------- tools/gui/generators/DropletGenerator.h | 7 +- tools/gui/generators/MDGenerator.cpp | 30 +++---- tools/gui/generators/MS2RSTGenerator.cpp | 30 +++---- .../generators/RayleighTaylorGenerator.cpp | 86 +++++++++--------- .../gui/generators/RayleighTaylorGenerator.h | 3 +- .../generators/common/ComponentParameters.cpp | 54 +++++------ .../generators/common/DrawableMolecule.cpp | 8 +- .../gui/generators/common/DrawableMolecule.h | 4 +- .../generators/common/DropletPlacement.cpp | 26 +++--- .../generators/common/MS2RestartReader.cpp | 38 ++++---- .../common/MardynConfigLegacyWriter.cpp | 29 +++--- .../common/MardynConfigurationParameters.cpp | 24 ++--- tools/gui/generators/common/PMFileReader.cpp | 75 ++++++++-------- .../common/PrincipalAxisTransform.cpp | 15 ++-- tools/mdproject2mardyn.cpp | 61 +++++++------ tools/mksd/Component.cpp | 24 ++--- tools/mksd/Component.h | 23 +++-- tools/mksd/ConfigWriter.cpp | 28 +++--- tools/mksd/ConfigWriter.h | 11 ++- tools/mksd/GlobalStartGeometry.cpp | 70 +++++++-------- tools/mksd/GlobalStartGeometry.h | 5 +- tools/mksd/Molecule.cpp | 4 +- tools/mksd/Molecule.h | 7 +- tools/mksd/PhaseSpaceWriter.cpp | 50 +++++------ tools/mksd/PhaseSpaceWriter.h | 17 ++-- tools/mksd/RandomNumber.cpp | 1 - tools/mksd/RandomNumber.h | 1 - tools/mksd/main.cpp | 55 ++++++------ tools/moldy2mardyn.cpp | 37 ++++---- .../standalone-generators/animake/Domain.cpp | 22 ++--- tools/standalone-generators/animake/Domain.h | 1 - tools/standalone-generators/animake/main.cpp | 35 ++++---- tools/standalone-generators/mkcp/Domain.cpp | 50 +++++------ tools/standalone-generators/mkcp/Domain.h | 1 - tools/standalone-generators/mkcp/Graphit.cpp | 5 +- tools/standalone-generators/mkcp/Graphit.h | 7 +- tools/standalone-generators/mkcp/main.cpp | 49 +++++----- .../standalone-generators/mkesfera/Domain.cpp | 18 ++-- tools/standalone-generators/mkesfera/Domain.h | 1 - tools/standalone-generators/mkesfera/main.cpp | 13 ++- tools/standalone-generators/mktcts/Domain.cpp | 18 ++-- tools/standalone-generators/mktcts/Domain.h | 1 - tools/standalone-generators/mktcts/main.cpp | 15 ++-- 54 files changed, 707 insertions(+), 739 deletions(-) diff --git a/tools/APE/data/FileStruct.py b/tools/APE/data/FileStruct.py index 189a7637a9..7da70e2b5f 100644 --- a/tools/APE/data/FileStruct.py +++ b/tools/APE/data/FileStruct.py @@ -401,14 +401,14 @@ def parseSettingElement(self, child): def __str__(self): if self.isValid(): - string = 'XML-Path: "' + std::string = 'XML-Path: "' for element in self.xmlpath: - string += element + std::string += element if element is not self.xmlpath[-1]: - string += '/' - string += '" ' + std::string += '/' + std::string += '" ' if self.attribute != "": - string += 'Attribute: "' + self.attribute + '" ' + std::string += 'Attribute: "' + self.attribute + '" ' return string else: return "" diff --git a/tools/APE/data/SettingStruct.py b/tools/APE/data/SettingStruct.py index 5630224a88..73af6c64c5 100644 --- a/tools/APE/data/SettingStruct.py +++ b/tools/APE/data/SettingStruct.py @@ -721,18 +721,18 @@ def makeMessage(self, node, text, error=False): currentNode = currentNode.parentNode if error: - string = "Error: " + std::string = "Error: " else: - string = "Warning: " + std::string = "Warning: " - string += 'At XML-Path: "' + std::string += 'At XML-Path: "' for nodeName in reversed(nodeNameTree): - string += nodeName + std::string += nodeName if nodeName is not nodeNameTree[0]: - string += '/' - string += '" ' - string += text - self.messages.append(string) + std::string += '/' + std::string += '" ' + std::string += text + self.messages.append(std::string) ''' The DeepSearchSettingTreeIndex class uses the DeepSearchSettingTree class to do the deep search with indexes as return values ''' diff --git a/tools/accumulate.cpp b/tools/accumulate.cpp index e2d5629fd1..552e5d8c5f 100644 --- a/tools/accumulate.cpp +++ b/tools/accumulate.cpp @@ -5,7 +5,6 @@ #include #include -using namespace std; /** * This tool computes accumulated and averaged values for pressure and potential @@ -14,33 +13,33 @@ using namespace std; int main(int argc, char** argsv) { if (argc != 3) { - cout << "Usage: ./accumulate FILENAME NTIMES" << endl; + std::cout << "Usage: ./accumulate FILENAME NTIMES" << std::endl; return -1; } int numSteps = atoi(argsv[2]); - cout << " Using file " << argsv[1] <<", averaging last " << numSteps << " steps." << endl; + std::cout << " Using file " << argsv[1] <<", averaging last " << numSteps << " steps." << std::endl; - ifstream inputfilestream(argsv[1]); + std::ifstream inputfilestream(argsv[1]); if (!inputfilestream.is_open()) { - cerr << "Could not open file " << argsv[1] << endl; + std::cerr << "Could not open file " << argsv[1] << std::endl; exit(1); } Accumulator upot_acc(numSteps); Accumulator p_acc(numSteps); - string line; + std::string line; while(inputfilestream) { line.clear(); getline(inputfilestream, line); if (line.empty() || line[0] == '#') { - cout << " skippiing: " << line << endl; + std::cout << " skippiing: " << line << std::endl; continue; } - stringstream lineStream(line); + std::stringstream lineStream(line); double upot = 0; double p = 0; double dummy = 0; @@ -53,7 +52,7 @@ int main(int argc, char** argsv) { p_acc.addEntry(p); } - cout << "================== UPot = " << upot_acc.getAverage() << ", p = " << p_acc.getAverage() << endl; + std::cout << "================== UPot = " << upot_acc.getAverage() << ", p = " << p_acc.getAverage() << std::endl; return 0; } diff --git a/tools/grideval/Domain.cpp b/tools/grideval/Domain.cpp index c0b936e821..688931f034 100644 --- a/tools/grideval/Domain.cpp +++ b/tools/grideval/Domain.cpp @@ -7,10 +7,10 @@ Domain::Domain(int ingrid) { this->grid = ingrid; - this->cavities = set(); - this->verlet = map< long, set >(); - this->clusterID = map(); - this->clusterVertices = map< long, set >(); + this->cavities = std::set(); + this->verlet = std::map< long, std::set >(); + this->clusterID = std::map(); + this->clusterVertices = std::map< long, std::set >(); } long Domain::encode(int xgrid, int ygrid, int zgrid) @@ -23,7 +23,7 @@ long Domain::encode(int xgrid, int ygrid, int zgrid) void Domain::decode(int* qgrid, long code) { long rest; - if((code < 0) || (code >= grid*grid*grid)) { cout << "invalid code " << code << ".\n"; exit(22); } + if((code < 0) || (code >= grid*grid*grid)) { std::cout << "invalid code " << code << ".\n"; exit(22); } rest = code % grid; qgrid[2] = rest; @@ -37,16 +37,16 @@ void Domain::decode(int* qgrid, long code) return; } -bool Domain::neighbours(long code, set* vicinity) +bool Domain::neighbours(long code, std::set* vicinity) { - // cout << "\t{"; + // std::cout << "\t{"; vicinity->clear(); if(this->cavities.count(code) > 0) { - // cout << code; + // std::cout << code; int x[3]; this->decode(x, code); - // cout << " ; (" << x[0] << "/" << x[1] << "/" << x[2] << ")"; + // std::cout << " ; (" << x[0] << "/" << x[1] << "/" << x[2] << ")"; int c[3]; int y[3]; @@ -65,7 +65,7 @@ bool Domain::neighbours(long code, set* vicinity) if(y[d] < 0) y[d] += grid; else if(y[d] >= grid) y[d] -= grid; } - // cout << " -?-> (" << y[0] << "/" << y[1] << "/" << y[2] << ")"; + // std::cout << " -?-> (" << y[0] << "/" << y[1] << "/" << y[2] << ")"; ycode = this->encode(y[0], y[1], y[2]); if(this->cavities.count(ycode) > 0) vicinity->insert(ycode); } @@ -73,42 +73,42 @@ bool Domain::neighbours(long code, set* vicinity) } } } - // cout << "}"; + // std::cout << "}"; return !vicinity->empty(); } void Domain::build_verlet() { - set::iterator cavit; + std::set::iterator cavit; for(cavit = this->cavities.begin(); cavit != this->cavities.end(); cavit++) { - this->verlet[*cavit] = set(); + this->verlet[*cavit] = std::set(); this->neighbours(*cavit, &(this->verlet[*cavit])); } } void Domain::detectClusters() { - set::iterator acti, actj; + std::set::iterator acti, actj; long lowlink, tnode; - set processed_nodes; - set present_nodes; - set unprocessed_nodes; + std::set processed_nodes; + std::set present_nodes; + std::set unprocessed_nodes; - stack dfs_stack; - map::iterator> edgeit; + std::stack dfs_stack; + std::map::iterator> edgeit; for(acti = this->cavities.begin(); acti != this->cavities.end(); acti++) { - // cout << "\t{" << *acti << "}"; + // std::cout << "\t{" << *acti << "}"; this->attach(*acti, *acti, false); unprocessed_nodes.insert(*acti); } - // cout << "\nBuilding Verlet list:"; + // std::cout << "\nBuilding Verlet list:"; this->build_verlet(); - // cout << " done.\n"; + // std::cout << " done.\n"; while(!unprocessed_nodes.empty()) { @@ -156,7 +156,7 @@ void Domain::attach(long vertex, long cluster, bool detach_previous) { if(cluster > vertex) { - cout << "\nCavity " << vertex << " cannot be attached to cluster " << cluster << ".\n"; + std::cout << "\nCavity " << vertex << " cannot be attached to cluster " << cluster << ".\n"; exit(23); } @@ -175,15 +175,15 @@ void Domain::attach(long vertex, long cluster, bool detach_previous) this->clusterID[vertex] = cluster; if(this->clusterVertices.count(cluster) == 0) { - this->clusterVertices[cluster] = set(); + this->clusterVertices[cluster] = std::set(); } this->clusterVertices[cluster].insert(vertex); } -unsigned Domain::countClusters(map* thresholds) +unsigned Domain::countClusters(std::map* thresholds) { - map exactPopulation; - map< long, set >::iterator cluvit; + std::map exactPopulation; + std::map< long, std::set >::iterator cluvit; for(cluvit = this->clusterVertices.begin(); cluvit != this->clusterVertices.end(); cluvit++) { unsigned cavsize = cluvit->second.size(); @@ -192,7 +192,7 @@ unsigned Domain::countClusters(map* thresholds) } unsigned largest = 0; - map::iterator threshit, popit; + std::map::iterator threshit, popit; for(threshit = thresholds->begin(); threshit != thresholds->end(); *threshit++) { (*thresholds)[threshit->first] = 0; diff --git a/tools/grideval/Domain.h b/tools/grideval/Domain.h index fc6beeea83..0f230529ee 100644 --- a/tools/grideval/Domain.h +++ b/tools/grideval/Domain.h @@ -4,7 +4,6 @@ #include #include -using namespace std; class Domain { @@ -18,21 +17,21 @@ class Domain long encode(int xgrid, int ygrid, int zgrid); void decode(int* qgrid, long code); - bool neighbours(long code, set* vicinity); + bool neighbours(long code, std::set* vicinity); void build_verlet(); void detectClusters(); void attach(long vertex, long cluster, bool detach_previous); - unsigned countClusters(map* thresholds); + unsigned countClusters(std::map* thresholds); private: int grid; - set cavities; + std::set cavities; - map< long, set > verlet; // for all cavities, contains the neighbour cavities + std::map< long, std::set > verlet; // for all cavities, contains the neighbour cavities - map clusterID; // contains cluster ID of the cavities (i.e. smallest cavity ID from the cluster) - map< long, set > clusterVertices; // all cavities within the cluster + std::map clusterID; // contains cluster ID of the cavities (i.e. smallest cavity ID from the cluster) + std::map< long, std::set > clusterVertices; // all cavities within the cluster }; #endif diff --git a/tools/grideval/grideval.cpp b/tools/grideval/grideval.cpp index 4256ac4bb8..a8de92ae6b 100644 --- a/tools/grideval/grideval.cpp +++ b/tools/grideval/grideval.cpp @@ -14,8 +14,8 @@ int main(int argc, char** argv) const char* usage = " -g -l [-d ] [-i] [-j ] [-m ] [-r ] [-s ]\n\n-d\tdigits used for frame numbering\n-i\tintegral (i.e. single) cavity file\n-m\tmaximal considered threshold size\n-r\tselected range (initial and terminal frame numbers)\n"; if((argc < 6) || (argc > 19)) { - cout << "There should be at least five and at most 18 arguments.\n\n"; - cout << argv[0] << usage; + std::cout << "There should be at least five and at most 18 arguments.\n\n"; + std::cout << argv[0] << usage; exit(7); } @@ -44,9 +44,9 @@ int main(int argc, char** argv) { if(*argv[i] != '-') { - cout << "\nFlag expected where '" << argv[i] + std::cout << "\nFlag expected where '" << argv[i] << "' was given.\n\n"; - cout << argv[0] << usage; + std::cout << argv[0] << usage; exit(8); } for(int j=1; argv[i][j]; j++) @@ -57,8 +57,8 @@ int main(int argc, char** argv) digits = atoi(argv[i]); if((digits < 1) || (digits > 12)) { - cout << "\nToo many digits.\n\n"; - cout << argv[0] << usage; + std::cout << "\nToo many digits.\n\n"; + std::cout << argv[0] << usage; exit(11); } digits_specified = true; @@ -113,7 +113,7 @@ int main(int argc, char** argv) } else { - cout << "\nUnknown flag \"-" << argv[i][j] << ".\n\n" + std::cout << "\nUnknown flag \"-" << argv[i][j] << ".\n\n" << argv[0] << usage; exit(9); } @@ -122,49 +122,49 @@ int main(int argc, char** argv) if(!grid_specified) { - cout << "\nUnknown grid size.\n\n" << argv[0] << usage; + std::cout << "\nUnknown grid size.\n\n" << argv[0] << usage; exit(13); } if(!length_specified) { - cout << "\nUnknown box size.\n\n" << argv[0] << usage; + std::cout << "\nUnknown box size.\n\n" << argv[0] << usage; exit(14); } - cout << "# frame\t\tN_cav\t"; - map thresholds; + std::cout << "# frame\t\tN_cav\t"; + std::map thresholds; /* double thrfactor = pow((double)max_threshold/min_threshold, 1.0/(num_threshold - 1.0)); double tthreshold = min_threshold; for(unsigned i = 0; i < num_threshold; i++) { - cout << "\t(N_cav >= " << round(tthreshold) << ")"; + std::cout << "\t(N_cav >= " << round(tthreshold) << ")"; thresholds[(unsigned)round(tthreshold)] = 0; tthreshold *= thrfactor; } */ thresholds[round(0.002 * (double)max_threshold)] = 0; - cout << "\t(N_cav >= " << round(0.002 * (double)max_threshold) << ")"; + std::cout << "\t(N_cav >= " << round(0.002 * (double)max_threshold) << ")"; thresholds[round(0.004 * (double)max_threshold)] = 0; - cout << "\t(N_cav >= " << round(0.004 * (double)max_threshold) << ")"; + std::cout << "\t(N_cav >= " << round(0.004 * (double)max_threshold) << ")"; thresholds[round(0.01 * (double)max_threshold)] = 0; - cout << "\t(N_cav >= " << round(0.01 * (double)max_threshold) << ")"; + std::cout << "\t(N_cav >= " << round(0.01 * (double)max_threshold) << ")"; thresholds[round(0.02 * (double)max_threshold)] = 0; - cout << "\t(N_cav >= " << round(0.02 * (double)max_threshold) << ")"; + std::cout << "\t(N_cav >= " << round(0.02 * (double)max_threshold) << ")"; thresholds[round(0.04 * (double)max_threshold)] = 0; - cout << "\t(N_cav >= " << round(0.04 * (double)max_threshold) << ")"; + std::cout << "\t(N_cav >= " << round(0.04 * (double)max_threshold) << ")"; thresholds[round(0.1 * (double)max_threshold)] = 0; - cout << "\t(N_cav >= " << round(0.1 * (double)max_threshold) << ")"; + std::cout << "\t(N_cav >= " << round(0.1 * (double)max_threshold) << ")"; thresholds[round(0.2 * (double)max_threshold)] = 0; - cout << "\t(N_cav >= " << round(0.2 * (double)max_threshold) << ")"; + std::cout << "\t(N_cav >= " << round(0.2 * (double)max_threshold) << ")"; thresholds[round(0.4 * (double)max_threshold)] = 0; - cout << "\t(N_cav >= " << round(0.4 * (double)max_threshold) << ")"; + std::cout << "\t(N_cav >= " << round(0.4 * (double)max_threshold) << ")"; thresholds[max_threshold] = 0; - cout << "\t(N_cav >= " << max_threshold << ")"; - cout << "\t\ti_cav(max)\n# \n"; + std::cout << "\t(N_cav >= " << max_threshold << ")"; + std::cout << "\t\ti_cav(max)\n# \n"; char lnin[256]; - ifstream* dord; + std::ifstream* dord; if(integral) { unsigned fnlen = strlen(prefix) + 1; @@ -172,10 +172,10 @@ int main(int argc, char** argv) char dordname[fnlen]; strcpy(dordname, prefix); if(suffix_specified) strcat(dordname, suffix); - dord = new ifstream(dordname); + dord = new std::ifstream(dordname); if(dord->fail()) { - cout << "\nUnable to open \"" << dordname << "\".\n\n" + std::cout << "\nUnable to open \"" << dordname << "\".\n\n" << argv[0] << usage; exit(11); } @@ -191,16 +191,16 @@ int main(int argc, char** argv) // int entries = atoi(lnin); int entries; *dord >> entries; - // cout << " [skipping " << entries << " entries] "; + // std::cout << " [skipping " << entries << " entries] "; dord->getline(lnin, 256); if((entries < 0) || (entries > 100000000)) { - cout << "\nError parsing number of entries:\n\t" << lnin << "\n"; + std::cout << "\nError parsing number of entries:\n\t" << lnin << "\n"; exit(16); } for(int j = 0; entries >= j; j++) { - if(dord->fail()) { cout << "# \n# Skip failing.\n"; exit(16); } + if(dord->fail()) { std::cout << "# \n# Skip failing.\n"; exit(16); } dord->getline(lnin, 256); } } @@ -224,7 +224,7 @@ int main(int argc, char** argv) strcat(dordname, framecode); if(suffix_specified) strcat(dordname, suffix); - dord = new ifstream(dordname); + dord = new std::ifstream(dordname); if(dord->fail()) { if(digits_specified) break; @@ -239,53 +239,53 @@ int main(int argc, char** argv) // int entries = atoi(lnin); int entries; *dord >> entries; - // cout << " [expecting " << entries << " entries] "; + // std::cout << " [expecting " << entries << " entries] "; dord->getline(lnin, 256); if((entries < 0) || (entries > 100000000)) { - cout << "\nError parsing number of entries:\n\t" << lnin << "\n"; + std::cout << "\nError parsing number of entries:\n\t" << lnin << "\n"; exit(18); } - if(dord->fail()) { cout << "\nSkip failing at comment line.\n"; exit(18); } + if(dord->fail()) { std::cout << "\nSkip failing at comment line.\n"; exit(18); } dord->getline(lnin, 256); - // cout << "\n\tskipping comment line [" << lnin << "]\n"; + // std::cout << "\n\tskipping comment line [" << lnin << "]\n"; Domain c(grid); - string cavtype; + std::string cavtype; double qabs[3]; int qgrid[3]; for(int j = 0; j < entries; j++) { - if(dord->fail()) { cout << "\nSkip failing at cavity type token.\n"; exit(19); } + if(dord->fail()) { std::cout << "\nSkip failing at cavity type token.\n"; exit(19); } *dord >> cavtype; for(unsigned d = 0; d < 3; d++) { - if(dord->fail()) { cout << "\nInput failing.\n"; exit(20); } + if(dord->fail()) { std::cout << "\nInput failing.\n"; exit(20); } *dord >> qabs[d]; if(qabs[d] > length) { - cout << "\nCoordinate value " << qabs[d] << " exceeding specified box dimension (" << length << ").\n"; + std::cout << "\nCoordinate value " << qabs[d] << " exceeding specified box dimension (" << length << ").\n"; exit(19); } qgrid[d] = (int)floor(qabs[d] * grid / length); } - // cout << qgrid[0] << " " << qgrid[1] << " " << qgrid[2] << "\n"; + // std::cout << qgrid[0] << " " << qgrid[1] << " " << qgrid[2] << "\n"; // c.insert(qgrid[0], qgrid[1], qgrid[2]); } - cout << frame << "\t\t" << c.size() << "\t"; + std::cout << frame << "\t\t" << c.size() << "\t"; c.detectClusters(); unsigned maxsize = c.countClusters(&thresholds); - map::iterator threshit; + std::map::iterator threshit; for(threshit = thresholds.begin(); threshit != thresholds.end(); threshit++) { - // cout << "\t[" << threshit->first << "] " << threshit->second; - cout << "\t" << threshit->second; + // std::cout << "\t[" << threshit->first << "] " << threshit->second; + std::cout << "\t" << threshit->second; } - cout << "\t\t" << maxsize << "\n"; - cout.flush(); + std::cout << "\t\t" << maxsize << "\n"; + std::cout.flush(); if(!integral) { @@ -299,6 +299,6 @@ int main(int argc, char** argv) delete dord; } - cout << "\n"; + std::cout << "\n"; return 0; } diff --git a/tools/grideval/grideval.h b/tools/grideval/grideval.h index 1f26f44238..cf23ba78a3 100644 --- a/tools/grideval/grideval.h +++ b/tools/grideval/grideval.h @@ -1,7 +1,6 @@ #ifndef GRIDEVAL_H #define GRIDEVAL_H -using namespace std; int main(int argc, char** argv); diff --git a/tools/gui/generators/AqueousNaClGenerator.cpp b/tools/gui/generators/AqueousNaClGenerator.cpp index 949aa0952a..0b38517858 100644 --- a/tools/gui/generators/AqueousNaClGenerator.cpp +++ b/tools/gui/generators/AqueousNaClGenerator.cpp @@ -55,8 +55,8 @@ AqueousNaClGenerator::AqueousNaClGenerator() : calculateSimulationBoxLength(); } -vector AqueousNaClGenerator::getParameters() { - vector parameters; +std::vector AqueousNaClGenerator::getParameters() { + std::vector parameters; parameters.push_back(new MardynConfigurationParameters(_configuration)); ParameterCollection* tab = new ParameterCollection("AqueousNaClParameters", "Parameters of EqvGridGenerator", @@ -77,7 +77,7 @@ vector AqueousNaClGenerator::getParameters() { void AqueousNaClGenerator::setParameter(Parameter* p) { - string id = p->getNameId(); + std::string id = p->getNameId(); if (id == "numMolecules") { _numMolecules = static_cast (p)->getValue(); calculateSimulationBoxLength(); @@ -101,7 +101,7 @@ void AqueousNaClGenerator::calculateSimulationBoxLength() { void AqueousNaClGenerator::readPhaseSpaceHeader(Domain* domain, double timestep) { - _logger->info() << "Reading PhaseSpaceHeader from AqueousNaClGenerator..." << endl; + _logger->info() << "Reading PhaseSpaceHeader from AqueousNaClGenerator..." << std::endl; //domain->setCurrentTime(0); domain->disableComponentwiseThermostat(); @@ -114,7 +114,7 @@ void AqueousNaClGenerator::readPhaseSpaceHeader(Domain* domain, double timestep) principalAxisTransform(_components[i]); } domain->setepsilonRF(1e+10); - _logger->info() << "Reading PhaseSpaceHeader from AqueousNaClGenerator done." << endl; + _logger->info() << "Reading PhaseSpaceHeader from AqueousNaClGenerator done." << std::endl; /* silence compiler warnings */ (void) timestep; @@ -127,11 +127,11 @@ unsigned long AqueousNaClGenerator::readPhaseSpace(ParticleContainer* particleCo Domain* domain, DomainDecompBase* domainDecomp) { global_simulation->timers()->start("AQUEOUS_NA_CL_GENERATOR_INPUT"); - _logger->info() << "Reading phase space file (AqueousNaClGenerator)." << endl; + _logger->info() << "Reading phase space file (AqueousNaClGenerator)." << std::endl; int numMoleculesPerDimension = round(pow((double) _numMolecules, 1./3.)); int numIons = round(0.01812415 * (double) _numMolecules); - _logger->info() << "Generating " << numIons << " of Na+ and Cl-" << endl; + _logger->info() << "Generating " << numIons << " of Na+ and Cl-" << std::endl; Ion* ions = new Ion[2 * numIons]; for (int i = 0; i < numIons; i++) { ions[i].cid = 1; @@ -139,9 +139,9 @@ unsigned long AqueousNaClGenerator::readPhaseSpace(ParticleContainer* particleCo for (int j = 0; j < 3; j++) { ions[i].position[j] = (double) rand() / ((double) RAND_MAX) * (numMoleculesPerDimension-1); } - std::cout << "Testing " << ions[i].position[0] << "," << ions[i].position[1] << "," << ions[i].position[2] << endl; + std::cout << "Testing " << ions[i].position[0] << "," << ions[i].position[1] << "," << ions[i].position[2] << std::endl; } while (isNearIon(ions, i)); - std::cout << "Generate Na+ at " << ions[i].position[0] << "," << ions[i].position[1] << "," << ions[i].position[2] << ";" << endl; + std::cout << "Generate Na+ at " << ions[i].position[0] << "," << ions[i].position[1] << "," << ions[i].position[2] << ";" << std::endl; } for (int i = numIons; i < 2*numIons; i++) { ions[i].cid = 2; @@ -149,14 +149,14 @@ unsigned long AqueousNaClGenerator::readPhaseSpace(ParticleContainer* particleCo for (int j = 0; j < 3; j++) { ions[i].position[j] = (double) rand() / ((double) RAND_MAX) * (numMoleculesPerDimension-1); } - std::cout << "Testing " << ions[i].position[0] << "," << ions[i].position[1] << "," << ions[i].position[2] << endl; + std::cout << "Testing " << ions[i].position[0] << "," << ions[i].position[1] << "," << ions[i].position[2] << std::endl; } while (isNearIon(ions, i)); - std::cout << "Generate Na+ at " << ions[i].position[0] << "," << ions[i].position[1] << "," << ions[i].position[2] << ";" << endl; + std::cout << "Generate Na+ at " << ions[i].position[0] << "," << ions[i].position[1] << "," << ions[i].position[2] << ";" << std::endl; } unsigned long int id = 1; double spacing = _simBoxLength / numMoleculesPerDimension; - _logger->info() << "SimBoxLength=" << _simBoxLength << " spacing=" << spacing << endl; + _logger->info() << "SimBoxLength=" << _simBoxLength << " spacing=" << spacing << std::endl; double origin = spacing / 2.; // origin of the first DrawableMolecule // only for console output @@ -182,24 +182,24 @@ unsigned long AqueousNaClGenerator::readPhaseSpace(ParticleContainer* particleCo } percentageRead = i * percentage; - _logger->info() << "Finished reading molecules: " << (percentageRead) << "%\r" << flush; + _logger->info() << "Finished reading molecules: " << (percentageRead) << "%\r" << std::flush; } delete[] ions; removeMomentum(particleContainer, _components); domain->evaluateRho(particleContainer->getNumberOfParticles(), domainDecomp); - _logger->info() << "Calculated Rho=" << domain->getglobalRho() << endl; + _logger->info() << "Calculated Rho=" << domain->getglobalRho() << std::endl; global_simulation->timers()->stop("AQUEOUS_NA_CL_GENERATOR_INPUT"); global_simulation->timers()->setOutputString("AQUEOUS_NA_CL_GENERATOR_INPUT", "Initial IO took: "); - _logger->info() << "Initial IO took: " << global_simulation->timers()->getTime("AQUEOUS_NA_CL_GENERATOR_INPUT") << " sec" << endl; + _logger->info() << "Initial IO took: " << global_simulation->timers()->getTime("AQUEOUS_NA_CL_GENERATOR_INPUT") << " sec" << std::endl; return id; } void AqueousNaClGenerator::addMolecule(double x, double y, double z, unsigned long id, int cid, ParticleContainer* particleContainer) { - std::cout << "Add molecule at " << x << ", " << y << ", " << z << " with cid=" << cid << endl; + std::cout << "Add molecule at " << x << ", " << y << ", " << z << " with cid=" << cid << std::endl; - vector velocity = getRandomVelocity(_temperature); + std::vector velocity = getRandomVelocity(_temperature); //double orientation[4] = {1, 0, 0, 0}; // default: in the xy plane // rotate by 30° along the vector (1/1/0), i.e. the angle bisector of x and y axis @@ -257,19 +257,19 @@ bool AqueousNaClGenerator::validateParameters() { if (_configuration.getScenarioName() == "") { valid = false; - _logger->error() << "ScenarioName not set!" << endl; + _logger->error() << "ScenarioName not set!" << std::endl; } if (_configuration.getOutputFormat() == MardynConfiguration::XML) { valid = false; - _logger->error() << "OutputFormat XML not yet supported!" << endl; + _logger->error() << "OutputFormat XML not yet supported!" << std::endl; } if (_simBoxLength < 2. * _configuration.getCutoffRadius()) { valid = false; - _logger->error() << "Cutoff radius is too big (there would be only 1 cell in the domain!)" << endl; + _logger->error() << "Cutoff radius is too big (there would be only 1 cell in the domain!)" << std::endl; _logger->error() << "Cutoff radius=" << _configuration.getCutoffRadius() - << " domain size=" << _simBoxLength << endl; + << " domain size=" << _simBoxLength << std::endl; } return valid; } diff --git a/tools/gui/generators/CrystalLatticeGenerator.cpp b/tools/gui/generators/CrystalLatticeGenerator.cpp index b006d15268..afc84f5104 100644 --- a/tools/gui/generators/CrystalLatticeGenerator.cpp +++ b/tools/gui/generators/CrystalLatticeGenerator.cpp @@ -37,8 +37,8 @@ CrystalLatticeGenerator::CrystalLatticeGenerator() : calculateSimulationBoxLength(); } -vector CrystalLatticeGenerator::getParameters() { - vector parameters; +std::vector CrystalLatticeGenerator::getParameters() { + std::vector parameters; parameters.push_back(new MardynConfigurationParameters(_configuration)); ParameterCollection* tab = new ParameterCollection("CrystalLatticeParameters", "Parameters of CrystalLatticeGenerator", @@ -63,7 +63,7 @@ vector CrystalLatticeGenerator::getParameters() { void CrystalLatticeGenerator::setParameter(Parameter* p) { - string id = p->getNameId(); + std::string id = p->getNameId(); if (id == "numMolecules") { _numMoleculesPerDim = static_cast (p)->getValue(); calculateSimulationBoxLength(); @@ -89,7 +89,7 @@ void CrystalLatticeGenerator::calculateSimulationBoxLength() { void CrystalLatticeGenerator::readPhaseSpaceHeader(Domain* domain, double timestep) { - _logger->info() << "Reading PhaseSpaceHeader from CubicGridGenerator..." << endl; + _logger->info() << "Reading PhaseSpaceHeader from CubicGridGenerator..." << std::endl; //domain->setCurrentTime(0); domain->disableComponentwiseThermostat(); @@ -99,7 +99,7 @@ void CrystalLatticeGenerator::readPhaseSpaceHeader(Domain* domain, double timest domain->setGlobalLength(2, _simBoxLength); domain->setepsilonRF(1e+10); - _logger->info() << "Reading PhaseSpaceHeader from CubicGridGenerator done." << endl; + _logger->info() << "Reading PhaseSpaceHeader from CubicGridGenerator done." << std::endl; /* silence compiler warnings */ (void) timestep; @@ -112,7 +112,7 @@ unsigned long CrystalLatticeGenerator::readPhaseSpace(ParticleContainer* particl Domain* domain, DomainDecompBase* domainDecomp) { global_simulation->timers()->start("CRYSTAL_LATTICE_GENERATOR_INPUT"); - _logger->info() << "Reading phase space file (CubicGridGenerator)." << endl; + _logger->info() << "Reading phase space file (CubicGridGenerator)." << std::endl; unsigned long int id = 1; double spacing = _simBoxLength / _numMoleculesPerDim; @@ -161,14 +161,14 @@ unsigned long CrystalLatticeGenerator::readPhaseSpace(ParticleContainer* particl } percentageRead = i * percentage; - _logger->info() << "Finished reading molecules: " << (percentageRead) << "%\r" << flush; + _logger->info() << "Finished reading molecules: " << (percentageRead) << "%\r" << std::flush; } domain->evaluateRho(particleContainer->getNumberOfParticles(), domainDecomp); - _logger->info() << "Calculated Rho=" << domain->getglobalRho() << endl; + _logger->info() << "Calculated Rho=" << domain->getglobalRho() << std::endl; global_simulation->timers()->stop("CRYSTAL_LATTICE_GENERATOR_INPUT"); global_simulation->timers()->setOutputString("CRYSTAL_LATTICE_GENERATOR_INPUT", "Initial IO took: "); - _logger->info() << "Initial IO took: " << global_simulation->timers()->getTime("CRYSTAL_LATTICE_GENERATOR_INPUT") << " sec" << endl; + _logger->info() << "Initial IO took: " << global_simulation->timers()->getTime("CRYSTAL_LATTICE_GENERATOR_INPUT") << " sec" << std::endl; return id; } @@ -189,24 +189,24 @@ bool CrystalLatticeGenerator::validateParameters() { if (_configuration.getScenarioName() == "") { valid = false; - _logger->error() << "ScenarioName not set!" << endl; + _logger->error() << "ScenarioName not set!" << std::endl; } if (_configuration.getOutputFormat() == MardynConfiguration::XML) { valid = false; - _logger->error() << "OutputFormat XML not yet supported!" << endl; + _logger->error() << "OutputFormat XML not yet supported!" << std::endl; } if (_simBoxLength < 2. * _configuration.getCutoffRadius()) { valid = false; - _logger->error() << "Cutoff radius is too big (there would be only 1 cell in the domain!)" << endl; + _logger->error() << "Cutoff radius is too big (there would be only 1 cell in the domain!)" << std::endl; _logger->error() << "Cutoff radius=" << _configuration.getCutoffRadius() - << " domain size=" << _simBoxLength << endl; + << " domain size=" << _simBoxLength << std::endl; } if (_numMoleculesPerDim % 2) { valid = false; - _logger->error() << "Number of molecules per dimension must be even!" << endl; + _logger->error() << "Number of molecules per dimension must be even!" << std::endl; } return valid; } diff --git a/tools/gui/generators/CubicGridGenerator.cpp b/tools/gui/generators/CubicGridGenerator.cpp index bd29d309e0..4f425f7aca 100644 --- a/tools/gui/generators/CubicGridGenerator.cpp +++ b/tools/gui/generators/CubicGridGenerator.cpp @@ -38,8 +38,8 @@ CubicGridGenerator::CubicGridGenerator() : calculateSimulationBoxLength(); } -vector CubicGridGenerator::getParameters() { - vector parameters; +std::vector CubicGridGenerator::getParameters() { + std::vector parameters; parameters.push_back(new MardynConfigurationParameters(_configuration)); ParameterCollection* tab = new ParameterCollection("EqvGridParameters", "Parameters of EqvGridGenerator", @@ -75,7 +75,7 @@ vector CubicGridGenerator::getParameters() { void CubicGridGenerator::setParameter(Parameter* p) { - string id = p->getNameId(); + std::string id = p->getNameId(); if (id == "numMolecules") { _numMolecules = static_cast (p)->getValue(); calculateSimulationBoxLength(); @@ -117,7 +117,7 @@ void CubicGridGenerator::calculateSimulationBoxLength() { void CubicGridGenerator::readPhaseSpaceHeader(Domain* domain, double timestep) { - _logger->info() << "Reading PhaseSpaceHeader from CubicGridGenerator..." << endl; + _logger->info() << "Reading PhaseSpaceHeader from CubicGridGenerator..." << std::endl; global_simulation->setSimulationTime(0); domain->disableComponentwiseThermostat(); @@ -134,7 +134,7 @@ void CubicGridGenerator::readPhaseSpaceHeader(Domain* domain, double timestep) { global_simulation->getEnsemble()->setComponentLookUpIDs(); domain->setepsilonRF(1e+10); - _logger->info() << "Reading PhaseSpaceHeader from CubicGridGenerator done." << endl; + _logger->info() << "Reading PhaseSpaceHeader from CubicGridGenerator done." << std::endl; /* silence compiler warnings */ (void) timestep; @@ -145,7 +145,7 @@ unsigned long CubicGridGenerator::readPhaseSpace(ParticleContainer* particleCont Domain* domain, DomainDecompBase* domainDecomp) { global_simulation->timers()->start("CUBIC_GRID_GENERATOR_INPUT"); - _logger->info() << "Reading phase space file (CubicGridGenerator)." << endl; + _logger->info() << "Reading phase space file (CubicGridGenerator)." << std::endl; // create a body centered cubic layout, by creating by placing the molecules on the // vertices of a regular grid, then shifting that grid by spacing/2 in all dimensions. @@ -186,7 +186,7 @@ unsigned long CubicGridGenerator::readPhaseSpace(ParticleContainer* particleCont } if ((int)(i * percentage) > percentageRead) { percentageRead = i * percentage; - _logger->info() << "Finished reading molecules: " << (percentageRead) << "%\r" << flush; + _logger->info() << "Finished reading molecules: " << (percentageRead) << "%\r" << std::flush; } } @@ -206,7 +206,7 @@ unsigned long CubicGridGenerator::readPhaseSpace(ParticleContainer* particleCont } if ((int)(50 + i * percentage) > percentageRead) { percentageRead = 50 + i * percentage; - _logger->info() << "Finished reading molecules: " << (percentageRead) << "%\r" << flush; + _logger->info() << "Finished reading molecules: " << (percentageRead) << "%\r" << std::flush; } } _logger->info() << std::endl; @@ -225,17 +225,17 @@ unsigned long CubicGridGenerator::readPhaseSpace(ParticleContainer* particleCont removeMomentum(particleContainer, _components); domain->evaluateRho(particleContainer->getNumberOfParticles(), domainDecomp); - _logger->info() << "Calculated Rho=" << domain->getglobalRho() << endl; + _logger->info() << "Calculated Rho=" << domain->getglobalRho() << std::endl; global_simulation->timers()->stop("CUBIC_GRID_GENERATOR_INPUT"); global_simulation->timers()->setOutputString("CUBIC_GRID_GENERATOR_INPUT", "Initial IO took: "); - _logger->info() << "Initial IO took: " << global_simulation->timers()->getTime("CUBIC_GRID_GENERATOR_INPUT") << " sec" << endl; + _logger->info() << "Initial IO took: " << global_simulation->timers()->getTime("CUBIC_GRID_GENERATOR_INPUT") << " sec" << std::endl; return id + idOffset; } void CubicGridGenerator::addMolecule(double x, double y, double z, unsigned long id, ParticleContainer* particleContainer) { - vector velocity = getRandomVelocity(_temperature); + std::vector velocity = getRandomVelocity(_temperature); //double orientation[4] = {1, 0, 0, 0}; // default: in the xy plane // rotate by 30° along the vector (1/1/0), i.e. the angle bisector of x and y axis @@ -277,19 +277,19 @@ bool CubicGridGenerator::validateParameters() { if (_configuration.getScenarioName() == "") { valid = false; - _logger->error() << "ScenarioName not set!" << endl; + _logger->error() << "ScenarioName not set!" << std::endl; } if (_configuration.getOutputFormat() == MardynConfiguration::XML) { valid = false; - _logger->error() << "OutputFormat XML not yet supported!" << endl; + _logger->error() << "OutputFormat XML not yet supported!" << std::endl; } if (_simBoxLength < 2. * _configuration.getCutoffRadius()) { valid = false; - _logger->error() << "Cutoff radius is too big (there would be only 1 cell in the domain!)" << endl; + _logger->error() << "Cutoff radius is too big (there would be only 1 cell in the domain!)" << std::endl; _logger->error() << "Cutoff radius=" << _configuration.getCutoffRadius() - << " domain size=" << _simBoxLength << endl; + << " domain size=" << _simBoxLength << std::endl; } return valid; } diff --git a/tools/gui/generators/DropletGenerator.cpp b/tools/gui/generators/DropletGenerator.cpp index 62b1b76c21..84a709c05a 100644 --- a/tools/gui/generators/DropletGenerator.cpp +++ b/tools/gui/generators/DropletGenerator.cpp @@ -73,10 +73,10 @@ void DropletGenerator::readPhaseSpaceHeader(Domain* domain, double /*timestep*/) domain->setGlobalLength(0, simBoxLength[0]); domain->setGlobalLength(1, simBoxLength[1]); domain->setGlobalLength(2, simBoxLength[2]); - vector& dcomponents = *(global_simulation->getEnsemble()->getComponents()); + std::vector& dcomponents = *(global_simulation->getEnsemble()->getComponents()); _logger->debug() << "DropletGenerator: set global length=[" << simBoxLength[0] - << "," << simBoxLength[1] << "," << simBoxLength[2] << "]" << endl; + << "," << simBoxLength[1] << "," << simBoxLength[2] << "]" << std::endl; if (_configuration.performPrincipalAxisTransformation()) { for (unsigned int i = 0; i < _components.size(); i++) { @@ -94,11 +94,11 @@ unsigned long DropletGenerator::readPhaseSpace( DomainDecompBase* domainDecomp) { global_simulation->timers()->start("DROPLET_GENERATOR_INPUT"); - _logger->info() << "Reading phase space file (DropletGenerator)." << endl; + _logger->info() << "Reading phase space file (DropletGenerator)." << std::endl; srand(1); - vector bBoxMin; - vector bBoxMax; + std::vector bBoxMin; + std::vector bBoxMax; bBoxMin.resize(3); bBoxMax.resize(3); @@ -110,17 +110,17 @@ unsigned long DropletGenerator::readPhaseSpace( _logger->info() << "OneCLJGenerator generating cluster distribution. " << " T " << _temperature << " #molecules " << numOfMolecules << " rho_gas " - << gasDensity << " rho_fluid " << fluidDensity << endl; + << gasDensity << " rho_fluid " << fluidDensity << std::endl; unsigned long maxID = generateMoleculesCluster(particleContainer, bBoxMin, bBoxMax, domain, domainDecomp); - vector partsPerComp; + std::vector partsPerComp; partsPerComp.resize(1); particleContainer->update(); particleContainer->deleteOuterParticles(); domain->setglobalNumMolecules( countMolecules(domainDecomp, particleContainer, partsPerComp)); - vector& dcomponents = *(global_simulation->getEnsemble()->getComponents()); + std::vector& dcomponents = *(global_simulation->getEnsemble()->getComponents()); for (unsigned int i = 0; i < partsPerComp.size(); i++) { dcomponents[i].setNumMolecules(partsPerComp[i]); domain->setglobalRotDOF( @@ -135,7 +135,7 @@ unsigned long DropletGenerator::readPhaseSpace( global_simulation->timers()->stop("DROPLET_GENERATOR_INPUT"); global_simulation->timers()->setOutputString("DROPLET_GENERATOR_INPUT", "Initial IO took: "); - _logger->info() << "Initial IO took: " << global_simulation->timers()->getTime("DROPLET_GENERATOR_INPUT") << " sec" << endl; + _logger->info() << "Initial IO took: " << global_simulation->timers()->getTime("DROPLET_GENERATOR_INPUT") << " sec" << std::endl; return maxID; } @@ -145,11 +145,11 @@ void DropletGenerator::readLocalClusters(Domain* domain, localClusters.clear(); DropletPlacement dropletPlacement(fluidVolume, maxSphereVolume, numSphereSizes, _logger); - vector droplets = + std::vector droplets = dropletPlacement.generateDroplets(); - vector shiftedSphere; - vector sphere; + std::vector shiftedSphere; + std::vector sphere; double distanceToDomain; sphere.resize(4); // x y z r shiftedSphere.resize(4); // x y z r @@ -220,8 +220,8 @@ bool DropletGenerator::closeToAnyCluster(double x, double y, double z, return belongsToOther; } -vector DropletGenerator::getParameters() { - vector parameters; +std::vector DropletGenerator::getParameters() { + std::vector parameters; parameters.push_back(new MardynConfigurationParameters(_configuration)); ParameterCollection* tab = new ParameterCollection("DropletGenerator", "DropletGenerator", @@ -259,17 +259,17 @@ vector DropletGenerator::getParameters() { unsigned long DropletGenerator::generateMoleculesCluster( - ParticleContainer* particleContainer, vector &bBoxMin, - vector &bBoxMax, Domain* domain, DomainDecompBase* domainDecomp) { + ParticleContainer* particleContainer, std::vector &bBoxMin, + std::vector &bBoxMax, Domain* domain, DomainDecompBase* domainDecomp) { readLocalClusters(domain, domainDecomp); _components[0].updateMassInertia(); - vector globalFccCells; - vector clusterFccCellsMin; - vector clusterFccCellsMax; - vector fccCellLength; + std::vector globalFccCells; + std::vector clusterFccCellsMin; + std::vector clusterFccCellsMax; + std::vector fccCellLength; globalFccCells.resize(3); clusterFccCellsMin.resize(3); @@ -282,7 +282,7 @@ unsigned long DropletGenerator::generateMoleculesCluster( pow(fluidDensity / 4., 1. / 3.) * simBoxLength[dim]); fccCellLength[dim] = simBoxLength[dim] / globalFccCells[dim]; } - vector > fccOffsets; + std::vector > fccOffsets; fccOffsets.resize(4); for (int i = 0; i < 4; i++) { fccOffsets[i].resize(3); @@ -299,7 +299,7 @@ unsigned long DropletGenerator::generateMoleculesCluster( double securityOffset = 0.5 * fccCellLength[0]; - vector clusterPos; + std::vector clusterPos; clusterPos.resize(3); double radius; @@ -367,7 +367,7 @@ unsigned long DropletGenerator::generateMoleculesCluster( } getFCCOrientation(fcc, q_); - vector v = getRandomVelocity(_temperature); + std::vector v = getRandomVelocity(_temperature); Molecule m(molCount, &_components[0], r_[0], r_[1], r_[2], v[0], v[1], v[2], q_[0], q_[1], q_[2], q_[3], w[0], w[1], w[2]); if (particleContainer->isInBoundingBox(m.r_arr().data())) { @@ -383,8 +383,8 @@ unsigned long DropletGenerator::generateMoleculesCluster( } // gas properties - vector fccCellsMin; - vector fccCellsMax; + std::vector fccCellsMin; + std::vector fccCellsMax; fccCellsMin.resize(3); fccCellsMax.resize(3); @@ -441,7 +441,7 @@ unsigned long DropletGenerator::generateMoleculesCluster( } getFCCOrientation(fcc, q_); - vector v = getRandomVelocity(_temperature); + std::vector v = getRandomVelocity(_temperature); Molecule m(molCount, &_components[0], r_[0], r_[1], r_[2], v[0], v[1], v[2], q_[0], q_[1], q_[2], q_[3], w[0], w[1], w[2]); if (particleContainer->isInBoundingBox(m.r_arr().data())) { @@ -459,39 +459,39 @@ unsigned long DropletGenerator::generateMoleculesCluster( void DropletGenerator::setParameter(Parameter* p) { - string id = p->getNameId(); + std::string id = p->getNameId(); if (id == "fluidDensity") { fluidDensity = static_cast (p)->getValue(); - cout << "OneCenterLJDroplet: fluidDensity: " << fluidDensity << endl; + std::cout << "OneCenterLJDroplet: fluidDensity: " << fluidDensity << std::endl; setClusterParameters(gasDensity, fluidDensity, fluidVolume, maxSphereVolume, numSphereSizes); } else if (id == "gasDensity") { gasDensity = static_cast (p)->getValue(); - cout << "OneCenterLJDroplet: gasDensity: " << gasDensity << endl; + std::cout << "OneCenterLJDroplet: gasDensity: " << gasDensity << std::endl; setClusterParameters(gasDensity, fluidDensity, fluidVolume, maxSphereVolume, numSphereSizes); } else if (id == "numOfMolecules") { numOfMolecules = static_cast (p)->getValue(); - cout << "OneCenterLJDroplet: numOfMolecules: " << numOfMolecules - << endl; + std::cout << "OneCenterLJDroplet: numOfMolecules: " << numOfMolecules + << std::endl; setClusterParameters(gasDensity, fluidDensity, fluidVolume, maxSphereVolume, numSphereSizes); } else if (id == "fluidVolume") { fluidVolume = static_cast (p)->getValue(); - cout << "OneCenterLJDroplet: fluidVolume: " << fluidVolume << endl; + std::cout << "OneCenterLJDroplet: fluidVolume: " << fluidVolume << std::endl; setClusterParameters(gasDensity, fluidDensity, fluidVolume, maxSphereVolume, numSphereSizes); } else if (id == "maxSphereVolume") { maxSphereVolume = static_cast (p)->getValue(); - cout << "OneCenterLJDroplet: maxSphereVolume: " << maxSphereVolume - << endl; + std::cout << "OneCenterLJDroplet: maxSphereVolume: " << maxSphereVolume + << std::endl; setClusterParameters(gasDensity, fluidDensity, fluidVolume, maxSphereVolume, numSphereSizes); } else if (id == "numSphereSizes") { numSphereSizes = static_cast (p)->getValue(); - cout << "OneCenterLJDroplet: numSphereSizes: " << numSphereSizes - << endl; + std::cout << "OneCenterLJDroplet: numSphereSizes: " << numSphereSizes + << std::endl; setClusterParameters(gasDensity, fluidDensity, fluidVolume, maxSphereVolume, numSphereSizes); } else if (id == "temperature") { @@ -503,7 +503,7 @@ void DropletGenerator::setParameter(Parameter* p) { std::string part = remainingSubString(".", id); MardynConfigurationParameters::setParameterValue(_configuration, p, part); } else { - std::cout << "UNKOWN Parameter: id = " << p->getNameId() << " value= " << p->getStringValue() << endl; + std::cout << "UNKOWN Parameter: id = " << p->getNameId() << " value= " << p->getStringValue() << std::endl; exit(-1); } } @@ -513,20 +513,20 @@ bool DropletGenerator::validateParameters() { if (_configuration.getScenarioName() == "") { valid = false; - _logger->error() << "ScenarioName not set!" << endl; + _logger->error() << "ScenarioName not set!" << std::endl; } if (_configuration.getOutputFormat() == MardynConfiguration::XML) { valid = false; - _logger->error() << "OutputFormat XML not yet supported!" << endl; + _logger->error() << "OutputFormat XML not yet supported!" << std::endl; } for (int i = 0; i < 3; i++) { if (simBoxLength[i] < 2.0 * _configuration.getCutoffRadius()) { valid = false; - _logger->error() << "Cutoff radius is too big (there would be only 1 cell in the domain!)" << endl; + _logger->error() << "Cutoff radius is too big (there would be only 1 cell in the domain!)" << std::endl; _logger->error() << "Cutoff radius=" << _configuration.getCutoffRadius() - << " domain size=" << simBoxLength[i] << endl; + << " domain size=" << simBoxLength[i] << std::endl; } } @@ -562,7 +562,7 @@ void DropletGenerator::getFCCOrientation(int q_type, double q[4]) { } -unsigned long DropletGenerator::countMolecules(DomainDecompBase* domainDecomp, ParticleContainer* moleculeContainer, vector &compCount) { +unsigned long DropletGenerator::countMolecules(DomainDecompBase* domainDecomp, ParticleContainer* moleculeContainer, std::vector &compCount) { const int numComponents = compCount.size(); unsigned long* localCompCount = new unsigned long[numComponents]; unsigned long* globalCompCount = new unsigned long[numComponents]; diff --git a/tools/gui/generators/DropletGenerator.h b/tools/gui/generators/DropletGenerator.h index c3b8fe1491..6161379769 100644 --- a/tools/gui/generators/DropletGenerator.h +++ b/tools/gui/generators/DropletGenerator.h @@ -6,7 +6,6 @@ */ class Domain; -using namespace std; #include "MDGenerator.h" #include "common/ComponentParameters.h" @@ -31,7 +30,7 @@ class DropletGenerator: public MDGenerator { double simBoxLength[3]; //! @brief each element is a sphere (vector containing x,y,z and r) - vector > localClusters; + std::vector > localClusters; public: DropletGenerator(); @@ -66,7 +65,7 @@ class DropletGenerator: public MDGenerator { * @return the highest id of a molecule generated. */ unsigned long generateMoleculesCluster(ParticleContainer* particleContainer, - vector &bBoxMin, vector &bBoxMax, Domain* domain, + std::vector &bBoxMin, std::vector &bBoxMax, Domain* domain, DomainDecompBase* domainDecomp); //Domain* domain,DomainDecompBase* domainDecomp); @@ -143,7 +142,7 @@ class DropletGenerator: public MDGenerator { Domain* domain, DomainDecompBase* domainDecomp); - vector getParameters(); + std::vector getParameters(); //void generatePreview(); diff --git a/tools/gui/generators/MDGenerator.cpp b/tools/gui/generators/MDGenerator.cpp index 4ae8434e11..44f0bc564b 100644 --- a/tools/gui/generators/MDGenerator.cpp +++ b/tools/gui/generators/MDGenerator.cpp @@ -97,13 +97,13 @@ void MDGenerator::generatePreview() { _logger->info() << "MDGenerator: bounding box of domain is [" << bBoxMin[0] << "," << bBoxMin[1] << "," << bBoxMin[2] << "] to [" - << bBoxMax[0] << "," << bBoxMax[1] << "," << bBoxMax[2] << "]" << endl; - _logger->info() << "MDGenerator: temperature=" << domain.getTargetTemperature(0) << endl; + << bBoxMax[0] << "," << bBoxMax[1] << "," << bBoxMax[2] << "]" << std::endl; + _logger->info() << "MDGenerator: temperature=" << domain.getTargetTemperature(0) << std::endl; LinkedCells container(bBoxMin, bBoxMax, cutoffRadius); readPhaseSpace(&container, &domain, &domainDecomposition); - _logger->info() << "MDGenerator: " << container.getNumberOfParticles() << " particles were created." << endl; + _logger->info() << "MDGenerator: " << container.getNumberOfParticles() << " particles were created." << std::endl; auto molecule = container.iterator(ParticleIterator::ALL_CELLS); while (molecule.isValid()) { @@ -117,19 +117,19 @@ void MDGenerator::generatePreview() { void MDGenerator::generateOutput(const std::string& directory) { srand(1); - std::cout << "MDGenerator::generateOutput called!" << endl; + std::cout << "MDGenerator::generateOutput called!" << std::endl; if (_configuration.getOutputFormat() == MardynConfiguration::LEGACY) { MardynConfigLegacyWriter::writeConfigFile(directory, _configuration.getScenarioName() + ".cfg", _configuration); } else if (_configuration.getOutputFormat() == MardynConfiguration::XML) { - _logger->error() << "XML Output not yet supported!" << endl; - _logger->error() << "Generating nothing!" << endl; + _logger->error() << "XML Output not yet supported!" << std::endl; + _logger->error() << "Generating nothing!" << std::endl; return; } else { - _logger->error() << "Invalid File format for Output!" << _configuration.getOutputFormat() << endl; + _logger->error() << "Invalid File format for Output!" << _configuration.getOutputFormat() << std::endl; } - std::cout << "MDGenerator::config file written!" << endl; + std::cout << "MDGenerator::config file written!" << std::endl; int rank = 0; Domain domain(rank); DomainDecompBase domainDecomposition; @@ -143,21 +143,21 @@ void MDGenerator::generateOutput(const std::string& directory) { double bBoxMax[3] = { 0,0,0}; double cutoffRadius = 3.0; - std::cout << "MDGenerator::generateOutput before read phasespace header!" << endl; + std::cout << "MDGenerator::generateOutput before read phasespace header!" << std::endl; readPhaseSpaceHeader(&domain, 0); - std::cout << "MDGenerator::generateOutput after read phasespace header!" << endl; + std::cout << "MDGenerator::generateOutput after read phasespace header!" << std::endl; bBoxMax[0] = domain.getGlobalLength(0); bBoxMax[1] = domain.getGlobalLength(1); bBoxMax[2] = domain.getGlobalLength(2); LinkedCells container(bBoxMin, bBoxMax, cutoffRadius); - std::cout << "MDGenerator::generateOutput before read phasespace!" << endl; + std::cout << "MDGenerator::generateOutput before read phasespace!" << std::endl; readPhaseSpace(&container, &domain, &domainDecomposition); - std::cout << "MDGenerator::generateOutput read phasespace done!" << endl; + std::cout << "MDGenerator::generateOutput read phasespace done!" << std::endl; domain.setglobalNumMolecules(container.getNumberOfParticles()); - std::cout << "NumMolecules in Container: " << container.getNumberOfParticles() << endl; + std::cout << "NumMolecules in Container: " << container.getNumberOfParticles() << std::endl; std::string destination = directory + "/" + _configuration.getScenarioName() + ".inp"; - _logger->info() << "Writing output to: " << destination << endl; + _logger->info() << "Writing output to: " << destination << std::endl; domain.writeCheckpoint(destination, &container, &domainDecomposition, 0.); #ifndef MARDYN @@ -166,7 +166,7 @@ void MDGenerator::generateOutput(const std::string& directory) { } std::vector MDGenerator::getRandomVelocity(double temperature) const { - vector v_; + std::vector v_; v_.resize(3); // Velocity diff --git a/tools/gui/generators/MS2RSTGenerator.cpp b/tools/gui/generators/MS2RSTGenerator.cpp index 80d20eddce..4e4990c97c 100644 --- a/tools/gui/generators/MS2RSTGenerator.cpp +++ b/tools/gui/generators/MS2RSTGenerator.cpp @@ -40,8 +40,8 @@ MS2RSTGenerator::MS2RSTGenerator() : _components[0].setID(0); } -vector MS2RSTGenerator::getParameters() { - vector parameters; +std::vector MS2RSTGenerator::getParameters() { + std::vector parameters; parameters.push_back(new MardynConfigurationParameters(_configuration)); ParameterCollection* tab = new ParameterCollection("MS2RSTParameters", "Parameters of MS2RSTGenerator", @@ -81,7 +81,7 @@ vector MS2RSTGenerator::getParameters() { void MS2RSTGenerator::setParameter(Parameter* p) { - string id = p->getNameId(); + std::string id = p->getNameId(); if (id == "numMolecules") { _numMolecules = static_cast (p)->getValue(); calculateSimulationBoxLength(); @@ -115,7 +115,7 @@ void MS2RSTGenerator::calculateSimulationBoxLength() { void MS2RSTGenerator::readPhaseSpaceHeader(Domain* domain, double timestep) { - _logger->info() << "Reading PhaseSpaceHeader from MS2RSTGenerator..." << endl; + _logger->info() << "Reading PhaseSpaceHeader from MS2RSTGenerator..." << std::endl; //domain->setCurrentTime(0); domain->disableComponentwiseThermostat(); @@ -131,7 +131,7 @@ void MS2RSTGenerator::readPhaseSpaceHeader(Domain* domain, double timestep) { } } domain->setepsilonRF(1e+10); - _logger->info() << "Reading PhaseSpaceHeader from MS2RSTGenerator done." << endl; + _logger->info() << "Reading PhaseSpaceHeader from MS2RSTGenerator done." << std::endl; /* silence compiler warnings */ (void) timestep; @@ -142,7 +142,7 @@ unsigned long MS2RSTGenerator::readPhaseSpace(ParticleContainer* particleContain Domain* domain, DomainDecompBase* domainDecomp) { global_simulation->timers()->start("MS2RST_GENERATOR_INPUT"); - _logger->info() << "Reading phase space file (MS2RSTGenerator)." << endl; + _logger->info() << "Reading phase space file (MS2RSTGenerator)." << std::endl; std::vector rotationDOF(1); rotationDOF[0] = _hasRotationalDOF; @@ -154,7 +154,7 @@ unsigned long MS2RSTGenerator::readPhaseSpace(ParticleContainer* particleContain for (int j = 0; j < 3; j++) { ms2mols[i].x[j] = ms2mols[i].x[j] * _ms2_to_angstroem * angstroem_2_atomicUnitLength; if (ms2mols[i].x[j] < 0 || ms2mols[i].x[j] > _simBoxLength) { - std::cout << "Error: molecule out of box: " << endl; + std::cout << "Error: molecule out of box: " << std::endl; ms2mols[i].print(cout); } } @@ -170,10 +170,10 @@ unsigned long MS2RSTGenerator::readPhaseSpace(ParticleContainer* particleContain thermostat(particleContainer); domain->evaluateRho(particleContainer->getNumberOfParticles(), domainDecomp); - _logger->info() << "Calculated Rho=" << domain->getglobalRho() << endl; + _logger->info() << "Calculated Rho=" << domain->getglobalRho() << std::endl; global_simulation->timers()->start("MS2RST_GENERATOR_INPUT"); global_simulation->timers()->setOutputString("MS2RST_GENERATOR_INPUT", "Initial IO took: "); - _logger->info() << "Initial IO took: " << global_simulation->timers()->getTime("MS2RST_GENERATOR_INPUT") << " sec" << endl; + _logger->info() << "Initial IO took: " << global_simulation->timers()->getTime("MS2RST_GENERATOR_INPUT") << " sec" << std::endl; return _numMolecules; } @@ -211,8 +211,8 @@ void MS2RSTGenerator::thermostat(ParticleContainer* container) { tM->scale_D(betaRot); } - _logger->info() << "Current Temperature: " << currentTemperature << ", target Temperature: " << _temperature << endl; - _logger->info() << " bTrans=" << betaTrans << ", bRot=" << betaRot << " #RotDOF=" << numberOfRotationalDOF << endl; + _logger->info() << "Current Temperature: " << currentTemperature << ", target Temperature: " << _temperature << std::endl; + _logger->info() << " bTrans=" << betaTrans << ", bRot=" << betaRot << " #RotDOF=" << numberOfRotationalDOF << std::endl; } @@ -222,19 +222,19 @@ bool MS2RSTGenerator::validateParameters() { if (_configuration.getScenarioName() == "") { valid = false; - _logger->error() << "ScenarioName not set!" << endl; + _logger->error() << "ScenarioName not set!" << std::endl; } if (_configuration.getOutputFormat() == MardynConfiguration::XML) { valid = false; - _logger->error() << "OutputFormat XML not yet supported!" << endl; + _logger->error() << "OutputFormat XML not yet supported!" << std::endl; } if (_simBoxLength < 2. * _configuration.getCutoffRadius()) { valid = false; - _logger->error() << "Cutoff radius is too big (there would be only 1 cell in the domain!)" << endl; + _logger->error() << "Cutoff radius is too big (there would be only 1 cell in the domain!)" << std::endl; _logger->error() << "Cutoff radius=" << _configuration.getCutoffRadius() - << " domain size=" << _simBoxLength << endl; + << " domain size=" << _simBoxLength << std::endl; } return valid; } diff --git a/tools/gui/generators/RayleighTaylorGenerator.cpp b/tools/gui/generators/RayleighTaylorGenerator.cpp index 479f7bc280..3527e103e1 100644 --- a/tools/gui/generators/RayleighTaylorGenerator.cpp +++ b/tools/gui/generators/RayleighTaylorGenerator.cpp @@ -85,7 +85,7 @@ unsigned long RayleighTaylorGenerator::readPhaseSpace(ParticleContainer* particl Domain* domain, DomainDecompBase* domainDecomp) { global_simulation->timers()->start("REYLEIGH_TAYLOR_GENERATOR_INPUT"); - _logger->info() << "Reading phase space file (RayleighTaylorGenerator)." << endl; + _logger->info() << "Reading phase space file (RayleighTaylorGenerator)." << std::endl; _components[0].updateMassInertia(); _components[1].updateMassInertia(); @@ -142,12 +142,12 @@ unsigned long RayleighTaylorGenerator::readPhaseSpace(ParticleContainer* particl domain->setglobalNumMolecules(globalNumMolecules); global_simulation->timers()->stop("REYLEIGH_TAYLOR_GENERATOR_INPUT"); global_simulation->timers()->setOutputString("REYLEIGH_TAYLOR_GENERATOR_INPUT", "Initial IO took: "); - _logger->info() << "Initial IO took: " << global_simulation->timers()->getTime("REYLEIGH_TAYLOR_GENERATOR_INPUT") << " sec" << endl; + _logger->info() << "Initial IO took: " << global_simulation->timers()->getTime("REYLEIGH_TAYLOR_GENERATOR_INPUT") << " sec" << std::endl; return id; } -vector RayleighTaylorGenerator::getParameters() { - vector parameters; +std::vector RayleighTaylorGenerator::getParameters() { + std::vector parameters; parameters.push_back(new MardynConfigurationParameters(_configuration)); ParameterCollection* tab = new ParameterCollection("RayleighTaylorGenerator", "RayleighTaylorGenerator", @@ -232,108 +232,108 @@ vector RayleighTaylorGenerator::getParameters() { //TODO:reference values! void RayleighTaylorGenerator::setParameter(Parameter* p) { - string id = p->getNameId(); + std::string id = p->getNameId(); if (id == "SimulationBoxSize(X)") { _L1 = static_cast (p)-> getValue() * (sigma_tilde * MDGenerator::angstroem_2_atomicUnitLength); - cout << "OneCenterLJRayleighTaylor: SimulationBoxSize(X): " + std::cout << "OneCenterLJRayleighTaylor: SimulationBoxSize(X): " << _L1 - << endl; + << std::endl; } else if (id == "SimulationBoxSize(Y)") { _L2 = static_cast (p)-> getValue() * (sigma_tilde * MDGenerator::angstroem_2_atomicUnitLength); - cout << "OneCenterLJRayleighTaylor: SimulationBoxSize(Y): " + std::cout << "OneCenterLJRayleighTaylor: SimulationBoxSize(Y): " << _L2 - << endl; + << std::endl; } else if (id == "SimulationBoxSize(Z)") { _L3 = static_cast (p)-> getValue() * (sigma_tilde * MDGenerator::angstroem_2_atomicUnitLength); - cout << "OneCenterLJRayleighTaylor: SimulationBoxSize(Z): " + std::cout << "OneCenterLJRayleighTaylor: SimulationBoxSize(Z): " << _L3 - << endl; + << std::endl; } else if (id == "NumOfParticlesAlongX") { _n_1 = static_cast (p)->getValue(); - cout << "OneCenterLJRayleighTaylor: NumOfParticlesAlongX: " << _n_1 - << endl; + std::cout << "OneCenterLJRayleighTaylor: NumOfParticlesAlongX: " << _n_1 + << std::endl; } else if (id == "NumOfParticlesAlongY") { _n_2 = static_cast (p)->getValue(); - cout << "OneCenterLJRayleighTaylor: NumOfParticlesAlongY: " << _n_2 - << endl; + std::cout << "OneCenterLJRayleighTaylor: NumOfParticlesAlongY: " << _n_2 + << std::endl; } else if (id == "NumOfParticlesAlongZ") { _n_3 = static_cast (p)->getValue(); - cout << "OneCenterLJRayleighTaylor: NumOfParticlesAlonZ: " << _n_3 - << endl; + std::cout << "OneCenterLJRayleighTaylor: NumOfParticlesAlonZ: " << _n_3 + << std::endl; } else if (id == "numSphereSizes") { numSphereSizes = static_cast (p)->getValue(); - cout << "OneCenterLJRayleighTaylor: numSphereSizes: " << numSphereSizes - << endl; + std::cout << "OneCenterLJRayleighTaylor: numSphereSizes: " << numSphereSizes + << std::endl; } else if (id == "Temperature") { _T = static_cast (p)->getValue()* (epsilon_tilde * MDGenerator::kelvin_2_mardyn / MDGenerator::boltzmann_constant_kB); - cout << "OneCenterLJRayleighTaylor: Temperature: " << _T - << endl; + std::cout << "OneCenterLJRayleighTaylor: Temperature: " << _T + << std::endl; } else if (id == "ComponentA.charge") { _q_A = static_cast (p)->getValue() * MDGenerator::unitCharge_2_mardyn; - cout << "OneCenterLJRayleighTaylor: ComponentB.charge: " << _q_A - << endl; + std::cout << "OneCenterLJRayleighTaylor: ComponentB.charge: " << _q_A + << std::endl; _components[0].deleteCharge(); _components[0].addCharge(0.,0.,0.,0.,_q_A); } else if (id == "ComponentB.charge") { _q_B = static_cast (p)->getValue(); - cout << "OneCenterLJRayleighTaylor: ComponentB.charge: " << _q_B - << endl; + std::cout << "OneCenterLJRayleighTaylor: ComponentB.charge: " << _q_B + << std::endl; _components[1].deleteCharge(); _components[1].addCharge(0.,0.,0.,0.,_q_B); } else if (id == "ComponentA.epsilon") { _epsilon_A = static_cast (p)->getValue(); - cout << "OneCenterLJRayleighTaylor: ComponentA.epsilon: " << _epsilon_A - << endl; + std::cout << "OneCenterLJRayleighTaylor: ComponentA.epsilon: " << _epsilon_A + << std::endl; _components[0].deleteLJCenter(); _components[0].addLJcenter(0, 0, 0,_m_A, _epsilon_A, _sigma_A, 0., false); } else if (id == "ComponentB.epsilon") { _epsilon_B = static_cast (p)->getValue(); - cout << "OneCenterLJRayleighTaylor: ComponentB.epsilon: " << _epsilon_B - << endl; + std::cout << "OneCenterLJRayleighTaylor: ComponentB.epsilon: " << _epsilon_B + << std::endl; _components[1].deleteLJCenter(); _components[1].addLJcenter(0, 0, 0,_m_B, _epsilon_B, _sigma_B, 0., false); } else if (id == "ComponentA.sigma") { _sigma_A = static_cast (p)->getValue(); - cout << "OneCenterLJRayleighTaylor: ComponentA.sigma: " << _sigma_A - << endl; + std::cout << "OneCenterLJRayleighTaylor: ComponentA.sigma: " << _sigma_A + << std::endl; _components[0].deleteLJCenter(); _components[0].addLJcenter(0, 0, 0,_m_A, _epsilon_A, _sigma_A, 0., false); } else if (id == "ComponentB.sigma") { _sigma_B = static_cast (p)->getValue(); - cout << "OneCenterLJRayleighTaylor: ComponentB.sigma: " << _sigma_B - << endl; + std::cout << "OneCenterLJRayleighTaylor: ComponentB.sigma: " << _sigma_B + << std::endl; _components[1].deleteLJCenter(); _components[1].addLJcenter(0, 0, 0,_m_B, _epsilon_B, _sigma_B, 0., false); } else if (id == "ComponentA.mass") { _m_A = static_cast (p)->getValue(); - cout << "OneCenterLJRayleighTaylor: ComponentA.mass: " << _m_A - << endl; + std::cout << "OneCenterLJRayleighTaylor: ComponentA.mass: " << _m_A + << std::endl; _components[0].deleteLJCenter(); _components[0].addLJcenter(0, 0, 0,_m_A, _epsilon_A, _sigma_A, 0., false); } else if (id == "ComponentB.mass") { _m_B = static_cast (p)->getValue() * (m_tilde * MDGenerator::unitMass_2_mardyn); - cout << "OneCenterLJRayleighTaylor: ComponentB.mass: " << _m_B - << endl; + std::cout << "OneCenterLJRayleighTaylor: ComponentB.mass: " << _m_B + << std::endl; _components[1].deleteLJCenter(); _components[1].addLJcenter(0, 0, 0,_m_B, _epsilon_B, _sigma_B, 0., false); @@ -342,14 +342,14 @@ void RayleighTaylorGenerator::setParameter(Parameter* p) { MardynConfigurationParameters::setParameterValue(_configuration, p, part); } else { - std::cout << "UNKOWN Parameter: id = " << p->getNameId() << " value= " << p->getStringValue() << endl; + std::cout << "UNKOWN Parameter: id = " << p->getNameId() << " value= " << p->getStringValue() << std::endl; exit(-1); } } void RayleighTaylorGenerator::addMolecule( double x, double y, double z, unsigned long id, int componentType, ParticleContainer* particleContainer) { - vector velocity = getRandomVelocity(_T); + std::vector velocity = getRandomVelocity(_T); //double orientation[4] = {1, 0, 0, 0}; // default: in the xy plane // rotate by 30° along the vector (1/1/0), i.e. the angle bisector of x and y axis @@ -386,12 +386,12 @@ bool RayleighTaylorGenerator::validateParameters() { if (_configuration.getScenarioName() == "") { valid = false; - _logger->error() << "ScenarioName not set!" << endl; + _logger->error() << "ScenarioName not set!" << std::endl; } if (_configuration.getOutputFormat() == MardynConfiguration::XML) { valid = false; - _logger->error() << "OutputFormat XML not yet supported!" << endl; + _logger->error() << "OutputFormat XML not yet supported!" << std::endl; } double L[3]; @@ -403,9 +403,9 @@ bool RayleighTaylorGenerator::validateParameters() { if (L[i] < 2.0 * _configuration.getCutoffRadius()) { valid = false; _logger->error() - << "Cutoff radius is too big (there would be only 1 cell in the domain!)" << endl; + << "Cutoff radius is too big (there would be only 1 cell in the domain!)" << std::endl; _logger->error() << "Cutoff radius=" - << _configuration.getCutoffRadius() << " domain size=" << L[i] << endl; + << _configuration.getCutoffRadius() << " domain size=" << L[i] << std::endl; } } diff --git a/tools/gui/generators/RayleighTaylorGenerator.h b/tools/gui/generators/RayleighTaylorGenerator.h index 54c0c48684..8b6f78035a 100644 --- a/tools/gui/generators/RayleighTaylorGenerator.h +++ b/tools/gui/generators/RayleighTaylorGenerator.h @@ -12,7 +12,6 @@ */ class Domain; -using namespace std; #include "MDGenerator.h" #include "common/ComponentParameters.h" @@ -60,7 +59,7 @@ class RayleighTaylorGenerator: public MDGenerator { RayleighTaylorGenerator(); virtual ~RayleighTaylorGenerator(); - vector getParameters(); + std::vector getParameters(); void setParameter(Parameter* p); diff --git a/tools/gui/generators/common/ComponentParameters.cpp b/tools/gui/generators/common/ComponentParameters.cpp index 3ee63c0378..057c131fa6 100644 --- a/tools/gui/generators/common/ComponentParameters.cpp +++ b/tools/gui/generators/common/ComponentParameters.cpp @@ -42,9 +42,9 @@ ComponentParameters::ComponentParameters(const std::string& id, "Number of Quadrupoles",Parameter::SPINBOX,true, component.numQuadrupoles())); for (size_t i = 0; i < component.numCharges(); i++) { - stringstream baseNameStream; + std::stringstream baseNameStream; baseNameStream << name << ".Charge" << i; - string baseName = baseNameStream.str(); + std::string baseName = baseNameStream.str(); ParameterCollection* chargeCollection = new ParameterCollection( baseName, baseName, baseName, Parameter::BUTTON); Charge charge = component.charge(i); @@ -67,9 +67,9 @@ ComponentParameters::ComponentParameters(const std::string& id, addParameter(chargeCollection); } for (unsigned int i = 0; i < component.numLJcenters(); i++) { - stringstream baseNameStream; + std::stringstream baseNameStream; baseNameStream << name << ".LJCenter" << i; - string baseName = baseNameStream.str(); + std::string baseName = baseNameStream.str(); ParameterCollection* ljCenterCollection = new ParameterCollection( baseName, baseName, baseName, Parameter::BUTTON); LJcenter ljCenter = component.ljcenter(i); @@ -98,9 +98,9 @@ ComponentParameters::ComponentParameters(const std::string& id, } for (unsigned int i = 0; i < component.numDipoles(); i++) { - stringstream baseNameStream; + std::stringstream baseNameStream; baseNameStream << name << ".Dipole" << i; - string baseName = baseNameStream.str(); + std::string baseName = baseNameStream.str(); ParameterCollection* dipoleCollection = new ParameterCollection( baseName, baseName, baseName, Parameter::BUTTON); Dipole dipole = component.dipole(i); @@ -122,9 +122,9 @@ ComponentParameters::ComponentParameters(const std::string& id, } for (unsigned int i = 0; i < component.numQuadrupoles(); i++) { - stringstream baseNameStream; + std::stringstream baseNameStream; baseNameStream << name << ".Quadrupole" << i; - string baseName = baseNameStream.str(); + std::string baseName = baseNameStream.str(); Quadrupole quad = component.quadrupole(i); ParameterCollection* quadrupoleCollection = new ParameterCollection(baseName, baseName, baseName, Parameter::BUTTON); quadrupoleCollection->addParameter(new ParameterWithDoubleValue(baseName + ".x", baseName + ".x [Angstrom]", baseName + ".x", @@ -154,7 +154,7 @@ void ComponentParameters::setParameterValue(Component& component, Parameter* p, #ifdef DEBUG std::cout << "ComponentParameters::setParameterValue() from Parameter Object to component: name is " - << valueName << endl; + << valueName << std::endl; #endif if (valueName == "NumberOfCharges") { @@ -195,45 +195,45 @@ void ComponentParameters::setParameterValue(Component& component, Parameter* p, } else if (valueName == "Temperature") { component.setT(static_cast (p)->getValue()); #ifdef DEBUG - std::cout<<"Temperature set to "< (p)->getValue()< (p)->getValue()< (valueName.at(6)); std::string part = valueName.substr(8); #ifdef DEBUG - std::cout << "Index of charge: " << chargeIndex << endl; + std::cout << "Index of charge: " << chargeIndex << std::endl; std::cout << "part is: " << part << std::endl; #endif setParameterValue(component.charge(chargeIndex), static_cast (p), part); - } else if (valueName.find("LJCenter") != string::npos) { + } else if (valueName.find("LJCenter") != std::string::npos) { int ljCenterIndex = convertFromChar (valueName.at(8)); std::string part = valueName.substr(10); #ifdef DEBUG - std::cout << "Index of LJ Center: " << ljCenterIndex << endl; + std::cout << "Index of LJ Center: " << ljCenterIndex << std::endl; std::cout << "part is: " << part << std::endl; #endif setParameterValue(component.ljcenter(ljCenterIndex), static_cast (p), part); - } else if (valueName.find("Dipole") != string::npos) { + } else if (valueName.find("Dipole") != std::string::npos) { int dipoleIndex = convertFromChar (valueName.at(6)); std::string part = valueName.substr(8); #ifdef DEBUG - std::cout << "Index of Dipole: " << dipoleIndex << endl; + std::cout << "Index of Dipole: " << dipoleIndex << std::endl; std::cout << "part is: " << part << std::endl; #endif setParameterValue(component.dipole(dipoleIndex), static_cast (p), part); - } else if (valueName.find("Quadrupole") != string::npos){ + } else if (valueName.find("Quadrupole") != std::string::npos){ int quadIndex = convertFromChar (valueName.at(10)); std::string part = valueName.substr(12); #ifdef DEBUG - std::cout<< "Index of Quadrupole: " << quadIndex << endl; + std::cout<< "Index of Quadrupole: " << quadIndex << std::endl; std::cout << "part is: " << part << std::endl; #endif setParameterValue(component.quadrupole(quadIndex), static_cast (p), part); } else { std::cout << "ComponentParameters::setParameterValue(): unkown parameter! (valueName=" - << valueName << ")" << endl; + << valueName << ")" << std::endl; exit(-1); } } @@ -242,7 +242,7 @@ void ComponentParameters::setParameterValue(Charge& charge, ParameterWithDoubleValue* p, std::string& valueName) { #ifdef DEBUG std::cout << "SetParameterValue in Charge! valueName=" << valueName - << "value: " << p->getValue() << endl; + << "value: " << p->getValue() << std::endl; #endif if (valueName == "x") { @@ -257,7 +257,7 @@ void ComponentParameters::setParameterValue(Charge& charge, charge.setQ(p->getValue()); } else { std::cout << "ComponentParameters::setParameterValue(Charge): unkown parameter! (valueName=" - << valueName << ")" << endl; + << valueName << ")" << std::endl; exit(-1); } @@ -267,7 +267,7 @@ void ComponentParameters::setParameterValue(LJcenter& ljCenter, ParameterWithDoubleValue* p, std::string& valueName) { #ifdef DEBUG std::cout << "SetParameterValue in LJCenter! valueName =" << valueName - << "value: " << p->getValue() << endl; + << "value: " << p->getValue() << std::endl; #endif if (valueName == "x") { @@ -284,14 +284,14 @@ void ComponentParameters::setParameterValue(LJcenter& ljCenter, ljCenter.setSigma(p->getValue() * MDGenerator::angstroem_2_atomicUnitLength); } else { std::cout << "ComponentParameters::setParameterValue(LJCenter): unkown parameter! (valueName=" - << valueName << ")" << endl; + << valueName << ")" << std::endl; exit(-1); } } void ComponentParameters::setParameterValue(Dipole& dipole, ParameterWithDoubleValue* p, std::string& valueName){ #ifdef DEBUG - std::cout << "SetParameterValue in Dipole! valueName =" << valueName << "value: " << p->getValue() << endl; + std::cout << "SetParameterValue in Dipole! valueName =" << valueName << "value: " << p->getValue() << std::endl; #endif if (valueName == "x") { @@ -310,14 +310,14 @@ void ComponentParameters::setParameterValue(Dipole& dipole, ParameterWithDoubleV dipole.setAbyMy(p->getValue() * MDGenerator::debye_2_mardyn); } else { std::cout << "ComponentParameters::setParameterValue(Dipole): unkown parameter! (valueName=" - << valueName << ")" << endl; + << valueName << ")" << std::endl; exit(-1); } } void ComponentParameters::setParameterValue(Quadrupole& quadrupole, ParameterWithDoubleValue* p, std::string& valueName){ #ifdef DEBUG - std::cout << "SetParameterValue in Quadrupole! valueName =" << valueName << "value: " << p->getValue() << endl; + std::cout << "SetParameterValue in Quadrupole! valueName =" << valueName << "value: " << p->getValue() << std::endl; #endif if (valueName == "x") { @@ -336,7 +336,7 @@ void ComponentParameters::setParameterValue(Quadrupole& quadrupole, ParameterWit quadrupole.setAbsQ(p->getValue() * MDGenerator::buckingham_2_mardyn); } else { std::cout << "ComponentParameters::setParameterValue(Quadrupole): unkown parameter! (valueName=" - << valueName << ")" << endl; + << valueName << ")" << std::endl; exit(-1); } } diff --git a/tools/gui/generators/common/DrawableMolecule.cpp b/tools/gui/generators/common/DrawableMolecule.cpp index dcaff5f4a9..3745031eb2 100644 --- a/tools/gui/generators/common/DrawableMolecule.cpp +++ b/tools/gui/generators/common/DrawableMolecule.cpp @@ -21,8 +21,8 @@ DrawableMolecule::~DrawableMolecule() { } -vector DrawableMolecule::getDrawableValues() const { - vector v; +std::vector DrawableMolecule::getDrawableValues() const { + std::vector v; v.push_back("Molecule"); v.push_back("Molecule ID"); v.push_back("Component ID"); @@ -30,7 +30,7 @@ vector DrawableMolecule::getDrawableValues() const { return v; } -vtkSmartPointer DrawableMolecule::draw(string valueName){ +vtkSmartPointer DrawableMolecule::draw(std::string valueName){ if (valueName == "Molecule") { return drawValue(_x,_id, 0, _numObjects, false); } @@ -44,7 +44,7 @@ vtkSmartPointer DrawableMolecule::draw(string valueName){ return drawVector(_x,_v); } else { - cout<<"Invalid value name"< getDrawableValues() const; + std::vector getDrawableValues() const; - vtkSmartPointer draw(string valueName); + vtkSmartPointer draw(std::string valueName); }; diff --git a/tools/gui/generators/common/DropletPlacement.cpp b/tools/gui/generators/common/DropletPlacement.cpp index 77081438fa..fe55fb123e 100644 --- a/tools/gui/generators/common/DropletPlacement.cpp +++ b/tools/gui/generators/common/DropletPlacement.cpp @@ -10,16 +10,14 @@ #define SIZE 100 -using namespace std; - DropletPlacement::DropletPlacement(double fluidVolume, double maxSphereVolume, int numSphereSizes, Log::Logger* logger) : _fluidVolume(fluidVolume / 100.), _maxSphereRadius(pow((3.0*maxSphereVolume / 100.)/(4.0 * M_PI), 1.0/3.0)), _numSphereSizes(numSphereSizes), _numOccupied(0), _logger(logger) { initFields(SIZE); _logger -> debug() << "Instantiated Droplet Generator for parameter set " << - " fluidVolume " << _fluidVolume << " maxSphereVolume " << (maxSphereVolume/100) << " numSphereSizes " << _numSphereSizes << endl; - _logger -> debug() << " _maxSphereRadius is " << _maxSphereRadius << endl; + " fluidVolume " << _fluidVolume << " maxSphereVolume " << (maxSphereVolume/100) << " numSphereSizes " << _numSphereSizes << std::endl; + _logger -> debug() << " _maxSphereRadius is " << _maxSphereRadius << std::endl; } DropletPlacement::~DropletPlacement() { @@ -38,7 +36,7 @@ void DropletPlacement::initFields(int size){ } } -double DropletPlacement::calcDistance(vector pos1, double pos2[3]){ +double DropletPlacement::calcDistance(std::vector pos1, double pos2[3]){ double temp = 0; for(int i=0; i<3; i++){ temp += pow(pos1[i]-pos2[i],2.0); @@ -54,15 +52,15 @@ void DropletPlacement::placeSphereRandomly(double radius, std::vector& center[2] = rand()/(1.0*RAND_MAX); // int debug = 0; - // cout << "Debug " << debug << endl; debug++; - vector centerCell; + // std::cout << "Debug " << debug << std::endl; debug++; + std::vector centerCell; centerCell.resize(3); centerCell[0] = (int) floor(center[0]*SIZE); centerCell[1] = (int) floor(center[1]*SIZE); centerCell[2] = (int) floor(center[2]*SIZE); int rInCells = (int) ceil(radius*SIZE); - vector cellPos; + std::vector cellPos; cellPos.resize(3); for(int ix=centerCell[0]-rInCells; ix& droplets.push_back(droplet); } -vector DropletPlacement::generateDroplets() { +std::vector DropletPlacement::generateDroplets() { // in case there is only one droplet to be generated, place it in the middle! double maxDropVolume = (4.0 / 3.0 * M_PI * pow(_maxSphereRadius,3)); if (_numSphereSizes == 1 && maxDropVolume >= _fluidVolume) { - vector droplets; + std::vector droplets; double center[3] = {0.5, 0.5, 0.5}; Droplet droplet(center, _maxSphereRadius); droplets.push_back(droplet); @@ -104,7 +102,7 @@ vector DropletPlacement::generateDroplets() { double currentRadius = _maxSphereRadius; double percentageOccupied = 0.0; double percentageNeeded = 0.0; - vector droplets; + std::vector droplets; for (int sphereclass = 0; sphereclass < _numSphereSizes; sphereclass++) { percentageNeeded = (sphereclass + 1.0) / _numSphereSizes * _fluidVolume; percentageOccupied = _numOccupied / pow(SIZE, 3.0); @@ -114,14 +112,14 @@ vector DropletPlacement::generateDroplets() { count++; percentageOccupied = _numOccupied / pow(SIZE, 3.0); } - _logger->debug() << "Created " << count << " spheres with radius " << currentRadius << endl; + _logger->debug() << "Created " << count << " spheres with radius " << currentRadius << std::endl; currentRadius -= _maxSphereRadius / 10.0; } - _logger->debug() << "PercentOccupied: " << (100 * _numOccupied / pow(SIZE, 3.0)) << " %" << endl; + _logger->debug() << "PercentOccupied: " << (100 * _numOccupied / pow(SIZE, 3.0)) << " %" << std::endl; return droplets; } Log::Logger& operator<<(Log::Logger& str, DropletPlacement::Droplet& droplet) { - str << " Droplet: center [" << droplet._center[0] << "," << droplet._center[1] << "," << droplet._center[2] << "] r:" << droplet._radius << endl; + str << " Droplet: center [" << droplet._center[0] << "," << droplet._center[1] << "," << droplet._center[2] << "] r:" << droplet._radius << std::endl; return str; } diff --git a/tools/gui/generators/common/MS2RestartReader.cpp b/tools/gui/generators/common/MS2RestartReader.cpp index 13356c727f..ea64820c7e 100644 --- a/tools/gui/generators/common/MS2RestartReader.cpp +++ b/tools/gui/generators/common/MS2RestartReader.cpp @@ -6,27 +6,25 @@ #include #include -using namespace std; - int MS2RestartReader::readMolecules(ifstream& inputfilestream, int cid, int startid, MoleculeData* molecules, bool rotationalDOF) { char dummy; - string line; + std::string line; int numMolecules = 0; getline(inputfilestream, line); - stringstream lineStream(line); + std::stringstream lineStream(line); lineStream >> numMolecules; - cout << "Reading numIons= " << line << endl; - cout << "numMolecules= " << numMolecules << endl; + std::cout << "Reading numIons= " << line << std::endl; + std::cout << "numMolecules= " << numMolecules << std::endl; int id = startid; for (int i = 0; i < numMolecules; i++) { molecules[id].id = id; molecules[id].cid = cid; getline(inputfilestream, line); - //cout << "read line=" << line << endl; - stringstream lineStream(line); + //cout << "read line=" << line << std::endl; + std::stringstream lineStream(line); lineStream >> molecules[id].x[0] >> dummy >> molecules[id].x[1] >> dummy >> molecules[id].x[2]; id++; } @@ -34,7 +32,7 @@ int MS2RestartReader::readMolecules(ifstream& inputfilestream, int cid, int star id = startid; for (int i = 0; i < numMolecules; i++) { getline(inputfilestream, line); - stringstream lineStream(line); + std::stringstream lineStream(line); lineStream >> molecules[id].v[0] >> dummy >> molecules[id].v[1] >> dummy >> molecules[id].v[2]; id++; } @@ -48,7 +46,7 @@ int MS2RestartReader::readMolecules(ifstream& inputfilestream, int cid, int star id = startid; for (int i = 0; i < numMolecules; i++) { getline(inputfilestream, line); - stringstream lineStream(line); + std::stringstream lineStream(line); lineStream >> molecules[id].q[0] >> dummy >> molecules[id].q[1] >> dummy >> molecules[id].q[2] >> dummy >> molecules[id].q[3]; id++; } @@ -60,7 +58,7 @@ int MS2RestartReader::readMolecules(ifstream& inputfilestream, int cid, int star id = startid; for (int i = 0; i < numMolecules; i++) { getline(inputfilestream, line); - stringstream lineStream(line); + std::stringstream lineStream(line); lineStream >> molecules[id].d[0] >> dummy >> molecules[id].d[1] >> dummy >> molecules[id].d[2]; id++; } @@ -68,32 +66,32 @@ int MS2RestartReader::readMolecules(ifstream& inputfilestream, int cid, int star return numMolecules; } -MS2RestartReader::MoleculeData* MS2RestartReader::readMS2RestartFile(const string& file, const int numberOfComponents, +MS2RestartReader::MoleculeData* MS2RestartReader::readMS2RestartFile(const std::string& file, const int numberOfComponents, const int numberOfMolecules, std::vector hasRotationalDOF) { - ifstream inputfilestream(file.c_str()); + std::ifstream inputfilestream(file.c_str()); if (!inputfilestream.is_open()) { - cout << "ERROR: Could not open file " << file << endl; + std::cout << "ERROR: Could not open file " << file << std::endl; return NULL; } MoleculeData* molecules = new MoleculeData[numberOfMolecules]; - cout << setprecision(9); - string line; + std::cout << std::setprecision(9); + std::string line; for (int i = 0; i < 4; i++) { getline(inputfilestream, line); - std::cout << " skipped line: " << line << endl; + std::cout << " skipped line: " << line << std::endl; } double boxVolume = 0; getline(inputfilestream, line); - stringstream lineStream(line); + std::stringstream lineStream(line); lineStream >> boxVolume; - std::cout << "BoxVolume = " << boxVolume << endl; + std::cout << "BoxVolume = " << boxVolume << std::endl; for (int i = 0; i < 6; i++) { getline(inputfilestream, line); - std::cout << " skipped line: " << line << endl; + std::cout << " skipped line: " << line << std::endl; } int start_idx = 0; diff --git a/tools/gui/generators/common/MardynConfigLegacyWriter.cpp b/tools/gui/generators/common/MardynConfigLegacyWriter.cpp index b0a5e107e8..e6829b2bce 100644 --- a/tools/gui/generators/common/MardynConfigLegacyWriter.cpp +++ b/tools/gui/generators/common/MardynConfigLegacyWriter.cpp @@ -9,10 +9,9 @@ #include "MardynConfiguration.h" #include -using namespace std; -void writeOutputConfig(ofstream& output, const OutputConfiguration& config) { - output << "output " << config.getName() << " " << config.getOutputFrequency() << " " << config.getOutputPrefix() << endl; +void writeOutputConfig(std::ofstream& output, const OutputConfiguration& config) { + output << "output " << config.getName() << " " << config.getOutputFrequency() << " " << config.getOutputPrefix() << std::endl; } MardynConfigLegacyWriter::MardynConfigLegacyWriter() { @@ -24,24 +23,24 @@ MardynConfigLegacyWriter::~MardynConfigLegacyWriter() { void MardynConfigLegacyWriter::writeConfigFile(const std::string& directory, const std::string& fileName, const MardynConfiguration& config) { - string fullName = directory + "/" + fileName; - ofstream output(fullName.c_str()); - output << "MDProjectConfig\n" << endl; + std::string fullName = directory + "/" + fileName; + std::ofstream output(fullName.c_str()); + output << "MDProjectConfig\n" << std::endl; - output << "# THIS CONFIGURATION WAS GENERATED BY THE SCENARIO-GENERATOR!\n" << endl; + output << "# THIS CONFIGURATION WAS GENERATED BY THE SCENARIO-GENERATOR!\n" << std::endl; - output << "timestepLength " << config.getTimestepLength() << endl; - output << "cutoffRadius " << config.getCutoffRadius() << endl; - output << "LJCutoffRadius " << config.getLJCutoffRadius() << endl; - output << "phaseSpaceFile OldStyle " << config.getScenarioName() << ".inp" << endl; + output << "timestepLength " << config.getTimestepLength() << std::endl; + output << "cutoffRadius " << config.getCutoffRadius() << std::endl; + output << "LJCutoffRadius " << config.getLJCutoffRadius() << std::endl; + output << "phaseSpaceFile OldStyle " << config.getScenarioName() << ".inp" << std::endl; if (config.getParallelisationTypeString() != MardynConfiguration::ParallelisationType_NONE) { - output << "parallelization " << config.getParallelisationTypeString() << endl; + output << "parallelization " << config.getParallelisationTypeString() << std::endl; } - output << "datastructure " << config.getContainerTypeString() << " 1" << endl; + output << "datastructure " << config.getContainerTypeString() << " 1" << std::endl; - output << endl; + output << std::endl; if (config.isNVE()) { - output << "NVE" << endl << endl; + output << "NVE" << std::endl << std::endl; } if (config.hasResultWriter()) { diff --git a/tools/gui/generators/common/MardynConfigurationParameters.cpp b/tools/gui/generators/common/MardynConfigurationParameters.cpp index 61ca2b0e7b..e633868de1 100644 --- a/tools/gui/generators/common/MardynConfigurationParameters.cpp +++ b/tools/gui/generators/common/MardynConfigurationParameters.cpp @@ -26,7 +26,7 @@ MardynConfigurationParameters::MardynConfigurationParameters(const MardynConfigu addParameter(new ParameterWithStringValue("ConfigurationParameters.ScenarioName", "Scenario name", "Name of the scenario (determines the base name of the output files)", Parameter::LINE_EDIT, false, other.getScenarioName())); - std::vector choices; + std::vector choices; choices.push_back(MardynConfiguration::OutputFormat_XML); choices.push_back(MardynConfiguration::OutputFormat_LEGACY); addParameter(new ParameterWithChoice("ConfigurationParameters.fileformat", "Configuration File Format", @@ -48,7 +48,7 @@ MardynConfigurationParameters::MardynConfigurationParameters(const MardynConfigu addParameter(new ParameterWithBool("ConfigurationParameters.principalAxisTrafo", "Perform principal axis transformation", "Perform a principal axis transformation for each component\nwhen writing the Mardyn phasespace file.", Parameter::CHECKBOX, false, other.performPrincipalAxisTransformation())); - std::vector parChoices; + std::vector parChoices; parChoices.push_back(MardynConfiguration::ParallelisationType_DOMAINDECOMPOSITION); parChoices.push_back(MardynConfiguration::ParallelisationType_KDDECOMPOSITION); parChoices.push_back(MardynConfiguration::ParallelisationType_NONE); @@ -56,7 +56,7 @@ MardynConfigurationParameters::MardynConfigurationParameters(const MardynConfigu "- DomainDecomposition: standard parallelisation method\n- KDDecomposition: parallelisation with dynamic load balancing (recommended)\n- NONE: no parallelisation", Parameter::COMBOBOX, false, parChoices, other.getParallelisationTypeString())); - std::vector containerChoices; + std::vector containerChoices; containerChoices.push_back(MardynConfiguration::ContainerType_LINKEDCELLS); containerChoices.push_back(MardynConfiguration::ContainerType_ADAPTIVELINKEDCELLS); addParameter(new ParameterWithChoice("ConfigurationParameters.ContainerType", "Container Type", @@ -92,10 +92,10 @@ MardynConfigurationParameters::~MardynConfigurationParameters() { void MardynConfigurationParameters::setParameterValue(MardynConfiguration& config, const Parameter* parameter, const std::string valueName) { if (valueName == "ScenarioName") { - string scenarioName = dynamic_cast(parameter)->getStringValue(); + std::string scenarioName = dynamic_cast(parameter)->getStringValue(); config.setScenarioName(scenarioName); } else if (valueName == "fileformat") { - string choice = dynamic_cast(parameter)->getStringValue(); + std::string choice = dynamic_cast(parameter)->getStringValue(); config.setOutputFormat(choice); } else if (valueName == "timesteplength") { double timestepLength = dynamic_cast(parameter)->getValue(); @@ -113,10 +113,10 @@ void MardynConfigurationParameters::setParameterValue(MardynConfiguration& confi bool NVE = dynamic_cast(parameter)->getValue(); config.setNVE(NVE); } else if (valueName == "ParallelisationType") { - string choice = dynamic_cast(parameter)->getStringValue(); + std::string choice = dynamic_cast(parameter)->getStringValue(); config.setParallelisationType(choice); } else if (valueName == "ContainerType") { - string choice = dynamic_cast(parameter)->getStringValue(); + std::string choice = dynamic_cast(parameter)->getStringValue(); config.setContainerType(choice); } else if (valueName == "hasStatisticsWriter") { bool hasStatisticsWriter = dynamic_cast(parameter)->getValue(); @@ -131,8 +131,8 @@ void MardynConfigurationParameters::setParameterValue(MardynConfiguration& confi bool hasResultWriter = dynamic_cast(parameter)->getValue(); config.setHasResultWriter(hasResultWriter); } else { - const string firstPart = firstSubString(".", valueName); - const string secondPart = remainingSubString(".", valueName); + const std::string firstPart = firstSubString(".", valueName); + const std::string secondPart = remainingSubString(".", valueName); if (firstPart == "ResultWriter") { setOutputConfigurationParameter(config.getResultWriterConfig(), parameter, secondPart); @@ -143,7 +143,7 @@ void MardynConfigurationParameters::setParameterValue(MardynConfiguration& confi } else if (firstPart == "VTKGridWriter") { setOutputConfigurationParameter(config.getVtkGridWriterConfig(), parameter, secondPart); } else { - std::cout << "Invalid Parameter in ConfigurationParameters::setParameterValue(): " << endl; + std::cout << "Invalid Parameter in ConfigurationParameters::setParameterValue(): " << std::endl; parameter->print(); exit(-1); } @@ -160,13 +160,13 @@ void MardynConfigurationParameters::addOutputConfigurationParameters(const Outpu void MardynConfigurationParameters::setOutputConfigurationParameter(OutputConfiguration& config, const Parameter* parameter, const std::string& valueName) { if (valueName == "Prefix") { - string prefix = dynamic_cast(parameter)->getStringValue(); + std::string prefix = dynamic_cast(parameter)->getStringValue(); config.setOutputPrefix(prefix); } else if (valueName == "Frequency") { int frequency = dynamic_cast(parameter)->getValue(); config.setOutputFrequency(frequency); } else { - std::cout << "Invalid Parameter in ConfigurationParameters::setParameterValue(): " << endl; + std::cout << "Invalid Parameter in ConfigurationParameters::setParameterValue(): " << std::endl; parameter->print(); exit(-1); } diff --git a/tools/gui/generators/common/PMFileReader.cpp b/tools/gui/generators/common/PMFileReader.cpp index 8694b2236c..64e3c0d2bd 100644 --- a/tools/gui/generators/common/PMFileReader.cpp +++ b/tools/gui/generators/common/PMFileReader.cpp @@ -11,39 +11,38 @@ #include #include -using namespace std; -const string nSiteTypesTag = "NSiteTypes"; -const string nSitesTag = "NSites"; +const std::string nSiteTypesTag = "NSiteTypes"; +const std::string nSitesTag = "NSites"; -const string siteTypeTag = "SiteType"; -const string siteTypeLJ126Tag = "LJ126"; -const string siteTypeChargeTag = "Charge"; -const string siteTypeDipoleTag = "D"; -const string siteTypeQuadrupoleTag = "Q"; +const std::string siteTypeTag = "SiteType"; +const std::string siteTypeLJ126Tag = "LJ126"; +const std::string siteTypeChargeTag = "Charge"; +const std::string siteTypeDipoleTag = "D"; +const std::string siteTypeQuadrupoleTag = "Q"; -const string LJ126Tags[] = {"x", "y", "z", "sigma", "epsilon", "mass"}; -const string ChargeTags[] = {"x", "y", "z", "charge", "mass", "shielding"}; -const string DipoleTags[] = {"x", "y", "z", "theta", "phi", "dipole", "mass", "shielding"}; -const string QuadrupoleTags[] = {"x", "y", "z", "theta", "phi", "quadrupole", "mass", "shielding"}; +const std::string LJ126Tags[] = {"x", "y", "z", "sigma", "epsilon", "mass"}; +const std::string ChargeTags[] = {"x", "y", "z", "charge", "mass", "shielding"}; +const std::string DipoleTags[] = {"x", "y", "z", "theta", "phi", "dipole", "mass", "shielding"}; +const std::string QuadrupoleTags[] = {"x", "y", "z", "theta", "phi", "quadrupole", "mass", "shielding"}; template -void readTag(const std::string tagToRead, T& value, ifstream& input) { - string line; +void readTag(const std::string tagToRead, T& value, std::ifstream& input) { + std::string line; do { getline(input, line); - std::cout << "Read Line: " << line << endl; + std::cout << "Read Line: " << line << std::endl; } while (line.size() == 0 || line[0] == '#'); - istringstream linestream(line); - string tag; + std::istringstream linestream(line); + std::string tag; linestream >> tag; if (tag != tagToRead) { std::cout << "Error in PMFile: expected tag " << tagToRead << - " but got " << tag << endl; + " but got " << tag << std::endl; // todo: we'll replace this by throwing an exception in the case we // build it with gui, otherwise we simply exit! exit(-1); @@ -51,9 +50,9 @@ void readTag(const std::string tagToRead, T& value, ifstream& input) { linestream >> tag; if (tag != "=") { - std::cout << "Error in PMFile: expected \"=\" " << " but got " << tag << endl; + std::cout << "Error in PMFile: expected \"=\" " << " but got " << tag << std::endl; if (tag.size() > 0 && tag[0] == '=') { - std::cout << "\t YOU PROBABLY FORGOT A WHITESPACE?" << endl; + std::cout << "\t YOU PROBABLY FORGOT A WHITESPACE?" << std::endl; } exit(-1); } @@ -61,10 +60,10 @@ void readTag(const std::string tagToRead, T& value, ifstream& input) { linestream >> value; } -void readLJ126(ComponentParameters* parameters, Generator* generator, ifstream& input, const int nSites) { +void readLJ126(ComponentParameters* parameters, Generator* generator, std::ifstream& input, const int nSites) { for (int i = 0; i < nSites; i++) { double LJ126Value = 0; - string baseName = parameters->getNameId() + ".LJCenter" + convertToString(i); + std::string baseName = parameters->getNameId() + ".LJCenter" + convertToString(i); for (int k = 0; k < 6; k++) { readTag(LJ126Tags[k], LJ126Value, input); @@ -76,16 +75,16 @@ void readLJ126(ComponentParameters* parameters, Generator* generator, ifstream& } } -void readCharge(ComponentParameters* parameters, Generator* generator, ifstream& input, const int nSites) { +void readCharge(ComponentParameters* parameters, Generator* generator, std::ifstream& input, const int nSites) { for (int i = 0; i < nSites; i++) { double value = 0; - string baseName = parameters->getNameId() + ".Charge" + convertToString(i); + std::string baseName = parameters->getNameId() + ".Charge" + convertToString(i); for (int k = 0; k < 6; k++) { readTag(ChargeTags[k], value, input); if (ChargeTags[k] == "shielding") { - std::cout << "PMFileReader: Ignoring value " << "\"shielding\"!" << endl; + std::cout << "PMFileReader: Ignoring value " << "\"shielding\"!" << std::endl; continue; } @@ -98,16 +97,16 @@ void readCharge(ComponentParameters* parameters, Generator* generator, ifstream& } -void readDipole(ComponentParameters* parameters, Generator* generator, ifstream& input, const int nSites) { +void readDipole(ComponentParameters* parameters, Generator* generator, std::ifstream& input, const int nSites) { for (int i = 0; i < nSites; i++) { double value = 0; - string baseName = parameters->getNameId() + ".Dipole" + convertToString(i); + std::string baseName = parameters->getNameId() + ".Dipole" + convertToString(i); for (int k = 0; k < 8; k++) { readTag(DipoleTags[k], value, input); if (DipoleTags[k] == "shielding" || DipoleTags[k] == "phi" || DipoleTags[k] == "theta" || DipoleTags[k] == "mass") { - std::cout << "PMFileReader: Ignoring value " << DipoleTags[k] << endl; + std::cout << "PMFileReader: Ignoring value " << DipoleTags[k] << std::endl; continue; } @@ -126,16 +125,16 @@ void readDipole(ComponentParameters* parameters, Generator* generator, ifstream& } -void readQuadrupole(ComponentParameters* parameters, Generator* generator, ifstream& input, const int nSites) { +void readQuadrupole(ComponentParameters* parameters, Generator* generator, std::ifstream& input, const int nSites) { for (int i = 0; i < nSites; i++) { double value = 0; - string baseName = parameters->getNameId() + ".Quadrupole" + convertToString(i); + std::string baseName = parameters->getNameId() + ".Quadrupole" + convertToString(i); for (int k = 0; k < 8; k++) { readTag(QuadrupoleTags[k], value, input); if (QuadrupoleTags[k] == "shielding" || QuadrupoleTags[k] == "phi" || QuadrupoleTags[k] == "theta" || QuadrupoleTags[k] == "mass") { - std::cout << "PMFileReader: Ignoring value " << QuadrupoleTags[k] << endl; + std::cout << "PMFileReader: Ignoring value " << QuadrupoleTags[k] << std::endl; continue; } @@ -153,7 +152,7 @@ void readQuadrupole(ComponentParameters* parameters, Generator* generator, ifstr } void reset(Generator* generator, ComponentParameters* parameters) { - string numberSitesNames[] = { ".NumberOfLJCenters", ".NumberOfCharges", + std::string numberSitesNames[] = { ".NumberOfLJCenters", ".NumberOfCharges", ".NumberOfDipoles", ".NumberOfQuadrupoles" }; for (int i = 0; i < 4; i++) { @@ -167,14 +166,14 @@ void reset(Generator* generator, ComponentParameters* parameters) { void PMFileReader::readPMFile(const std::string& filename, Generator* generator, ComponentParameters* parameters) { reset(generator, parameters); - ifstream input(filename.c_str()); + std::ifstream input(filename.c_str()); int nSiteTypes = 0; readTag(nSiteTypesTag, nSiteTypes, input); - string siteType; + std::string siteType; int nSites = 0; - string numberSitesName; + std::string numberSitesName; for (int i = 0; i < nSiteTypes; i++) { readTag(siteTypeTag, siteType, input); @@ -189,7 +188,7 @@ void PMFileReader::readPMFile(const std::string& filename, Generator* generator, } else if (siteType == siteTypeQuadrupoleTag) { numberSitesName = ".NumberOfQuadrupoles"; } else { - std::cout << "Error in PMFile: unexpected siteType " << siteType << endl; + std::cout << "Error in PMFile: unexpected siteType " << siteType << std::endl; exit(-1); } @@ -199,7 +198,7 @@ void PMFileReader::readPMFile(const std::string& filename, Generator* generator, numLJParameters->setValue(nSites); generator->setParameter(numLJParameters); - vector newGeneratorParameters = generator->getParameters(); + std::vector newGeneratorParameters = generator->getParameters(); ComponentParameters* newParameters = NULL; for (size_t i = 0; i < newGeneratorParameters.size(); i++) { newParameters = @@ -218,7 +217,7 @@ void PMFileReader::readPMFile(const std::string& filename, Generator* generator, } else if (siteType == siteTypeQuadrupoleTag) { readQuadrupole(newParameters, generator, input, nSites); } else { - std::cout << "Error in PMFile: unexpected siteType " << siteType << endl; + std::cout << "Error in PMFile: unexpected siteType " << siteType << std::endl; exit(-1); } diff --git a/tools/gui/generators/common/PrincipalAxisTransform.cpp b/tools/gui/generators/common/PrincipalAxisTransform.cpp index 0c222f4e38..00a26aac66 100644 --- a/tools/gui/generators/common/PrincipalAxisTransform.cpp +++ b/tools/gui/generators/common/PrincipalAxisTransform.cpp @@ -9,7 +9,6 @@ #include "molecules/Component.h" #include "eig3.h" -using namespace std; /** * @param[in] site @@ -40,7 +39,7 @@ void principalAxisTransform(Component& component) { centerOfMass[i] = centerOfMass[i] / totalMass; } - cout << "Moving center of mass [" << centerOfMass[0] << "," << centerOfMass[1] << "," << centerOfMass[2] << "]" << endl; + std::cout << "Moving center of mass [" << centerOfMass[0] << "," << centerOfMass[1] << "," << centerOfMass[2] << "]" << std::endl; // adjust coordinates wrt center of mass and assemble mass matrix double momentMatrix[3][3] = { {0., 0., 0.} , {0., 0., 0.} , {0., 0., 0.} }; @@ -57,13 +56,13 @@ void principalAxisTransform(Component& component) { shiftCenterAndBuildMatrix(component.quadrupole(i), centerOfMass, momentMatrix); } - std::cout << "momentMatrix:" << endl; + std::cout << "momentMatrix:" << std::endl; for (int i = 0; i < 3; i++) { - std::cout << "[ " << endl; + std::cout << "[ " << std::endl; for (int j = 0; j < 3; j++) { std::cout << " " << momentMatrix[i][j]; } - std::cout << "]" << endl; + std::cout << "]" << std::endl; } double eigenVectors[3][3]; @@ -87,13 +86,13 @@ void principalAxisTransform(Component& component) { } } - std::cout << "Eigenvectors:" << endl; + std::cout << "Eigenvectors:" << std::endl; for (int i = 0; i < 3; i++) { std::cout << "[ "; for (int j = 0; j < 3; j++) { std::cout << " " << eigenVectors[i][j]; } - std::cout << "]" << endl; + std::cout << "]" << std::endl; } // adjust coordinates wrt. principal axis @@ -114,7 +113,7 @@ void principalAxisTransform(Component& component) { component.setI33(momentMatrix[2][2]); - std::cout << "Diagonal: " << momentMatrix[0][0] << "," << momentMatrix[1][1] << "," << momentMatrix[2][2] < #include "../src/External/tinyxpath/xpath_static.h" -using namespace std; int main(int argc, char *argv[], char *env[]) { if (argc < 4) { - cout + std::cout << "Syntax: mdproject2mardyn " - << endl; + << std::endl; exit(1); } // define the output filename - string outfile_name = "new-"; + std::string outfile_name = "new-"; outfile_name.append(argv[2]); TiXmlDocument doc; @@ -70,15 +69,15 @@ int main(int argc, char *argv[], char *env[]) experiment->LinkEndChild(data_structure); // Frist parse the .cfg file - string token; + std::string token; fstream inputfstream; inputfstream.open(argv[1]); if (!inputfstream.is_open()) { - cout << "Error opening file " << argv[1] << " for reading."; + std::cout << "Error opening file " << argv[1] << " for reading."; exit(1); } - string output_format, output_freq, output_file = ""; + std::string output_format, output_freq, output_file = ""; while (inputfstream) { @@ -133,9 +132,9 @@ int main(int argc, char *argv[], char *env[]) } } else if (token == "cellsInCutoffRadius") { - cout + std::cout << "Warning: Can't handle datastructures which are not linked cells." - << endl; + << std::endl; inputfstream >> token; } else if (token == "output") { @@ -157,8 +156,8 @@ int main(int argc, char *argv[], char *env[]) } } else { - cerr << "Warning: Unknown token '" << token << "' at position " - << inputfstream.tellg() << endl; + std::cerr << "Warning: Unknown token '" << token << "' at position " + << inputfstream.tellg() << std::endl; } } @@ -168,7 +167,7 @@ int main(int argc, char *argv[], char *env[]) inputfstream.open(argv[2]); if (!inputfstream.is_open()) { - cout << "Error opening file " << argv[2] << " for reading."; + std::cout << "Error opening file " << argv[2] << " for reading."; exit(1); } @@ -216,7 +215,7 @@ int main(int argc, char *argv[], char *env[]) dcomponents->SetAttribute("amount", numcomponents); components_data->LinkEndChild(dcomponents); - string x, y, z, m, sigma, eps, xi, eta; + std::string x, y, z, m, sigma, eps, xi, eta; unsigned int i, j; for (i=0; iSetAttribute("id", j+1); comp->LinkEndChild(dipole); @@ -308,7 +307,7 @@ int main(int argc, char *argv[], char *env[]) } for (j=0; jSetAttribute("id", j+1); comp->LinkEndChild(quadrupole); @@ -348,7 +347,7 @@ int main(int argc, char *argv[], char *env[]) quadrupole->LinkEndChild(ljabsQ); } - string IDummy1, IDummy2, IDummy3; + std::string IDummy1, IDummy2, IDummy3; inputfstream >> IDummy1 >> IDummy2 >> IDummy3; TiXmlElement * dummy1 = new TiXmlElement( "dummy1" ); @@ -398,7 +397,7 @@ int main(int argc, char *argv[], char *env[]) // the rest of the file reflects the new phase space point file // and is thus written to a file. - ofstream outfile; + std::ofstream outfile; outfile.open(outfile_name.c_str() ); if (outfile.is_open()) { @@ -406,18 +405,18 @@ int main(int argc, char *argv[], char *env[]) while (inputfstream) { getline(inputfstream, token); - outfile << token << endl; + outfile << token << std::endl; } outfile.close(); } else { - cout << "Unable to open file " << outfile_name << " for writing."; + std::cout << "Unable to open file " << outfile_name << " for writing."; exit(1); } } else { - cerr << "Warning: Unknown token '" << token << "' at position " - << inputfstream.tellg() << endl; + std::cerr << "Warning: Unknown token '" << token << "' at position " + << inputfstream.tellg() << std::endl; } } @@ -426,23 +425,23 @@ int main(int argc, char *argv[], char *env[]) // Inform the user which command line arguments to use if (output_format != "") { - cout << " * Detected an output token. Please invoke mardyn like this:" - << endl << endl; + std::cout << " * Detected an output token. Please invoke mardyn like this:" + << std::endl << std::endl; if (output_freq == "") { - cout << " MarDyn -o " << output_format.substr(1) << " -p " - << output_file << endl << endl; + std::cout << " MarDyn -o " << output_format.substr(1) << " -p " + << output_file << std::endl << std::endl; } else { - cout << " MarDyn -o " << output_format.substr(1) << " -p " - << output_file << " -f " << output_freq << endl << endl; + std::cout << " MarDyn -o " << output_format.substr(1) << " -p " + << output_file << " -f " << output_freq << std::endl << std::endl; } - cout + std::cout << " Alternatively you can use an appropriate input-file (not yet generated with this tool)." - << endl; + << std::endl; } - cout << " * the phase space point file has been saved in '" << outfile_name - << "'" << endl; + std::cout << " * the phase space point file has been saved in '" << outfile_name + << "'" << std::endl; // Write the resulting XML tree to the file specified doc.LinkEndChild(decl); diff --git a/tools/mksd/Component.cpp b/tools/mksd/Component.cpp index e13203dd8f..a1679771a7 100644 --- a/tools/mksd/Component.cpp +++ b/tools/mksd/Component.cpp @@ -8,8 +8,8 @@ #include "Component.h" // fluids -extern const string FLUID_AR = "Ar"; -extern const string FLUID_CH4 = "CH4"; +extern const std::string FLUID_AR = "Ar"; +extern const std::string FLUID_CH4 = "CH4"; const double EPS_AR = 4.36704e-04; const double SIGMA_AR = 6.40920; @@ -25,9 +25,9 @@ const double T_CRITICAL_1CLJ = 1.0779; // solids -extern const string WALL_CU_LJ = "CU_LJ"; // copper by Lennard-Jones -extern const string WALL_TERSOFF = "Tersoff"; -extern const string WALL_MAT_AKA_FIT = "MatAkaFit"; +extern const std::string WALL_CU_LJ = "CU_LJ"; // copper by Lennard-Jones +extern const std::string WALL_TERSOFF = "Tersoff"; +extern const std::string WALL_MAT_AKA_FIT = "MatAkaFit"; // According to Phillpot, S. R. in: "Reconstruction of grain boundaries in copper and gold by simulation" // Journal of Materials Ressearch, Vol 9, No.3 1994; @@ -41,7 +41,7 @@ double LATTICE_CONST_WALL_LJTS; -Component::Component(string in_substance, bool in_LJunits){ +Component::Component(std::string in_substance, bool in_LJunits){ _substance = in_substance; double facLatConst = 1.0; //0.79852 for sigma_ss = 0.8*sigma_ff and 1.0 for sigma_ss = sigma_ff if (in_LJunits){ @@ -62,7 +62,7 @@ Component::Component(string in_substance, bool in_LJunits){ init1CLJ(_substance); } else{ - cerr << "No other interaction models implemented."; + std::cerr << "No other interaction models implemented."; } } @@ -70,7 +70,7 @@ Component::~Component(){ } -void Component::init1CLJ(string substance){ +void Component::init1CLJ(std::string substance){ // parameters all the 1C LJ fluid models have in common _numberLJCenters = 1; @@ -180,11 +180,11 @@ double Component::calculateLiquidDensity(double T){ / (gSigma(0)*gSigma(0)*gSigma(0)); } else{ - cerr << "Error in Component class: Claculation of the liquid density. Liquid density of the 1C LJ model not calculated!"; + std::cerr << "Error in Component class: Claculation of the liquid density. Liquid density of the 1C LJ model not calculated!"; exit(-201); } //cout << "Calculating rhoLiq in Component:\ngSigma(0) = " << (gSigma(0)) << "\n"<< "temperature = "<< T <<"\n"; - cout << "rhoLiq = " << rhoLiq << "\n"; + std::cout << "rhoLiq = " << rhoLiq << "\n"; return rhoLiq; } @@ -198,11 +198,11 @@ double Component::calculateVaporDensity(double T, double factor){ / (gSigma(0)*gSigma(0)*gSigma(0)); } else{ - cerr << "Error in Component class: Claculation of the liquid density. Liquid density of the 1C LJ model not calculated!"; + std::cerr << "Error in Component class: Claculation of the liquid density. Liquid density of the 1C LJ model not calculated!"; exit(-202); } //cout << "Calculating rhoVap in Component: \ngSigma(0) = " << (gSigma(0)) << "\n"<< "temperature = "<< T <<"\n"; - cout << "rhoVap = " << rhoVap << "\n"; + std::cout << "rhoVap = " << rhoVap << "\n"; return rhoVap; } diff --git a/tools/mksd/Component.h b/tools/mksd/Component.h index 6792f462de..612e61b861 100644 --- a/tools/mksd/Component.h +++ b/tools/mksd/Component.h @@ -16,11 +16,10 @@ #include #include // for pow() -using namespace std; class Component{ private: - string _substance; + std::string _substance; unsigned _numberLJCenters; unsigned _numberCharges; unsigned _numberQuadrupoles; @@ -28,15 +27,15 @@ class Component{ unsigned _numberTersoff; // LJ centers // LJ center position, vector quantities to account for multicenter LJ potentials - vector _vecLJx; - vector _vecLJy; - vector _vecLJz; + std::vector _vecLJx; + std::vector _vecLJy; + std::vector _vecLJz; // mass of each LJ center - vector _vecLJMass; + std::vector _vecLJMass; // energy of each LJ center => eps - vector _vecLJEps; + std::vector _vecLJEps; // length of each LJ center =>sigma - vector _vecLJSigma; + std::vector _vecLJSigma; // Lennard-Jones cut off radius double _TSLJCutOff; @@ -57,11 +56,11 @@ class Component{ public: // the constructor and destructor, respectively // formal arguments of the constructor: substance, reference energy, reference length, reference mass - //Component(string substance); + //Component(std::string substance); // second Constructor, in case reference quantities different from atomic units are allowed -// Component(string in_substance, double refNRG, double refLgth, double refM); +// Component(std::string in_substance, double refNRG, double refLgth, double refM); // another constructor, called if the reference quantities are atomic units - Component(string in_substance, bool in_LJunits); + Component(std::string in_substance, bool in_LJunits); ~Component(); // the methods @@ -92,7 +91,7 @@ class Component{ void sNumberTersoff(unsigned NTers);*/ // (ii) initializing a 1CLJ fluid, parameters depend on the specific fluid (e.g. Argon, CH4, etc.) - void init1CLJ(string substance); + void init1CLJ(std::string substance); // calculating the liquid and vapor densities, respectively double calculateLiquidDensity(double T); diff --git a/tools/mksd/ConfigWriter.cpp b/tools/mksd/ConfigWriter.cpp index 05ce23bcbe..2f24819e77 100644 --- a/tools/mksd/ConfigWriter.cpp +++ b/tools/mksd/ConfigWriter.cpp @@ -11,20 +11,20 @@ const double DT = 0.030620; // corresponds to 1 fs -extern const string WALL_TERSOFF; -extern const string WALL_CU_LJ; +extern const std::string WALL_TERSOFF; +extern const std::string WALL_CU_LJ; extern double LATTICE_CONST_WALL_LJTS; // @brief: implementing the constructor and destructor, respectively ConfigWriter::ConfigWriter( - char* in_prefix, string in_wall, int in_wallLays, double in_refTime, + char* in_prefix, std::string in_wall, int in_wallLays, double in_refTime, unsigned in_profilePhi, unsigned in_profileR, unsigned in_profile_H, unsigned in_profileOutputTimesteps, unsigned initCanon, bool in_movie, Component& fluidComp ) { - cout << "\n**********************************\nConfigwriter opened\n**********************************\n"; + std::cout << "\n**********************************\nConfigwriter opened\n**********************************\n"; thermostat = THERMOSTAT_VELSCALE; sPrefix(in_prefix); sTimestepLength(in_refTime); @@ -51,7 +51,7 @@ ConfigWriter::ConfigWriter( //@todo: if no error reported during test runs => removing the else-branch else { - cout << "wall model: only Lennard-Jones TS.\n"; + std::cout << "wall model: only Lennard-Jones TS.\n"; //return 51; }*/ sProfile (in_profilePhi, in_profileR, in_profile_H); @@ -69,14 +69,14 @@ ConfigWriter::ConfigWriter( sOutputMmspdWriter(500); } - // cout << "\n**********************************\nConstructor of Configwriter finished\n**********************************\n"; + // std::cout << "\n**********************************\nConstructor of Configwriter finished\n**********************************\n"; } -ConfigWriter:: ConfigWriter( char* in_prefix, string in_wall, int in_wallLays, double in_refTime, +ConfigWriter:: ConfigWriter( char* in_prefix, std::string in_wall, int in_wallLays, double in_refTime, unsigned in_profilePhi, unsigned in_profileR, unsigned in_profile_H, unsigned in_profileOutputTimesteps, unsigned initCanon, bool in_movie, PhaseSpaceWriter& psw, Component& fluidComp, double nuAndFac ){ - cout << "\n**********************************\nConfigwriter opened\n**********************************\n"; + std::cout << "\n**********************************\nConfigwriter opened\n**********************************\n"; thermostat = THERMOSTAT_ANDERSEN; sPrefix(in_prefix); sTimestepLength(in_refTime); @@ -103,7 +103,7 @@ ConfigWriter:: ConfigWriter( char* in_prefix, string in_wall, int in_wallLays, d //@todo: if no error reported during test runs => removing the else-branch else { - cout << "wall model: only Lennard-Jones TS.\n"; + std::cout << "wall model: only Lennard-Jones TS.\n"; //return 51; }*/ sProfile (in_profilePhi, in_profileR, in_profile_H); @@ -125,9 +125,9 @@ ConfigWriter:: ConfigWriter( char* in_prefix, string in_wall, int in_wallLays, d double diffCoeffLJ = 0.05; // estimate of the self-diffusion coefficient of the LJ-Fluid nuAndersenSingle = psw.gTemperature()*timestepLength/ averageMassPerParticle/diffCoeffLJ; nuAndersen = nuAndersenSingle*pow(psw.gNTotal(), -2.0/3.0)*nuAndFac; - cout << "nu Andersen: " << nuAndersen << "\n"; + std::cout << "nu Andersen: " << nuAndersen << "\n"; - // cout << "\n**********************************\nConstructor of Configwriter finished\n**********************************\n"; + // std::cout << "\n**********************************\nConstructor of Configwriter finished\n**********************************\n"; } ConfigWriter::~ConfigWriter() @@ -139,11 +139,11 @@ ConfigWriter::~ConfigWriter() //@brief: superior writing method: handling the streams, calling the single write-methods void ConfigWriter::write(){ -// cout << "\n**********************************\nwrite() method of Configwriter started\n**********************************\n"; +// std::cout << "\n**********************************\nwrite() method of Configwriter started\n**********************************\n"; confFile << prefix << "_1R.cfg"; // building the file prefix.cfg - confStrm.open(confFile.str().c_str(), ios::trunc); // linking the file prefix.cfg with confStrm => confStrm writes in prefix.cfg + confStrm.open(confFile.str().c_str(), std::ios::trunc); // linking the file prefix.cfg with confStrm => confStrm writes in prefix.cfg - cout << "\n**********************************\nWriting the config file \n**********************************\n\n"; + std::cout << "\n**********************************\nWriting the config file \n**********************************\n\n"; confStrm << "MDProjectConfig\n"; wTimestepLength(); diff --git a/tools/mksd/ConfigWriter.h b/tools/mksd/ConfigWriter.h index 50c50a6a00..f38abf5e58 100644 --- a/tools/mksd/ConfigWriter.h +++ b/tools/mksd/ConfigWriter.h @@ -20,17 +20,16 @@ const unsigned short THERMOSTAT_VELSCALE = 1; const unsigned short THERMOSTAT_ANDERSEN = 2; -using namespace std; class ConfigWriter{ public: - ConfigWriter( char* prefix, string in_wall, int in_wallLays, double in_refTime, + ConfigWriter( char* prefix, std::string in_wall, int in_wallLays, double in_refTime, unsigned in_profilePhi, unsigned in_profileR, unsigned in_profile_H, unsigned in_profileOutputTimesteps, unsigned initCanon, bool movie, Component& fluidComp ); - ConfigWriter( char* prefix, string in_wall, int in_wallLays, double in_refTime, + ConfigWriter( char* prefix, std::string in_wall, int in_wallLays, double in_refTime, unsigned in_profilePhi, unsigned in_profileR, unsigned in_profile_H, unsigned in_profileOutputTimesteps, unsigned initCanon, bool movie, PhaseSpaceWriter& psw, Component& fluidComp, double nuAndFac ); @@ -99,7 +98,7 @@ class ConfigWriter{ double nuAndersenSingle; double nuAndersen; - string wall; // depicts the wall model + std::string wall; // depicts the wall model unsigned initCanonical; unsigned initStatistics; @@ -121,8 +120,8 @@ class ConfigWriter{ bool _movie; // declaration of the output streams - ofstream confStrm; // Ausgabe-Stream für programminterne Nutzung: wohin C++ primär schreibt - stringstream confFile; // "physikalisch" vorhandene Datei prefix.cfg + std::ofstream confStrm; // Ausgabe-Stream für programminterne Nutzung: wohin C++ primär schreibt + std::stringstream confFile; // "physikalisch" vorhandene Datei prefix.cfg //char* outputString; // used in case the entire data are written as a single string in the config file }; diff --git a/tools/mksd/GlobalStartGeometry.cpp b/tools/mksd/GlobalStartGeometry.cpp index 2f0fcb0cde..46d0c49e5e 100644 --- a/tools/mksd/GlobalStartGeometry.cpp +++ b/tools/mksd/GlobalStartGeometry.cpp @@ -31,11 +31,11 @@ GlobalStartGeometry::GlobalStartGeometry(unsigned in_nFluid, double in_rhoLiq, d _gamma = in_gamma; _nLiq = _nFluid / (1+ (_alpha*_beta*_gamma-1.0) *_rhoVap/_rhoLiq ); _nVap = _nFluid - _nLiq; - cout << "\n**********************************\n"; - cout << "GloablStartGeometry:\n"; + std::cout << "\n**********************************\n"; + std::cout << "GloablStartGeometry:\n"; //cout << "rhoVap = "<< _rhoVap << "\t rhoLiq = " << _rhoLiq << "\n"; - cout << "N liquid: " << _nLiq << "\n"; - cout << "N vapor: " << _nVap << "\n"; + std::cout << "N liquid: " << _nLiq << "\n"; + std::cout << "N vapor: " << _nVap << "\n"; } GlobalStartGeometry::~GlobalStartGeometry(){ @@ -65,19 +65,19 @@ void GlobalStartGeometry::calculateBoxFluidOffset(double hWall, double shielding _effLiq[1] = (_nLiq / _rhoLiq) / (_effLiq[0]*_effLiq[2]); _box[1] = _nVap/_rhoVap/_box[0]/_box[2] + (_effLiq[0]*_effLiq[1]*_effLiq[2])/_box[0]/_box[2] + hWall + shielding; - cout << "hWall: " << hWall << "\n"; - cout << "shielding: " << shielding <<"\n"; - cout << "box[0]: " << _box[0] << "\n"; - cout << "box[1]: " << _box[1] << "\n"; - cout << "box[2]: " << _box[2] << "\n"; + std::cout << "hWall: " << hWall << "\n"; + std::cout << "shielding: " << shielding <<"\n"; + std::cout << "box[0]: " << _box[0] << "\n"; + std::cout << "box[1]: " << _box[1] << "\n"; + std::cout << "box[2]: " << _box[2] << "\n"; effVap[0] = 0.97*_box[0]; effVap[1] = 0.97*(_box[1]-hWall-shielding) ; effVap[2] = 0.97*_box[2]; _grossFluidDens = _nFluid / (_box[0] * _box[2] * (_box[1] - hWall)); - cout << "gross fluid density: " << _grossFluidDens << "\n"; - cout << "critical density 1CLJ: " << RHO_CRITICAL_1CLJ << "\n"; - cout << "vapour fraction x = " << (1.0/_grossFluidDens - 1.0/_rhoLiq) / (1.0/_rhoVap - 1.0/_rhoLiq) << "\n"; + std::cout << "gross fluid density: " << _grossFluidDens << "\n"; + std::cout << "critical density 1CLJ: " << RHO_CRITICAL_1CLJ << "\n"; + std::cout << "vapour fraction x = " << (1.0/_grossFluidDens - 1.0/_rhoLiq) / (1.0/_rhoVap - 1.0/_rhoLiq) << "\n"; _offLiq[0] = 0.5*(_box[0] - _effLiq[0]); _offLiq[1] = hWall + shielding; @@ -116,16 +116,16 @@ void GlobalStartGeometry::calculateBoxFluidOffset(double hWall, double shielding _vapUnit[1] = (double)effVap[1]/_vapUnits[1]; _vapUnit[2] = (double)effVap[2]/_vapUnits[2]; - cout << "_vapUnit[0] = "<< _vapUnit[0] << "\t _vapUnit[1] = " << _vapUnit[1] << "\t _vapUnit[2] = " << _vapUnit[2] << "\n"; - cout << "_vapUnits[0] = "<< _vapUnits[0] << "\t _vapUnits[1] = " << _vapUnits[1] << "\t _vapUnits[2] = " << _vapUnits[2] << "\n"; - cout << "effVap[0] = " << effVap[0] << "\t effVap[1] = " << effVap[1] << "\teffVap[2] = " << effVap[2] << "\n"; + std::cout << "_vapUnit[0] = "<< _vapUnit[0] << "\t _vapUnit[1] = " << _vapUnit[1] << "\t _vapUnit[2] = " << _vapUnit[2] << "\n"; + std::cout << "_vapUnits[0] = "<< _vapUnits[0] << "\t _vapUnits[1] = " << _vapUnits[1] << "\t _vapUnits[2] = " << _vapUnits[2] << "\n"; + std::cout << "effVap[0] = " << effVap[0] << "\t effVap[1] = " << effVap[1] << "\teffVap[2] = " << effVap[2] << "\n"; - cout << "_effLiq[0] = " << _effLiq[0] << "\t _effLiq[1] = " << _effLiq[1] << "\t _effLiq[2] = " << _effLiq[2] <<"\n"; - cout << "upper edge of the liquid cuboid: _effLiq[1] + _offLiq[1] = " << _effLiq[1] + _offLiq[1] << "blub\n"; + std::cout << "_effLiq[0] = " << _effLiq[0] << "\t _effLiq[1] = " << _effLiq[1] << "\t _effLiq[2] = " << _effLiq[2] <<"\n"; + std::cout << "upper edge of the liquid cuboid: _effLiq[1] + _offLiq[1] = " << _effLiq[1] + _offLiq[1] << "blub\n"; _vapFillProbability = _nVap/3.0 / ( _vapUnits[0] * _vapUnits[1] * _vapUnits[2] ); - cout << "_vapFillProbability \t "<< _vapFillProbability << "\n"; + std::cout << "_vapFillProbability \t "<< _vapFillProbability << "\n"; _offVap[0] = 0.1 * _vapUnit[0]; _offVap[1] = _offLiq[1]; @@ -157,19 +157,19 @@ void GlobalStartGeometry::calculateBoxFluidOffset(double hWall, double shielding _effLiq[1] = (_nLiq / _rhoLiq) / (_effLiq[0]*_effLiq[2]); _box[1] = _nVap/_rhoVap/_box[0]/_box[2] + (_effLiq[0]*_effLiq[1]*_effLiq[2])/_box[0]/_box[2] + hWall + shielding; - cout << "hWall: " << hWall << "\n"; - cout << "shielding: " << shielding <<"\n"; - cout << "box[0]: " << _box[0] << "\n"; - cout << "box[1]: " << _box[1] << "\n"; - cout << "box[2]: " << _box[2] << "\n"; + std::cout << "hWall: " << hWall << "\n"; + std::cout << "shielding: " << shielding <<"\n"; + std::cout << "box[0]: " << _box[0] << "\n"; + std::cout << "box[1]: " << _box[1] << "\n"; + std::cout << "box[2]: " << _box[2] << "\n"; effVap[0] = 0.97*_box[0]; effVap[1] = 0.97*(_box[1]-hWall-shielding) ; effVap[2] = 0.97*_box[2]; _grossFluidDens = _nFluid / (_box[0] * _box[2] * (_box[1] - hWall)); - cout << "gross fluid density: " << _grossFluidDens << "\n"; - cout << "critical density 1CLJ: " << RHO_CRITICAL_1CLJ << "\n"; - cout << "vapour fraction x = " << (1.0/_grossFluidDens - 1.0/_rhoLiq) / (1.0/_rhoVap - 1.0/_rhoLiq) << "\n"; + std::cout << "gross fluid density: " << _grossFluidDens << "\n"; + std::cout << "critical density 1CLJ: " << RHO_CRITICAL_1CLJ << "\n"; + std::cout << "vapour fraction x = " << (1.0/_grossFluidDens - 1.0/_rhoLiq) / (1.0/_rhoVap - 1.0/_rhoLiq) << "\n"; _offLiq[0] = 0.5*(_box[0] - _effLiq[0]); _offLiq[1] = hWall + shielding; @@ -208,12 +208,12 @@ void GlobalStartGeometry::calculateBoxFluidOffset(double hWall, double shielding _vapUnit[1] = (double)effVap[1]/_vapUnits[1]; _vapUnit[2] = (double)effVap[2]/_vapUnits[2]; - cout << "_vapUnit[0] = "<< _vapUnit[0] << "\t _vapUnit[1] = " << _vapUnit[1] << "\t _vapUnit[2] = " << _vapUnit[2] << "\n"; - cout << "_vapUnits[0] = "<< _vapUnits[0] << "\t _vapUnits[1] = " << _vapUnits[1] << "\t _vapUnits[2] = " << _vapUnits[2] << "\n"; - cout << "effVap[0] = " << effVap[0] << "\t effVap[1] = " << effVap[1] << "\teffVap[2] = " << effVap[2] << "\n"; + std::cout << "_vapUnit[0] = "<< _vapUnit[0] << "\t _vapUnit[1] = " << _vapUnit[1] << "\t _vapUnit[2] = " << _vapUnit[2] << "\n"; + std::cout << "_vapUnits[0] = "<< _vapUnits[0] << "\t _vapUnits[1] = " << _vapUnits[1] << "\t _vapUnits[2] = " << _vapUnits[2] << "\n"; + std::cout << "effVap[0] = " << effVap[0] << "\t effVap[1] = " << effVap[1] << "\teffVap[2] = " << effVap[2] << "\n"; - cout << "_effLiq[0] = " << _effLiq[0] << "\t _effLiq[1] = " << _effLiq[1] << "\t _effLiq[2] = " << _effLiq[2] <<"\n"; - cout << "upper edge of the liquid cuboid: _effLiq[1] + _offLiq[1] = " << _effLiq[1] + _offLiq[1] << "\n"; + std::cout << "_effLiq[0] = " << _effLiq[0] << "\t _effLiq[1] = " << _effLiq[1] << "\t _effLiq[2] = " << _effLiq[2] <<"\n"; + std::cout << "upper edge of the liquid cuboid: _effLiq[1] + _offLiq[1] = " << _effLiq[1] + _offLiq[1] << "\n"; _vapFillProbability = _nVap/3.0 / ( _vapUnits[0] * _vapUnits[1] * _vapUnits[2] ); @@ -253,7 +253,7 @@ void GlobalStartGeometry::calculateLiqFillProbabilityArray() bool tSwap; _nFilledLiqSlots = 3*_liqUnits[0]*_liqUnits[1]*_liqUnits[2]; -// cout << "number of filled slots at the beginning of Gloablstartgeometry:" << _nFilledSlots <<"\n"; +// std::cout << "number of filled slots at the beginning of Gloablstartgeometry:" << _nFilledSlots <<"\n"; totalNSlots = _nFilledLiqSlots; // slots is and "always" will be the total number of slots nIdeallyFilled = _liqFillProbability * totalNSlots; RandomNumber rdm; @@ -275,7 +275,7 @@ void GlobalStartGeometry::calculateLiqFillProbabilityArray() } } } -/* cout << "Filling" << _nFilledSlots << " out of a total number of " << totalNSlots << "fluid slots. Ideally a number of " +/* std::cout << "Filling" << _nFilledSlots << " out of a total number of " << totalNSlots << "fluid slots. Ideally a number of " << nIdeallyFilled << "fluid slots was to be filled.\n" << "fluidFillProbability = " << _fluidFillProbability << "\n";*/ } @@ -304,7 +304,7 @@ void GlobalStartGeometry::calculateVapFillProbabilityArray(){ bool tSwap; _nFilledVapSlots = 3*_vapUnits[0]*_vapUnits[1]*_vapUnits[2]; -// cout << "number of filled slots at the beginning of Gloablstartgeometry:" << _nFilledSlots <<"\n"; +// std::cout << "number of filled slots at the beginning of Gloablstartgeometry:" << _nFilledSlots <<"\n"; totalNSlots = _nFilledVapSlots; nIdeallyFilled = _vapFillProbability * totalNSlots; RandomNumber rdm; @@ -338,7 +338,7 @@ void GlobalStartGeometry::calculateVapFillProbabilityArray(){ } } } -/* cout << "Filling" << _nFilledSlots << " out of a total number of " << totalNSlots << "fluid slots. Ideally a number of " +/* std::cout << "Filling" << _nFilledSlots << " out of a total number of " << totalNSlots << "fluid slots. Ideally a number of " << nIdeallyFilled << "fluid slots was to be filled.\n" << "fluidFillProbability = " << _fluidFillProbability << "\n";*/ diff --git a/tools/mksd/GlobalStartGeometry.h b/tools/mksd/GlobalStartGeometry.h index f33c208b99..5a356962a9 100644 --- a/tools/mksd/GlobalStartGeometry.h +++ b/tools/mksd/GlobalStartGeometry.h @@ -17,7 +17,6 @@ #include #include"RandomNumber.h" -using namespace std; class GlobalStartGeometry { @@ -88,11 +87,11 @@ class GlobalStartGeometry //@brief: 4-dimensional array addressing single slots that may be filled with a particle // => 3 diemsions for a fluid elementary box (due to 3 directions in space) // and one dimension addressing one of three slots within an elementary box - map< unsigned, map > > > _fill; + std::map< unsigned, std::map > > > _fill; //@brief: 4-dimensional array addressing single slots that may be filled with a vapour particle // => 3 diemsions for a vapour elementary box (due to 3 directions in space) // and one dimension addressing one of three slots within an elementary box - map< unsigned, map > > > _fillVap; + std::map< unsigned, std::map > > > _fillVap; }; #endif /* GLOBALSTARTGEOMETRY_H_ */ diff --git a/tools/mksd/Molecule.cpp b/tools/mksd/Molecule.cpp index fcdf4b0b4e..f26701e10e 100644 --- a/tools/mksd/Molecule.cpp +++ b/tools/mksd/Molecule.cpp @@ -117,7 +117,7 @@ void Molecule::calculateCoordinatesOfWallMolecule(double xLength, double zLength _numberOfMolecules = 0; double stripeWidth = xLength / numberOfStripes; // width of a single stripe in x-direction => delta_x if (stripeWidth < 0.5*latticeConstant){ - cerr << "Too many stripes: width would be smaller than half the lattice constant! Meaningless => width adapted to half the lattice constant!"; + std::cerr << "Too many stripes: width would be smaller than half the lattice constant! Meaningless => width adapted to half the lattice constant!"; stripeWidth = 0.5 * latticeConstant; } double currentZeroPos[3]; @@ -164,7 +164,7 @@ void Molecule::calculateCoordinatesOfWallMolecule(double xLength, double zLength } _numberOfMolecules = 0; if (deltaRCircle < 0.5*latticeConstant){ - cerr << "Circle size chosen too small! delta_r has to be at least 1*lattice constant! delta_r SWITCHED to 1*lattice constant."; + std::cerr << "Circle size chosen too small! delta_r has to be at least 1*lattice constant! delta_r SWITCHED to 1*lattice constant."; deltaRCircle = latticeConstant; } double currentZeroPos[3]; diff --git a/tools/mksd/Molecule.h b/tools/mksd/Molecule.h index 754849f3a1..dbfb9523e5 100644 --- a/tools/mksd/Molecule.h +++ b/tools/mksd/Molecule.h @@ -25,7 +25,6 @@ extern const double PI; -using namespace std; class Molecule { @@ -79,9 +78,9 @@ class Molecule // @brief: the key element of the map is always the internal (within this class only) molecule-ID // the value element of the map is denoted by second part of the name (e.g. position, velocity, component-ID, etc.) and corresponds to the // particular molecule (of any component) - map _moleculePosition[3]; // for the following three maps: the key value starts at 0. - map _moleculeVelocity[3]; - map _moleculeCID; + std::map _moleculePosition[3]; // for the following three maps: the key value starts at 0. + std::map _moleculeVelocity[3]; + std::map _moleculeCID; //map _moleculeComponentID; }; diff --git a/tools/mksd/PhaseSpaceWriter.cpp b/tools/mksd/PhaseSpaceWriter.cpp index 097d4e7292..ca84cf5e16 100644 --- a/tools/mksd/PhaseSpaceWriter.cpp +++ b/tools/mksd/PhaseSpaceWriter.cpp @@ -8,16 +8,16 @@ #include"PhaseSpaceWriter.h" extern double LATTICE_CONST_WALL_LJTS; -extern const string WALL_CU_LJ; +extern const std::string WALL_CU_LJ; // constructor -PhaseSpaceWriter::PhaseSpaceWriter(string in_prefix, double in_Temperature, double in_densFac, unsigned in_nFluid, string in_fluidComponent, - string in_wallComponent, unsigned in_wallLayers, double in_xi12, double in_xi13, double in_eta12, double in_alpha, double in_beta, double in_gamma, double in_edgeProp, bool in_stripes, +PhaseSpaceWriter::PhaseSpaceWriter(std::string in_prefix, double in_Temperature, double in_densFac, unsigned in_nFluid, std::string in_fluidComponent, + std::string in_wallComponent, unsigned in_wallLayers, double in_xi12, double in_xi13, double in_eta12, double in_alpha, double in_beta, double in_gamma, double in_edgeProp, bool in_stripes, unsigned in_numberOfStripes, bool in_LJShifted, bool in_LJunits) { - cout << "\n\n**********************************\nPhaseSpaceWriter opened\n"; - cout << "writing the header ...\n**********************************\n"; + std::cout << "\n\n**********************************\nPhaseSpaceWriter opened\n"; + std::cout << "writing the header ...\n**********************************\n"; _fileName = in_prefix + ".inp"; _fileNameXyz = in_prefix+".xyz"; _fluidComponentName = in_fluidComponent; @@ -37,12 +37,12 @@ PhaseSpaceWriter::PhaseSpaceWriter(string in_prefix, double in_Temperature, doub _numberOfStripes = in_numberOfStripes; _LJShifted = in_LJShifted; _LJunits = in_LJunits; -// cout << "\n**********************************\nPhaseSpaceWriter constructor finished\n**********************************\n"; +// std::cout << "\n**********************************\nPhaseSpaceWriter constructor finished\n**********************************\n"; /* // generating the ofstream, i.e. the phase space file - psstrm(_fileName.c_str(), ios::binary|ios::out); + psstrm(_fileName.c_str(), std::ios::binary|std::ios::out); if(!psstrm){ // simple error handling: ofstream MUST exist - cerr << "Error in constructor of PhaseSpaceWriter:\nPhase space file \""<< _fileName <<"\" cannot be opened."; + std::cerr << "Error in constructor of PhaseSpaceWriter:\nPhase space file \""<< _fileName <<"\" cannot be opened."; exit(-50); } */ @@ -54,25 +54,25 @@ PhaseSpaceWriter::~PhaseSpaceWriter(){ void PhaseSpaceWriter::write() { -// cout <<"\n**********************************\n PhaseSpaceWriter write() method started\n**********************************\n"; +// std::cout <<"\n**********************************\n PhaseSpaceWriter write() method started\n**********************************\n"; //@brief: wirting the header // generating the ofstream, i.e. the phase space file. - ofstream psstrm(_fileName.c_str(), ios::binary|ios::out); + std::ofstream psstrm(_fileName.c_str(), std::ios::binary|std::ios::out); if(!psstrm){ // simple error handling: ofstream MUST exist - cerr << "Error in 'write()'-method of PhaseSpaceWriter:\nPhase space file \""<< _fileName <<"\" cannot be opened."; + std::cerr << "Error in 'write()'-method of PhaseSpaceWriter:\nPhase space file \""<< _fileName <<"\" cannot be opened."; exit(101); } // xyz file format, to be used for VMD-visualisation - ofstream xyzstrm(_fileNameXyz.c_str(), ios::binary|ios::out); + std::ofstream xyzstrm(_fileNameXyz.c_str(), std::ios::binary|std::ios::out); if(!xyzstrm){ // simple error handling: ofstream MUST exist - cerr << "Error in constructor of PhaseSpaceWriter:\nPhase space file \""<< _fileNameXyz <<"\" cannot be opened."; + std::cerr << "Error in constructor of PhaseSpaceWriter:\nPhase space file \""<< _fileNameXyz <<"\" cannot be opened."; exit(101); } Component fluidComp(_fluidComponentName, _LJunits); GlobalStartGeometry geometry(_nFluid, fluidComp.calculateLiquidDensity(_temperature), fluidComp.calculateVaporDensity(_temperature, _densFac), _alpha, _beta, _gamma); -// cout << "\n**********************************\n objects of classes 'Component' and 'GlobalStartGeometry' generated\n**********************************\n"; +// std::cout << "\n**********************************\n objects of classes 'Component' and 'GlobalStartGeometry' generated\n**********************************\n"; unsigned numberOfComponents; if(_stripes){ numberOfComponents = 3; @@ -86,7 +86,7 @@ void PhaseSpaceWriter::write() latticeConst= LATTICE_CONST_WALL_LJTS; } else{ - cerr << "error in PhaseSpaceWriter.write(): no lattice const available for this wall model."; + std::cerr << "error in PhaseSpaceWriter.write(): no lattice const available for this wall model."; exit(102); } hWall = latticeConst * (_wallLayers-0.5); @@ -139,7 +139,7 @@ void PhaseSpaceWriter::write() _avMass = (_nFluid*fluidComp.gMass(0) + (_nTotal-_nFluid)*wallComp.gMass(0))/_nTotal; -// cout << "\n**********************************\nobject 'wallComp' of the 'Component' class generated.\n**********************************\n"; +// std::cout << "\n**********************************\nobject 'wallComp' of the 'Component' class generated.\n**********************************\n"; // so far no other models than LJ implemented => no scheme for writing the model parameters corresponding to charges, dipoles, etc. //*************************************************************************************************************************************** @@ -159,7 +159,7 @@ void PhaseSpaceWriter::write() Molecule wallMolecule(_temperature, wallComp.gMass(0)); -// cout << "\n**********************************\nobject walMolecule of the class 'Molecule' generated\n**********************************\n"; +// std::cout << "\n**********************************\nobject walMolecule of the class 'Molecule' generated\n**********************************\n"; /*wallMolecule.calculateCoordinatesOfWallMolecule(_wallLayers, geometry.gBoxLength(0), geometry.gBoxLength(1), geometry.gBoxLength(2), geometry.gOffset(0), geometry.gOffset(1), geometry.gOffset(2), latticeConst);*/ @@ -171,7 +171,7 @@ void PhaseSpaceWriter::write() wallMolecule.calculateCoordinatesOfWallMolecule(geometry.gBoxLength(0),geometry.gBoxLength(2), geometry.gOffsetLiq(1), latticeConst, shielding); } -// cout<< "\n**********************************\n coordinates of wall molecules calculated\n**********************************\n"; +// std::cout<< "\n**********************************\n coordinates of wall molecules calculated\n**********************************\n"; // total number of particles geometry.calculateLiqFillProbabilityArray(); // within this method the number of actually filled liquid particles is calculated, too => already called here @@ -198,7 +198,7 @@ void PhaseSpaceWriter::write() //cout << "fluidUnit[0]: "< collision with the wall! if(geometry.gBoxLength(j) < positionVec[j]){ - cerr << "Severe error in PhaseSpaceWriter::write() => writing the fluid positions:\n" + std::cerr << "Severe error in PhaseSpaceWriter::write() => writing the fluid positions:\n" << "Fluid particle placed within wall due to PBC in y-direction!!!\n"; exit(104); } @@ -258,7 +258,7 @@ void PhaseSpaceWriter::write() } else{ // PBC in y-direction => collision with the wall! if(geometry.gBoxLength(j) < positionVec[j]){ - cerr << "Severe error in PhaseSpaceWriter::write() => writing the fluid positions:\n" + std::cerr << "Severe error in PhaseSpaceWriter::write() => writing the fluid positions:\n" << "Fluid particle placed within wall due to PBC in y-direction!!!\n"; exit(104); } @@ -284,8 +284,8 @@ void PhaseSpaceWriter::write() // wall molecules are being filled wallMolecule.calculateVelocities(); unsigned numberOfWallMolecules = wallMolecule.gNumberOfMolecules(); - cout << "Number of fluid molecules: " << geometry.gNFilledLiqSlots() + geometry.gNFilledVapSlots()<< "\n"; - cout << "Number of wall molecules: "<< numberOfWallMolecules <<"\n**********************************\n\n"; + std::cout << "Number of fluid molecules: " << geometry.gNFilledLiqSlots() + geometry.gNFilledVapSlots()<< "\n"; + std::cout << "Number of wall molecules: "<< numberOfWallMolecules <<"\n**********************************\n\n"; for (unsigned i = 0; i < numberOfWallMolecules; i++){ psstrm << id <<" "<< wallMolecule.gMoleculeCID(i) <<"\t"<< wallMolecule.gXPos(i) <<" "<< wallMolecule.gYPos(i) <<" "<< wallMolecule.gZPos(i) << "\t"<< wallMolecule.gXVelocity(i) <<" "<< wallMolecule.gYVelocity(i) <<" "<< wallMolecule.gZVelocity(i) @@ -297,8 +297,8 @@ void PhaseSpaceWriter::write() xyzstrm << "N \t"<< wallMolecule.gXPos(i) <<" "<< wallMolecule.gYPos(i) <<" "<< wallMolecule.gZPos(i) <<"\n"; } if (wallMolecule.gMoleculeCID(i) != 3 && wallMolecule.gMoleculeCID(i) != 2 ){ - cerr << "!!!Error: wall cid differs from 2 or 3, respectively! cid = " << wallMolecule.gMoleculeCID(i) << "\n"; - cerr << "id = " << id <<"\n"; + std::cerr << "!!!Error: wall cid differs from 2 or 3, respectively! cid = " << wallMolecule.gMoleculeCID(i) << "\n"; + std::cerr << "id = " << id <<"\n"; } id++; } // end for(i...) diff --git a/tools/mksd/PhaseSpaceWriter.h b/tools/mksd/PhaseSpaceWriter.h index 64ad410c9b..1a46b22abd 100644 --- a/tools/mksd/PhaseSpaceWriter.h +++ b/tools/mksd/PhaseSpaceWriter.h @@ -18,15 +18,14 @@ #include"Component.h" #include"RandomNumber.h" -using namespace std; class PhaseSpaceWriter{ public: // constructor + destructor - PhaseSpaceWriter(string in_prefix, double in_Temperature, double in_densFac, unsigned in_nFluid, string in_fluidComponent, - string in_wallComponent, unsigned in_wallLayers, double in_xi12, double in_xi13, double in_eta, double in_alpha, double in_beta, double in_gamma, double in_edgeProp, bool in_stripes, + PhaseSpaceWriter(std::string in_prefix, double in_Temperature, double in_densFac, unsigned in_nFluid, std::string in_fluidComponent, + std::string in_wallComponent, unsigned in_wallLayers, double in_xi12, double in_xi13, double in_eta, double in_alpha, double in_beta, double in_gamma, double in_edgeProp, bool in_stripes, unsigned in_numberOfStripes, bool in_LJShifted, bool in_LJunits); ~PhaseSpaceWriter(); @@ -41,10 +40,10 @@ class PhaseSpaceWriter{ private: - string _fileName; - string _fileNameXyz; - string _fluidComponentName; - string _wallComponentName; + std::string _fileName; + std::string _fileNameXyz; + std::string _fluidComponentName; + std::string _wallComponentName; unsigned _nFluid; unsigned _nTotal; unsigned _wallLayers; @@ -64,8 +63,8 @@ class PhaseSpaceWriter{ bool _LJunits; // ofstream: phase space stream -// ofstream _psstrm; - // stringstream +// std::ofstream _psstrm; + // std::stringstream //stringstream _strstrm; }; diff --git a/tools/mksd/RandomNumber.cpp b/tools/mksd/RandomNumber.cpp index bc66bfde4d..3e07a984c5 100644 --- a/tools/mksd/RandomNumber.cpp +++ b/tools/mksd/RandomNumber.cpp @@ -11,7 +11,6 @@ */ #include"RandomNumber.h" -using namespace std; //@brief: rand() is initialized by srand(time). srand() is called in main.cpp. diff --git a/tools/mksd/RandomNumber.h b/tools/mksd/RandomNumber.h index a5c8a5ff2d..f786563d71 100644 --- a/tools/mksd/RandomNumber.h +++ b/tools/mksd/RandomNumber.h @@ -9,7 +9,6 @@ #define RANDNUM_H_ #include -using namespace std; class RandomNumber{ public: diff --git a/tools/mksd/main.cpp b/tools/mksd/main.cpp index 420be252ab..07e3dc5da0 100644 --- a/tools/mksd/main.cpp +++ b/tools/mksd/main.cpp @@ -16,13 +16,12 @@ #include "PhaseSpaceWriter.h" #include "Component.h" -using namespace std; -extern const string FLUID_AR; -extern const string FLUID_CH4; -extern const string WALL_CU_LJ; // copper by Lennard-Jones -extern const string WALL_TERSOFF; -extern const string WALL_MAT_AKA_FIT; +extern const std::string FLUID_AR; +extern const std::string FLUID_CH4; +extern const std::string WALL_CU_LJ; // copper by Lennard-Jones +extern const std::string WALL_TERSOFF; +extern const std::string WALL_MAT_AKA_FIT; extern const unsigned short THERMOSTAT_VELSCALE; extern const unsigned short THERMOSTAT_ANDERSEN; @@ -67,9 +66,9 @@ int main(int argc, char** argv){ "-x13 \t the Berthelot combining rule interaction parameter xi between the components 1 and 3. \n" "\n*********************************************************************************************************\n\n"; if((argc<10)||(argc>35)){ - cout << "\n\n*********************************************************************************************************\n" + std::cout << "\n\n*********************************************************************************************************\n" << "There are "<< floor(0.5*(argc-1)) << " complete arguments where 5 to 19 should be given.\n\n"; - cout << usage ; + std::cout << usage ; return 1; } @@ -111,13 +110,13 @@ unsigned short thermostat = THERMOSTAT_VELSCALE; // ==1 --> applying velocity sc int outTimeSteps, wallThick; double alpha, beta, gamm, edgeProp, densFac, eta12, sigWall, temp, xi12, xi13, nuFactor; char* prefix = (char*)0; // name of the output file as a C-string, initialized by NULL pointer -string fluid, wall, prefixStr; +std::string fluid, wall, prefixStr; // processing the arguments put in the command line for(int i = 1; i < argc; i++){ if(*argv[i] != '-'){ - cout <<"\nFlag expected where '"<< argv[i] << "' was given. \n\n"; - cout << usage; + std::cout <<"\nFlag expected where '"<< argv[i] << "' was given. \n\n"; + std::cout << usage; return 2; } for(unsigned j=1; argv[i][j]; j++) @@ -148,7 +147,7 @@ for(int i = 1; i < argc; i++){ i++; gamm = atof(argv[i]); if (gamm < 1.1){ - cout << "Value chosen for gamma too small! Choose value bigger than 1.1!\n\n"; + std::cout << "Value chosen for gamma too small! Choose value bigger than 1.1!\n\n"; return 14; } break; @@ -186,7 +185,7 @@ for(int i = 1; i < argc; i++){ else if(!strcmp(argv[i], "C6H14")) fluid = FLUID_C6H14;*/ else { - cout << "Fluid " << argv[i] << "is not available. \n\n" << usage; + std::cout << "Fluid " << argv[i] << "is not available. \n\n" << usage; return 3; } break; @@ -265,7 +264,7 @@ for(int i = 1; i < argc; i++){ else if(!strcmp(argv[i], "MatAkaFit")) wall = WALL_MAT_AKA_FIT; else { - cout << "Wall model" << argv[i] << "is not available. \n\n" << usage; + std::cout << "Wall model" << argv[i] << "is not available. \n\n" << usage; return 4; } break; @@ -291,27 +290,27 @@ for(int i = 1; i < argc; i++){ // (i) completeness => mandatory arguments: file name (i.e. prefix), number of fluid particles, temperature, wall thickness, xi_fluid_wall if(in_prefix == false) { - cout << "No output prefix specified. \n\n" << usage; + std::cout << "No output prefix specified. \n\n" << usage; return 5; } if(in_N == false) { - cout << "Number of fluid particles not specified. \n\n" << usage; + std::cout << "Number of fluid particles not specified. \n\n" << usage; return 6; } if(in_temperature == false) { - cout << "No temeprature specified. \n\n" << usage; + std::cout << "No temeprature specified. \n\n" << usage; return 7; } if(in_wallThick == false) { - cout << "Wall thickness not specified. \n\n" << usage; + std::cout << "Wall thickness not specified. \n\n" << usage; return 8; } if(in_xi12 == false) { - cout << "Berthelot combining rule: xi_12 not specified. \n\n" << usage; + std::cout << "Berthelot combining rule: xi_12 not specified. \n\n" << usage; return 9; } // (ii) consistency @@ -319,24 +318,24 @@ if(in_wallModel == true) { if(wall == WALL_TERSOFF) { - cout << "The Tersoff potential is not implemented yet.\n\n" << usage; + std::cout << "The Tersoff potential is not implemented yet.\n\n" << usage; return 10; } else if(wall == WALL_MAT_AKA_FIT) { - cout << "The model rendering TiO2 by fitting the Matsui+Akaogi potential is not implemented yet. \n\n" << usage; + std::cout << "The model rendering TiO2 by fitting the Matsui+Akaogi potential is not implemented yet. \n\n" << usage; return 11; } } if(!stripes && in_xi13){ - cout << "\n\n*********************************************************************************************************\n"; - cout << "Surplus specification of the Berthelot xi_13:\nHas to be specified for the mixing rule of components 1 and 3 only \n" + std::cout << "\n\n*********************************************************************************************************\n"; + std::cout << "Surplus specification of the Berthelot xi_13:\nHas to be specified for the mixing rule of components 1 and 3 only \n" "if there is a stripes shaped wall! (or any other kind of three component system)\n\n" << usage; return 12; } else if(stripes && ! in_xi13){ - cout << "\n\n*********************************************************************************************************\n"; - cout << "No xi_13 specified: \nIf a stripes shaped wall is employed the Berthelot xi_13 must be specified.\n\n" << usage ; + std::cout << "\n\n*********************************************************************************************************\n"; + std::cout << "No xi_13 specified: \nIf a stripes shaped wall is employed the Berthelot xi_13 must be specified.\n\n" << usage ; return 12; } @@ -345,7 +344,7 @@ else if(stripes && ! in_xi13){ //@todo: stripes shaped wall if(stripes == true) { - cout << "A wall exhibiting different values of xi in a stripes shaped manner is not implemented yet. \n\n" << usage; + std::cout << "A wall exhibiting different values of xi in a stripes shaped manner is not implemented yet. \n\n" << usage; return 12; } */ @@ -354,7 +353,7 @@ if(stripes == true) /* if(LJunits == true) { - cout<<"Input in Lennard-Jones units not enabled yet. Atomic units to be used instead. \n\n" << usage; + std::cout<<"Input in Lennard-Jones units not enabled yet. Atomic units to be used instead. \n\n" << usage; return 13; }*/ @@ -404,7 +403,7 @@ if(!in_numProfileUnits){ // generating an instance of ConfigWriter and calling the write method if(thermostat == THERMOSTAT_VELSCALE){ - cout << "Velocity scaling applied \n"; + std::cout << "Velocity scaling applied \n"; ConfigWriter CfgWriter(prefix, wall, wallThick, refTime, profilePhi, profileR, profileH, outTimeSteps, initCanon, movie, fluidComp); CfgWriter.write(); } diff --git a/tools/moldy2mardyn.cpp b/tools/moldy2mardyn.cpp index 747d269fad..642b763dcf 100644 --- a/tools/moldy2mardyn.cpp +++ b/tools/moldy2mardyn.cpp @@ -7,20 +7,19 @@ #include #include "../src/External/tinyxpath/xpath_static.h" -using namespace std; int main(int argc, char *argv[], char *env[]) { if (argc < 4) { - cout + std::cout << "Syntax: moldy2mardyn " - << endl; + << std::endl; exit(1); } // define the output filename - string outfile_name = "new-"; + std::string outfile_name = "new-"; outfile_name.append(argv[2]); TiXmlDocument doc; @@ -74,14 +73,14 @@ int main(int argc, char *argv[], char *env[]) phase_space->SetAttribute("source", outfile_name.c_str() ); phase_space->SetAttribute("format", "ASCII"); - string token; + std::string token; fstream inputfstream; // Parse the .inp file inputfstream.open(argv[2]); if (!inputfstream.is_open()) { - cout << "Error opening file " << argv[2] << " for reading."; + std::cout << "Error opening file " << argv[2] << " for reading."; exit(1); } @@ -139,7 +138,7 @@ int main(int argc, char *argv[], char *env[]) dcomponents->SetAttribute("amount", numcomponents); components_data->LinkEndChild(dcomponents); - string x, y, z, m, sigma, eps, xi, eta; + std::string x, y, z, m, sigma, eps, xi, eta; unsigned int i, j; for (i=0; iSetAttribute("id", j+1); comp->LinkEndChild(dipole); @@ -231,7 +230,7 @@ int main(int argc, char *argv[], char *env[]) } for (j=0; jSetAttribute("id", j+1); comp->LinkEndChild(quadrupole); @@ -271,7 +270,7 @@ int main(int argc, char *argv[], char *env[]) quadrupole->LinkEndChild(ljabsQ); } - string IDummy1, IDummy2, IDummy3; + std::string IDummy1, IDummy2, IDummy3; inputfstream >> IDummy1 >> IDummy2 >> IDummy3; TiXmlElement * dummy1 = new TiXmlElement( "dummy1" ); @@ -319,44 +318,44 @@ int main(int argc, char *argv[], char *env[]) epsilon_rf->LinkEndChild(epsilon_rf_text); dcomponents->LinkEndChild(epsilon_rf); - cout << "Warning: falling back to linked cells data-structure" << endl; + std::cout << "Warning: falling back to linked cells data-structure" << std::endl; TiXmlElement * data_structure_type = new TiXmlElement( "linked-cells" ); data_structure->LinkEndChild(data_structure_type); TiXmlText * linked_cells_text = new TiXmlText( "1" ); data_structure_type->LinkEndChild(linked_cells_text); - ofstream outfile; + std::ofstream outfile; outfile.open(outfile_name.c_str() ); if (outfile.is_open()) { getline(inputfstream, token); inputfstream >> token; inputfstream >> token; - outfile << "NumberOfMolecules\t" << token << endl; + outfile << "NumberOfMolecules\t" << token << std::endl; inputfstream >> token; outfile << "MoleculeFormat\t\t" << token; while (inputfstream) { getline(inputfstream, token); - outfile << token << endl; + outfile << token << std::endl; } outfile.close(); } else { - cout << "Unable to open file " << outfile_name << " for writing."; + std::cout << "Unable to open file " << outfile_name << " for writing."; exit(1); } } else { - cerr << "Warning: Unknown token '" << token << "' at position " - << inputfstream.tellg() << endl; + std::cerr << "Warning: Unknown token '" << token << "' at position " + << inputfstream.tellg() << std::endl; } } inputfstream.close(); - cout << " * the phase space point file has been saved in '" << outfile_name - << "'" << endl; + std::cout << " * the phase space point file has been saved in '" << outfile_name + << "'" << std::endl; // Write the resulting XML tree to the file specified doc.LinkEndChild(decl); diff --git a/tools/standalone-generators/animake/Domain.cpp b/tools/standalone-generators/animake/Domain.cpp index 9f988507c5..f5cde0f6ba 100644 --- a/tools/standalone-generators/animake/Domain.cpp +++ b/tools/standalone-generators/animake/Domain.cpp @@ -26,8 +26,8 @@ Domain::Domain( void Domain::write(char* prefix, int format, double mu, double x) { - ofstream xdr, txt, buchholz; - stringstream strstrm, txtstrstrm, buchholzstrstrm; + std::ofstream xdr, txt, buchholz; + std::stringstream strstrm, txtstrstrm, buchholzstrstrm; if(format == FORMAT_BRANCH) { strstrm << prefix << ".xdr"; @@ -36,7 +36,7 @@ void Domain::write(char* prefix, int format, double mu, double x) { strstrm << prefix << ".inp"; } - xdr.open(strstrm.str().c_str(), ios::trunc); + xdr.open(strstrm.str().c_str(), std::ios::trunc); if(format == FORMAT_BRANCH) { txtstrstrm << prefix << "_1R.txt"; @@ -49,7 +49,7 @@ void Domain::write(char* prefix, int format, double mu, double x) { txtstrstrm << prefix << "_1R.xml"; } - txt.open(txtstrstrm.str().c_str(), ios::trunc); + txt.open(txtstrstrm.str().c_str(), std::ios::trunc); if(format == FORMAT_BERNREUTHER) { txt << "\n #include -using namespace std; #define TIME 20130802 diff --git a/tools/standalone-generators/animake/main.cpp b/tools/standalone-generators/animake/main.cpp index fcfe58c868..c6f2f75e1d 100644 --- a/tools/standalone-generators/animake/main.cpp +++ b/tools/standalone-generators/animake/main.cpp @@ -5,16 +5,15 @@ #include #include -using namespace std; int main(int argc, char** argv) { const char* usage = "usage: animake -c [-e] [-f ] [-g ] [-J ] [-m ] -N [-r] [-s ] -T [-u] [-W ] [-x <2nd comp. mole fract.>] [-Y ] [-y [-z ]] [-5 ]\n\n-e\tuse B-e-rnreuther format\n-f\tCH4 (default), Ar, C2H6, N2, CO2, EOX, JES, MER, TOL or VEG\n-r\tuse b-r-anch format\n-s\tgiven in units of Angstrom; default: 1 = 0.5291772 A\n-u\tuse B-u-chholz format (active by default)\n-W\tgiven in units of K; default value: 1 = 315774.5 K\n-Y\tgiven in units of g/mol; default value: 1 = 1000 g/mol\n\n"; if((argc < 8) || (argc > 23)) { - cout << "There are " << argc + std::cout << "There are " << argc << " arguments where 8 to 23 should be given.\n\n"; - cout << usage; + std::cout << usage; return 1; } @@ -46,9 +45,9 @@ int main(int argc, char** argv) { if(*argv[i] != '-') { - cout << "Flag expected where '" << argv[i] + std::cout << "Flag expected where '" << argv[i] << "' was given.\n\n"; - cout << usage; + std::cout << usage; return 2; } for(int j=1; argv[i][j]; j++) @@ -77,7 +76,7 @@ int main(int argc, char** argv) else if(!strcmp(argv[i], "VEG")) fluid = FLUID_VEG; else { - cout << "Fluid '" << argv[i] + std::cout << "Fluid '" << argv[i] << "' is not available.\n\n" << usage; return 9; } @@ -99,7 +98,7 @@ int main(int argc, char** argv) else if(!strcmp(argv[i], "VEG")) fluid2 = FLUID_VEG; else { - cout << "(Secondary) fluid '" << argv[i] + std::cout << "(Secondary) fluid '" << argv[i] << "' is not available.\n\n" << usage; return 99; } @@ -188,43 +187,43 @@ int main(int argc, char** argv) if(!in_XIF) XIF = 1.0; if(!in_XIF && in_fluid2 && (((fluid == FLUID_MER) && (fluid2 == FLUID_TOL)) || ((fluid == FLUID_TOL) && (fluid2 == FLUID_MER)))) { - cerr << "Default binary parameter for the modified Berthelot mixing rule with CO2 (Merker) and toluene xi = 0.95.\n"; + std::cerr << "Default binary parameter for the modified Berthelot mixing rule with CO2 (Merker) and toluene xi = 0.95.\n"; XIF = 0.95; } if(!in_rho) { - cout << "Fatal error: no fluid density was specified.\n\n"; - cout << usage; + std::cout << "Fatal error: no fluid density was specified.\n\n"; + std::cout << usage; return 16; } if(in_dimz && !in_dimy) { - cout << "Fatal error: z is specified while y is unknown. Please replace the -z option by -y.\n\n"; - cout << usage; + std::cout << "Fatal error: z is specified while y is unknown. Please replace the -z option by -y.\n\n"; + std::cout << usage; return 17; } if(!in_fluid) fluid = FLUID_CH4; if(!in_N) { - cout << "The essential input parameter " + std::cout << "The essential input parameter " << "N (number of fluid molecules) is missing.\n\n" << usage; return 20; } if(!in_T) { - cout << "Unspecified temperature: aborting.\n\n"; - cout << usage; + std::cout << "Unspecified temperature: aborting.\n\n"; + std::cout << usage; return 21; } if(in_x && ((x < 0.0) || (x > 1.0))) { - cout << "Invalid mole fraction x = " << x << ".\n\n" << usage; + std::cout << "Invalid mole fraction x = " << x << ".\n\n" << usage; return 15; } if((fluid2 != FLUID_NIL) && !in_x) { - cout << "Unspecified composition: aborting.\n\n"; - cout << usage; + std::cout << "Unspecified composition: aborting.\n\n"; + std::cout << usage; return 24; } if((in_fluid2 == false) || (fluid2 == FLUID_NIL)) diff --git a/tools/standalone-generators/mkcp/Domain.cpp b/tools/standalone-generators/mkcp/Domain.cpp index 081a3d471e..1cc845ffeb 100644 --- a/tools/standalone-generators/mkcp/Domain.cpp +++ b/tools/standalone-generators/mkcp/Domain.cpp @@ -126,8 +126,8 @@ void Domain::writeGraphite( double TAU, double U, bool original, double wo_acceleration, double polarity, bool WLJ, bool symmetric, bool widom, double x ) { - ofstream xdr, txt, buchholz; - stringstream strstrm, txtstrstrm, buchholzstrstrm; + std::ofstream xdr, txt, buchholz; + std::stringstream strstrm, txtstrstrm, buchholzstrstrm; if(format == FORMAT_BRANCH) { strstrm << prefix << ".xdr"; @@ -136,7 +136,7 @@ void Domain::writeGraphite( { strstrm << prefix << ".inp"; } - xdr.open(strstrm.str().c_str(), ios::trunc); + xdr.open(strstrm.str().c_str(), std::ios::trunc); if(format == FORMAT_BRANCH) { txtstrstrm << prefix << "_1R.txt"; @@ -145,11 +145,11 @@ void Domain::writeGraphite( { txtstrstrm << prefix << "_1R.cfg"; } - txt.open(txtstrstrm.str().c_str(), ios::trunc); + txt.open(txtstrstrm.str().c_str(), std::ios::trunc); if(format == FORMAT_BUCHHOLZ) { buchholzstrstrm << prefix << "_1R.xml"; - buchholz.open(buchholzstrstrm.str().c_str(), ios::trunc); + buchholz.open(buchholzstrstrm.str().c_str(), std::ios::trunc); /* * Gesamter Inhalt der Buchholz-Datei @@ -167,11 +167,11 @@ void Domain::writeGraphite( ); double REFTIME = SIG_REF * sqrt(REFMASS / EPS_REF); double VEL_REF = SIG_REF / REFTIME; - cout << "Velocity unit 1 = " << VEL_REF << " * 1620.34 m/s = " + std::cout << "Velocity unit 1 = " << VEL_REF << " * 1620.34 m/s = " << 1620.34 * VEL_REF << " m/s.\n"; double ACC_REF = VEL_REF / REFTIME; double REFCARG = sqrt(EPS_REF * SIG_REF); - cout << "Charge unit 1 = " << REFCARG << " e.\n"; + std::cout << "Charge unit 1 = " << REFCARG << " e.\n"; double QDR_REF = SIG_REF*SIG_REF * REFCARG; double REFOMGA = 1.0 / REFTIME; @@ -195,7 +195,7 @@ void Domain::writeGraphite( { tswap = (N1a < N_id); pswap = (N_id - (double)N1a) / ((tswap? slots: 0.0) - (double)N1a); - cout << "(N_id = " << N_id << ", N1a = " << N1a << ", tswap = " << tswap << ", pswap = " << pswap << ")\n"; + std::cout << "(N_id = " << N_id << ", N1a = " << N1a << ", tswap = " << tswap << ", pswap = " << pswap << ")\n"; for(unsigned i=0; i < fl_units[0]; i++) for(unsigned j=0; j < fl_units[1]; j++) for(unsigned k=0; k < fl_units[2]; k++) @@ -208,7 +208,7 @@ void Domain::writeGraphite( if(tswap) N1a++; } } - cout << "Filling " << N1a << " of " << repl << " x 3*" + std::cout << "Filling " << N1a << " of " << repl << " x 3*" << fl_units[0] << "*" << fl_units[1] << "*" << fl_units[2] << " = " << slots << " slots (ideally " << N_id << ").\n\n"; } @@ -230,7 +230,7 @@ void Domain::writeGraphite( { tswap = (N1b < N_id); pswap = (N_id - (double)N1b) / ((tswap? slots: 0.0) - (double)N1b); - cout << "(N_id = " << N_id << ", N1b = " << N1b << ", tswap = " << tswap << ", pswap = " << pswap << ")\n"; + std::cout << "(N_id = " << N_id << ", N1b = " << N1b << ", tswap = " << tswap << ", pswap = " << pswap << ")\n"; for(unsigned i=0; i < fl_units_ext[0]; i++) for(unsigned j=0; j < fl_units_ext[1]; j++) for(unsigned k=0; k < fl_units_ext[2]; k++) @@ -243,7 +243,7 @@ void Domain::writeGraphite( if(tswap) N1b++; } } - cout << "Filling " << N1b << " of " << repl << " x 3*" + std::cout << "Filling " << N1b << " of " << repl << " x 3*" << fl_units_ext[0] << "*" << fl_units_ext[1] << "*" << fl_units_ext[2] << " = " << slots << " extension slots (ideally " << N_id << ").\n\n"; } @@ -268,7 +268,7 @@ void Domain::writeGraphite( 1, this->box[0], this->box[2], this->bondlength, this->wo_wall ); Ngraphene = gra.getNumberOfAtoms(); - cout << "Inserting " << repl*d << " x " << Ngraphene + std::cout << "Inserting " << repl*d << " x " << Ngraphene << " carbon atoms.\n"; Ntotal += repl * d * Ngraphene; } @@ -350,7 +350,7 @@ void Domain::writeGraphite( } else { - cout << "Unavailable fluid ID " << fluid << ".\n"; + std::cout << "Unavailable fluid ID " << fluid << ".\n"; exit(20); } @@ -655,7 +655,7 @@ void Domain::writeGraphite( } else { - cout << "Fluid code " << tfluid << ": Not yet implemented.\n"; + std::cout << "Fluid code " << tfluid << ": Not yet implemented.\n"; exit(1000+tfluid); } @@ -1201,7 +1201,7 @@ void Domain::writeNanotube( double TAU, double U, bool original, double wo_acceleration, double polarity, bool WLJ, bool symmetric, bool widom, double x ) { - cout << "Cannot create the nanotube - implementation missing.\n"; + std::cout << "Cannot create the nanotube - implementation missing.\n"; exit(19); } @@ -1223,11 +1223,11 @@ void Domain::specifyGraphite(double rho, unsigned N) this->box[1] = this->h + ((double)(this->d)-1.0)*Z; if(1.1 * this->shielding > 0.5 * this->h) { - cout << "Warning: shielding = " << shielding + std::cout << "Warning: shielding = " << shielding << " versus h = " << h << ", "; this->shielding = 0.5*this->h - 0.1 * this->shielding; if(this->shielding < 0.0) this->shielding = 0.0; - cout << "corrected to shielding = " << shielding << ".\n"; + std::cout << "corrected to shielding = " << shielding << ".\n"; } this->eff[1] = this->h - 2.0*this->shielding; this->off[1] = 0.5*this->h + ((double)(this->d)-1.0)*Z @@ -1236,9 +1236,9 @@ void Domain::specifyGraphite(double rho, unsigned N) double V_id = (double)(N/rho) / (wo_wall + (1.0 - wo_wall)*eff[1]/box[1]); if(this->flow == FLOW_COUETTE) V_id *= 0.5; - cout << "Carbon-carbon bond length: " << bondlength + std::cout << "Carbon-carbon bond length: " << bondlength << " * 0.05291772 nm.\n"; - cout << "Total volume should approach " << V_id + std::cout << "Total volume should approach " << V_id << " * 1.4818e-04 nm^3.\n"; /* @@ -1263,7 +1263,7 @@ void Domain::specifyGraphite(double rho, unsigned N) zeta = round(A / (tX*tZ*xi)); if(zeta == 0) { - cout << "Warning: The generated box will be larger than specified, due to technical reasons.\n\n"; + std::cout << "Warning: The generated box will be larger than specified, due to technical reasons.\n\n"; zeta = 1; } } @@ -1279,7 +1279,7 @@ void Domain::specifyGraphite(double rho, unsigned N) * fluid unit box dimensions */ double V_eff = this->eff[0] * this->eff[1] * this->eff[2]; - cout << "Symmetry volume " << box[0]*box[1]*box[2] + std::cout << "Symmetry volume " << box[0]*box[1]*box[2] << " * 1.4818e-04 nm^3, effectively " << V_eff << " * 1.4818e-04 nm^3.\n"; double N_id = rho*V_eff; @@ -1295,7 +1295,7 @@ void Domain::specifyGraphite(double rho, unsigned N) fl_units[0] = round(sqrt(this->eff[0] * bxbz_id / this->eff[2])); if(fl_units[0] == 0) this->fl_units[0] = 1; fl_units[2] = ceil(bxbz_id / fl_units[0]); - cout << "Elementary cell: " << this->eff[0]/fl_units[0] << " a0 x " << this->eff[1]/fl_units[1] << " a0 x " << this->eff[2]/fl_units[2] << " a0.\n\n"; + std::cout << "Elementary cell: " << this->eff[0]/fl_units[0] << " a0 x " << this->eff[1]/fl_units[1] << " a0 x " << this->eff[2]/fl_units[2] << " a0.\n\n"; for(int i=0; i < 3; i++) this->fl_unit[i] = this->eff[i] / (double)fl_units[i]; this->pfill = N_boxes / ((double)fl_units[0]*fl_units[1]*fl_units[2]); @@ -1316,7 +1316,7 @@ void Domain::specifyGraphite(double rho, unsigned N) this->ext[2] = this->box[2]*wo_wall - 2.0*shielding; this->off_ext[2] = this->off[2] + 0.5*(1.0 - wo_wall)*box[2] + shielding; // Shielding (Aussenseite der Wand) double V_ext = this->ext[0] * this->ext[1] * this->ext[2]; - cout << "Additionally available: " << V_ext << " * 1.4818e-04 nm^3," + std::cout << "Additionally available: " << V_ext << " * 1.4818e-04 nm^3," << "i.e. " << this->ext[0] << " (off " << this->off_ext[0] << ") x " << this->ext[1] << " (off " << this->off_ext[1] << ") x " << this->ext[2] << " (off " << this->off_ext[2] << ").\n"; @@ -1334,7 +1334,7 @@ void Domain::specifyGraphite(double rho, unsigned N) fl_units_ext[0] = round(sqrt(this->ext[0] * bxbz_id_ext / this->ext[2])); if(fl_units_ext[0] == 0) this->fl_units_ext[0] = 1; fl_units_ext[2] = ceil(bxbz_id_ext / fl_units_ext[0]); - cout << "Elementary cell (extension): " << this->ext[0]/fl_units_ext[0] + std::cout << "Elementary cell (extension): " << this->ext[0]/fl_units_ext[0] << " a0 x " << this->ext[1]/fl_units_ext[1] << " a0 x " << this->ext[2]/fl_units_ext[2] << " a0.\n\n"; for(int i=0; i < 3; i++) @@ -1350,7 +1350,7 @@ void Domain::specifyGraphite(double rho, unsigned N) void Domain::specifyNanotube(double rho, double m_per_n, unsigned N) { - cout << "Nanotubes are not yet implemented.\n"; + std::cout << "Nanotubes are not yet implemented.\n"; exit(16); } diff --git a/tools/standalone-generators/mkcp/Domain.h b/tools/standalone-generators/mkcp/Domain.h index f0e3113ba3..9128f2439d 100644 --- a/tools/standalone-generators/mkcp/Domain.h +++ b/tools/standalone-generators/mkcp/Domain.h @@ -3,7 +3,6 @@ #include #include -using namespace std; #define TIME 20111116 diff --git a/tools/standalone-generators/mkcp/Graphit.cpp b/tools/standalone-generators/mkcp/Graphit.cpp index 89e6f11d35..534dd9978b 100644 --- a/tools/standalone-generators/mkcp/Graphit.cpp +++ b/tools/standalone-generators/mkcp/Graphit.cpp @@ -3,7 +3,6 @@ #include #include -using namespace std; int Graphit::getNumberOfAtoms() { @@ -222,8 +221,8 @@ unsigned Graphit::comp(int ti, int tj) int i = ti % 2; int j = tj % 14; - // cout << "\t\t(i, j) \t=\t (" << i << ", " << j << ")\n"; - // cout.flush(); + // std::cout << "\t\t(i, j) \t=\t (" << i << ", " << j << ")\n"; + // std::cout.flush(); if((j == 2) && (i == 1)) return CID_I; else if((j == 3) && (i == 0)) return CID_I; diff --git a/tools/standalone-generators/mkcp/Graphit.h b/tools/standalone-generators/mkcp/Graphit.h index eb8c6de0c4..504651045c 100644 --- a/tools/standalone-generators/mkcp/Graphit.h +++ b/tools/standalone-generators/mkcp/Graphit.h @@ -1,5 +1,4 @@ #include -using namespace std; #define SIG_WANG 6.2860 #define EPS_WANG 6.909e-05 @@ -55,7 +54,7 @@ class Graphit unsigned comp(int ti, int tj); int numberOfAtoms; - map coordinatesOfAtoms[3]; - map velocitiesOfAtoms[3]; - map componentsOfAtoms; + std::map coordinatesOfAtoms[3]; + std::map velocitiesOfAtoms[3]; + std::map componentsOfAtoms; }; diff --git a/tools/standalone-generators/mkcp/main.cpp b/tools/standalone-generators/mkcp/main.cpp index c11715a73d..6be29e8ff1 100644 --- a/tools/standalone-generators/mkcp/main.cpp +++ b/tools/standalone-generators/mkcp/main.cpp @@ -6,7 +6,6 @@ #include #include -using namespace std; #define DEFAULT_TAU 1.0e+10 @@ -22,9 +21,9 @@ int main(int argc, char** argv) const char* usage = "usage: mkcp (-C|-P|-0) [-a ] [-A ] -c -d [-e] [-E] [-f ] [-g ] -h [-H ] [-I ] [-J ] [-k] [-l] [-L] [-m ] [-M ] -N [-p ] [-r] [-s ] [-S] [-t ] -T [-u] -U [-v ] [-V ] [-x <2nd comp. mole fract.>] [-Y ] [-3 ] [-4 ] [-5 ] [-8]\n\n-A\treduced C-C bond length; default: 2.6853 a0 = 0.1421 nm, original Tersoff: 2.7609 a0\n-C\tCouette flow (flag followed by output prefix)\n-e\tuse B-e-rnreuther format\n-E\tgenerate an empty channel\n-f\tAr (default), Ave, CH4, C2H6, N2, CO2, H2O, CH3OH, or C6H14\n-H, -I\tdefault: eta according to Wang et al.\n-J\tdefault: eta = 1\n-k\tonly harmonic potentials active within the wall (default for polar walls)\n-l\tLJ interaction within the wall as well (default for unpolar walls)\n-L\tuse Lennard-Jones units instead of atomic units (cf. atomic_units.txt)\n-M\tgenerate a carbon nanotube (only for Poiseuille flow)\n-p\tdefault polarity coefficient: 0 (unpolar walls)\n-r\tuse b-r-anch format (active by default)\n-s\tgiven in units of Angstrom; default: 1 = 0.5291772 A 0\n-S\tsymmetric system (with two identical fluid components)\n-t\tdefault: tau extremely large (about 30 us)\n-u\tuse B-u-chholz format\n-w\tWidom\n-W\tgiven in units of K; default value: 1 = 315774.5 K\n-x\tdefault value: 0 (i.e. pure first comp. fluid)\n-Y\tgiven in units of g/mol; default value: 1 = 1000 g/mol\n-0\tstatic scenario without flow (followed by output prefix)\n-3, -4\tdefault: xi according to Wang et al.\n-5\tdefault: xi = 1\n-8\toriginal Tersoff potential as published in the 80s\n"; if((argc < 15) || (argc > 69)) { - cout << "There are " << argc + std::cout << "There are " << argc << " arguments where 15 to 61 should be given.\n\n"; - cout << usage; + std::cout << usage; return 1; } @@ -77,14 +76,14 @@ int main(int argc, char** argv) { if(*argv[i] != '-') { - cout << "Flag expected where '" << argv[i] + std::cout << "Flag expected where '" << argv[i] << "' was given.\n\n"; - cout << usage; + std::cout << usage; return 2; } for(int j=1; argv[i][j]; j++) { - // cout << argv[i][j] << "\n"; + // std::cout << argv[i][j] << "\n"; if(argv[i][j] == 'a') { in_a = true; @@ -137,7 +136,7 @@ int main(int argc, char** argv) else if(!strcmp(argv[i], "C6H14")) fluid = FLUID_C6H14; else { - cout << "Fluid '" << argv[i] + std::cout << "Fluid '" << argv[i] << "' is not available.\n\n" << usage; return 9; } @@ -158,7 +157,7 @@ int main(int argc, char** argv) else if(!strcmp(argv[i], "C6H14")) fluid2 = FLUID_C6H14; else { - cout << "(Secondary) fluid '" << argv[i] + std::cout << "(Secondary) fluid '" << argv[i] << "' is not available.\n\n" << usage; return 99; } @@ -334,7 +333,7 @@ int main(int argc, char** argv) else if(argv[i][j] == '8') original = true; else { - cout << "Invalid flag '-" << argv[i][j] + std::cout << "Invalid flag '-" << argv[i][j] << "' was detected.\n\n" << usage; return 2; } @@ -348,42 +347,42 @@ int main(int argc, char** argv) { if(flow == FLOW_COUETTE) { - cout << "Couette flow is not well-defined for nanotubes.\n\n" + std::cout << "Couette flow is not well-defined for nanotubes.\n\n" << usage; return 18; } - cout << "Carbon nanotubes are not yet implemented.\n\n" + std::cout << "Carbon nanotubes are not yet implemented.\n\n" << usage; return 11; } if(WLJ && (polarity != 0.0)) { - cout << "Severe error: Non-zero polarity is incompatible with the LJ interlayer interaction.\n\n" + std::cout << "Severe error: Non-zero polarity is incompatible with the LJ interlayer interaction.\n\n" << usage; return 181; } if(!prefix) { - cout << "You have to specify an output prefix " + std::cout << "You have to specify an output prefix " << "via the -C, -P, or -0 option.\n\n" << usage; return 5; } if(!in_rho) { - cout << "Fatal error: no fluid density was specified.\n\n"; - cout << usage; + std::cout << "Fatal error: no fluid density was specified.\n\n"; + std::cout << usage; return 6; } if(!in_d) { - cout << "Wall thickness unknown. Reconsider parameter set.\n\n"; - cout << usage; + std::cout << "Wall thickness unknown. Reconsider parameter set.\n\n"; + std::cout << usage; return 7; } if(format == FORMAT_BERNREUTHER) { - cout << "B-e-rnreuther format (flag -e) " + std::cout << "B-e-rnreuther format (flag -e) " << "is unavailable at present.\n\n" << usage; return 14; } @@ -395,7 +394,7 @@ int main(int argc, char** argv) } if((x < 0.0) || (x > 1.0)) { - cout << "Invalid mole fraction x = " << x << ".\n\n" << usage; + std::cout << "Invalid mole fraction x = " << x << ".\n\n" << usage; return 15; } if((in_fluid2 == false) || (fluid2 == FLUID_NIL)) @@ -415,7 +414,7 @@ int main(int argc, char** argv) if(symmetric && (fluid2 != FLUID_NIL)) { - cout << "The symmetric scenario cannot contain an (actual) fluid mixture.\n\n" << usage; + std::cout << "The symmetric scenario cannot contain an (actual) fluid mixture.\n\n" << usage; return 16; } if(symmetric) x = 0.5; @@ -513,27 +512,27 @@ int main(int argc, char** argv) } if(!in_N) { - cout << "Missing essential input parameter " + std::cout << "Missing essential input parameter " << "N (number of fluid molecules).\n\n" << usage; return 12; } if(!in_T) { - cout << "No temperature specified: aborting.\n\n"; - cout << usage; + std::cout << "No temperature specified: aborting.\n\n"; + std::cout << usage; return 13; } if(!in_U) U = 0.0; else if(FLOW_NONE && (U != 0.0)) { - cout << "Specified flow velocity U = " << U + std::cout << "Specified flow velocity U = " << U << " is incompatible with -0 option (static scenario).\n\n" << usage; return 15; } if(muVT && symmetric) { - cout << "The combination between the uVT (-m) and symmetry (-S) options remains unsupported.\n\n" + std::cout << "The combination between the uVT (-m) and symmetry (-S) options remains unsupported.\n\n" << usage; return 115; } diff --git a/tools/standalone-generators/mkesfera/Domain.cpp b/tools/standalone-generators/mkesfera/Domain.cpp index e328494baa..712f363e41 100644 --- a/tools/standalone-generators/mkesfera/Domain.cpp +++ b/tools/standalone-generators/mkesfera/Domain.cpp @@ -10,8 +10,8 @@ void Domain::write(char* prefix, double cutoff, double T, bool do_shift, int format) { - ofstream xdr, txt, buchholz; - stringstream strstrm, txtstrstrm, buchholzstrstrm; + std::ofstream xdr, txt, buchholz; + std::stringstream strstrm, txtstrstrm, buchholzstrstrm; if(format == FORMAT_BRANCH) { strstrm << prefix << ".xdr"; @@ -20,7 +20,7 @@ void Domain::write(char* prefix, double cutoff, double T, bool do_shift, int for { strstrm << prefix << ".inp"; } - xdr.open(strstrm.str().c_str(), ios::trunc); + xdr.open(strstrm.str().c_str(), std::ios::trunc); if(format == FORMAT_BRANCH) { txtstrstrm << prefix << "_1R.txt"; @@ -29,11 +29,11 @@ void Domain::write(char* prefix, double cutoff, double T, bool do_shift, int for { txtstrstrm << prefix << "_1R.cfg"; } - txt.open(txtstrstrm.str().c_str(), ios::trunc); + txt.open(txtstrstrm.str().c_str(), std::ios::trunc); if(format == FORMAT_BUCHHOLZ) { buchholzstrstrm << prefix << "_1R.xml"; - buchholz.open(buchholzstrstrm.str().c_str(), ios::trunc); + buchholz.open(buchholzstrstrm.str().c_str(), std::ios::trunc); /* * Gesamter Inhalt der Buchholz-Datei @@ -68,10 +68,10 @@ void Domain::write(char* prefix, double cutoff, double T, bool do_shift, int for } unsigned slots = 3.0*fl_units*fl_units*fl_units; double boxdensity = (double)slots / (8.0*R_o*R_o*R_o); - cerr << "Box density: " << boxdensity << " (unit cell: " << fl_unit << ").\n"; + std::cerr << "Box density: " << boxdensity << " (unit cell: " << fl_unit << ").\n"; double P_in = rho_i / boxdensity; double P_out = rho_o / boxdensity; - cerr << "Insertion probability: " << P_in << " inside, " << P_out << " outside.\n"; + std::cerr << "Insertion probability: " << P_in << " inside, " << P_out << " outside.\n"; double goffset[3][3]; goffset[0][0] = 0.0; goffset[1][0] = 0.5; goffset[2][0] = 0.5; @@ -96,7 +96,7 @@ void Domain::write(char* prefix, double cutoff, double T, bool do_shift, int for fill[idx[0]][idx[1]][idx[2]][p] = tfill; if(tfill) N++; } - cerr << "Filling " << N << " out of " << slots << " slots (total density: " << N / (8.0*R_o*R_o*R_o) << ").\n"; + std::cerr << "Filling " << N << " out of " << slots << " slots (total density: " << N / (8.0*R_o*R_o*R_o) << ").\n"; if((format == FORMAT_BRANCH) || (format == FORMAT_BUCHHOLZ)) { @@ -153,7 +153,7 @@ void Domain::write(char* prefix, double cutoff, double T, bool do_shift, int for for(idx[2]=0; idx[2] < fl_units; idx[2]++) for(unsigned p=0; p < 3; p++) { - // cerr << idx[0] << "\t" << idx[1] << "\t" << idx[2] << "\t|\t" << fill[idx[0]][idx[1]][idx[2]][p] << "\n"; + // std::cerr << idx[0] << "\t" << idx[1] << "\t" << idx[2] << "\t|\t" << fill[idx[0]][idx[1]][idx[2]][p] << "\n"; if(fill[idx[0]][idx[1]][idx[2]][p]) { double q[3]; diff --git a/tools/standalone-generators/mkesfera/Domain.h b/tools/standalone-generators/mkesfera/Domain.h index 2724dc3fcb..977366e2de 100644 --- a/tools/standalone-generators/mkesfera/Domain.h +++ b/tools/standalone-generators/mkesfera/Domain.h @@ -3,7 +3,6 @@ #include #include -using namespace std; #define FORMAT_BUCHHOLZ 0 #define FORMAT_BRANCH 1 diff --git a/tools/standalone-generators/mkesfera/main.cpp b/tools/standalone-generators/mkesfera/main.cpp index a3274d5764..19c9330b65 100644 --- a/tools/standalone-generators/mkesfera/main.cpp +++ b/tools/standalone-generators/mkesfera/main.cpp @@ -5,16 +5,15 @@ #include #include -using namespace std; int main(int argc, char** argv) { const char* usage = "usage: mkesfera [-e] -I -i -O -o [-R ] [-r] [-S] -T [-U] [-u]\n\n-e\tuse B-e-rnreuther format\n-r\tuse b-r-anch format (active by default)\n-S\tshift (active by default)\n-U\tunshift\n-u\tuse B-u-chholz format\n"; if((argc < 12) || (argc > 16)) { - cout << "There are " << argc + std::cout << "There are " << argc << " arguments where 12 to 16 should be given.\n\n"; - cout << usage; + std::cout << usage; return 1; } @@ -34,9 +33,9 @@ int main(int argc, char** argv) { if(*argv[i] != '-') { - cout << "Flag expected where '" << argv[i] + std::cout << "Flag expected where '" << argv[i] << "' was given.\n\n"; - cout << usage; + std::cout << usage; return 2; } for(int j=1; argv[i][j]; j++) @@ -84,7 +83,7 @@ int main(int argc, char** argv) else if(argv[i][j] == 'u') format = FORMAT_BUCHHOLZ; else { - cout << "Invalid flag '-" << argv[i][j] + std::cout << "Invalid flag '-" << argv[i][j] << "' was detected.\n\n" << usage; return 2; } @@ -93,7 +92,7 @@ int main(int argc, char** argv) if(format == FORMAT_BERNREUTHER) { - cout << "B-e-rnreuther format (flag -e) " + std::cout << "B-e-rnreuther format (flag -e) " << "is unavailable at present.\n\n" << usage; return 3; } diff --git a/tools/standalone-generators/mktcts/Domain.cpp b/tools/standalone-generators/mktcts/Domain.cpp index 9690533b04..e0e3199c6b 100644 --- a/tools/standalone-generators/mktcts/Domain.cpp +++ b/tools/standalone-generators/mktcts/Domain.cpp @@ -40,8 +40,8 @@ Domain::Domain(unsigned t_N, double t_rho, double t_RDF) void Domain::write(char* prefix, double cutoff, double mu, double T, bool do_shift, bool use_mu, bool compute_autocorr, int format) { - ofstream xdr, txt, buchholz; - stringstream strstrm, txtstrstrm, buchholzstrstrm; + std::ofstream xdr, txt, buchholz; + std::stringstream strstrm, txtstrstrm, buchholzstrstrm; if(format == FORMAT_BRANCH) { strstrm << prefix << ".xdr"; @@ -50,7 +50,7 @@ void Domain::write(char* prefix, double cutoff, double mu, double T, bool do_shi { strstrm << prefix << ".inp"; } - xdr.open(strstrm.str().c_str(), ios::trunc); + xdr.open(strstrm.str().c_str(), std::ios::trunc); if(format == FORMAT_BRANCH) { txtstrstrm << prefix << "_1R.txt"; @@ -59,11 +59,11 @@ void Domain::write(char* prefix, double cutoff, double mu, double T, bool do_shi { txtstrstrm << prefix << "_1R.cfg"; } - txt.open(txtstrstrm.str().c_str(), ios::trunc); + txt.open(txtstrstrm.str().c_str(), std::ios::trunc); if(format == FORMAT_BUCHHOLZ) { buchholzstrstrm << prefix << "_1R.xml"; - buchholz.open(buchholzstrstrm.str().c_str(), ios::trunc); + buchholz.open(buchholzstrstrm.str().c_str(), std::ios::trunc); /* * Gesamter Inhalt der Buchholz-Datei @@ -92,7 +92,7 @@ void Domain::write(char* prefix, double cutoff, double mu, double T, bool do_shi if(fl_units[0][i] == 0) fl_units[0][i] = 1; fl_units[2][i] = ceil(bxbz_id / fl_units[0][i]); for(int d=0; d < 3; d++) fl_unit[d][i] = ((d == 1)? 0.5: 1.0) * box[d] / (double)fl_units[d][i]; - cout << "Elementary cell " << i << ": " << fl_unit[0][i] << " x " << fl_unit[1][i] << " x " << fl_unit[2][i] << ".\n"; + std::cout << "Elementary cell " << i << ": " << fl_unit[0][i] << " x " << fl_unit[1][i] << " x " << fl_unit[2][i] << ".\n"; } Random* r = new Random(); @@ -127,7 +127,7 @@ void Domain::write(char* prefix, double cutoff, double mu, double T, bool do_shi { tswap = (N[l] < N_id[l]); pswap = (N_id[l] - (double)N[l]) / ((tswap? slots[l]: 0) - (double)N[l]); - // cout << "N = " << N[l] << ", N_id = " << N_id[l] << " => tswap = " << tswap << ", pswap = " << pswap << "\n"; + // std::cout << "N = " << N[l] << ", N_id = " << N_id[l] << " => tswap = " << tswap << ", pswap = " << pswap << "\n"; for(unsigned i=0; i < fl_units[0][l]; i++) for(unsigned j=0; j < fl_units[1][l]; j++) for(unsigned k=0; k < fl_units[2][l]; k++) @@ -140,7 +140,7 @@ void Domain::write(char* prefix, double cutoff, double mu, double T, bool do_shi if(tswap) N[l] ++; } } - cout << "Filling " << N[l] << " of 3*" + std::cout << "Filling " << N[l] << " of 3*" << fl_units[0][l] << "*" << fl_units[1][l] << "*" << fl_units[2][l] << " = " << slots[l] << " slots (ideally " << N_id[l] << ").\n"; } @@ -209,7 +209,7 @@ void Domain::write(char* prefix, double cutoff, double mu, double T, bool do_shi } else { - cout << "N[0] = " << N[0] << ", N[1] = " << N[1] << ", conducting " << round((double)(N[0]+N[1]) / 5000.0) << " test actions.\n"; + std::cout << "N[0] = " << N[0] << ", N[1] = " << N[1] << ", conducting " << round((double)(N[0]+N[1]) / 5000.0) << " test actions.\n"; txt << "chemicalPotential\t" << mu << " component 1\tconduct " << (int)round((double)(N[0]+N[1]) / 5000.0) << " tests every 2 steps\n"; } txt << "planckConstant\t" << sqrt(6.2831853 * T) << "\ninitGrandCanonical\t60000\n"; diff --git a/tools/standalone-generators/mktcts/Domain.h b/tools/standalone-generators/mktcts/Domain.h index 6718ba46f6..c0006b3c49 100644 --- a/tools/standalone-generators/mktcts/Domain.h +++ b/tools/standalone-generators/mktcts/Domain.h @@ -3,7 +3,6 @@ #include #include -using namespace std; #define FORMAT_BUCHHOLZ 0 #define FORMAT_BRANCH 1 diff --git a/tools/standalone-generators/mktcts/main.cpp b/tools/standalone-generators/mktcts/main.cpp index 1b75ebb5e0..f23846d5ff 100644 --- a/tools/standalone-generators/mktcts/main.cpp +++ b/tools/standalone-generators/mktcts/main.cpp @@ -5,16 +5,15 @@ #include #include -using namespace std; int main(int argc, char** argv) { const char* usage = "usage: mkTcTS -c [-a] [-d ] [-e] [-H ] [-h ] [-m ] -N [-p ] [-R ] [-r] [-S] -T [-U] [-u]\n\n-a\tcompute velocity autocorrelation\n-e\tuse B-e-rnreuther format\n-P\tcompute pseudomomenta\n-r\tuse b-r-anch format\n-S\tshift (active by default)\n-U\tunshift\n-u\tuse B-u-chholz format (active by default)\n"; if((argc < 8) || (argc > 28)) { - cout << "There are " << argc + std::cout << "There are " << argc << " arguments where 8 to 28 should be given.\n\n"; - cout << usage; + std::cout << usage; return 1; } @@ -46,9 +45,9 @@ int main(int argc, char** argv) { if(*argv[i] != '-') { - cout << "Flag expected where '" << argv[i] + std::cout << "Flag expected where '" << argv[i] << "' was given.\n\n"; - cout << usage; + std::cout << usage; return 2; } for(int j=1; argv[i][j]; j++) @@ -125,7 +124,7 @@ int main(int argc, char** argv) else if(argv[i][j] == 'u') format = FORMAT_BUCHHOLZ; else { - cout << "Invalid flag '-" << argv[i][j] + std::cout << "Invalid flag '-" << argv[i][j] << "' was detected.\n\n" << usage; return 2; } @@ -134,14 +133,14 @@ int main(int argc, char** argv) if(in_h && !gradient) { - cout << "The box dimension can only be specified for " + std::cout << "The box dimension can only be specified for " << "systems with a density gradient.\n\n" << usage; return 5; } if(format == FORMAT_BERNREUTHER) { - cout << "B-e-rnreuther format (flag -e) " + std::cout << "B-e-rnreuther format (flag -e) " << "is unavailable at present.\n\n" << usage; return 3; } From cb4c493257a35117f8eae2f02fcf60ecf6c1d848 Mon Sep 17 00:00:00 2001 From: HomesGH Date: Wed, 24 May 2023 21:12:34 +0200 Subject: [PATCH 02/32] Get rid of using namespace std in src files --- src/Common.cpp | 4 +- src/Domain.cpp | 138 ++++---- src/MarDyn.cpp | 83 +++-- src/MarDyn_version.h | 20 ++ src/Simulation.cpp | 319 +++++++++--------- src/Simulation.h | 4 +- src/bhfmm/FastMultipoleMethod.cpp | 27 +- src/bhfmm/cellProcessors/L2PCellProcessor.cpp | 10 +- .../VectorizedChargeP2PCellProcessor.cpp | 14 +- .../VectorizedLJP2PCellProcessor.cpp | 2 - src/bhfmm/containers/DttNode.cpp | 6 +- src/bhfmm/containers/LeafNodesContainer.cpp | 45 ++- src/bhfmm/containers/ParticleCellPointers.cpp | 2 - .../UniformPseudoParticleContainer.cpp | 28 +- ...PseudoParticleContainer_old_Wigner_cpp.txt | 2 +- .../expansions/SolidHarmonicsExpansion.cpp | 29 +- src/bhfmm/fft/FFTSettings.cpp | 6 +- src/bhfmm/fft/FFTSettings.h | 6 +- .../fft/tools/optimizedFFT/FakedOptFFT.h | 4 +- src/bhfmm/utils/WignerMatrix.cpp | 19 +- src/ensemble/BoxDomain.cpp | 5 +- src/ensemble/CanonicalEnsemble.cpp | 35 +- src/ensemble/CavityEnsemble.cpp | 30 +- src/ensemble/CavityEnsemble.h | 9 +- src/ensemble/ChemicalPotential.cpp | 32 +- src/ensemble/EnsembleBase.cpp | 16 +- src/ensemble/GrandCanonicalEnsemble.cpp | 10 +- src/ensemble/PressureGradient.cpp | 22 +- src/ensemble/PressureGradient.h | 36 +- src/ensemble/tests/CanonicalEnsembleTest.cpp | 2 - src/integrators/Leapfrog.cpp | 27 +- src/integrators/LeapfrogRMM.cpp | 14 +- src/io/ASCIIReader.cpp | 26 +- src/io/Adios2Reader.cpp | 36 +- src/io/Adios2Writer.cpp | 32 +- src/io/BinaryReader.cpp | 52 ++- src/io/CavityWriter.cpp | 63 ++-- src/io/CheckpointWriter.cpp | 19 +- src/io/CommunicationPartnerWriter.cpp | 17 +- src/io/DecompWriter.cpp | 13 +- src/io/EnergyLogWriter.cpp | 11 +- src/io/FlopRateWriter.cpp | 22 +- src/io/GammaWriter.cpp | 8 +- src/io/HaloParticleWriter.cpp | 17 +- src/io/LoadBalanceWriter.cpp | 10 +- src/io/MPICheckpointWriter.cpp | 66 ++-- src/io/MPI_IOCheckpointWriter.cpp | 5 +- src/io/MPI_IOReader.cpp | 72 ++-- src/io/MaxWriter.cpp | 14 +- src/io/MemoryProfiler.cpp | 10 +- src/io/Mkesfera.cpp | 30 +- src/io/MmpldWriter.cpp | 16 +- src/io/MmspdBinWriter.cpp | 18 +- src/io/MmspdWriter.cpp | 36 +- src/io/MultiObjectGenerator.cpp | 11 +- src/io/ODF.cpp | 76 ++--- src/io/ODF.h | 4 +- src/io/ObjectGenerator.cpp | 28 +- src/io/PovWriter.cpp | 72 ++-- src/io/RDF.cpp | 32 +- src/io/ReplicaGenerator.cpp | 89 +++-- src/io/ReplicaGenerator.h | 1 - src/io/ResultWriter.cpp | 21 +- src/io/SysMonOutput.cpp | 12 +- src/io/TaskTimingProfiler.cpp | 26 +- src/io/TcTS.cpp | 14 +- src/io/TimerProfiler.cpp | 157 +++++---- src/io/TimerWriter.cpp | 8 +- src/io/VISWriter.cpp | 34 +- src/io/XyzWriter.cpp | 11 +- src/io/tests/Adios2IOTest.cpp | 4 +- src/io/tests/CheckpointRestartTest.cpp | 2 - src/io/tests/RDFTest.cpp | 11 +- src/io/vtk/VTKGridWriter.cpp | 1 - src/io/vtk/VTKGridWriterImplementation.cpp | 1 - src/io/vtk/VTKMoleculeWriter.cpp | 2 - .../vtk/VTKMoleculeWriterImplementation.cpp | 1 - src/io/vtk/tests/VTKMoleculeWriterTest.cpp | 1 - src/io/vtk/vtk-unstructured.cpp | 18 +- src/io/vtk/vtk-unstructured.h | 4 +- src/longRange/Homogeneous.cpp | 8 +- src/longRange/NoLRC.h | 1 - src/longRange/Planar.cpp | 40 ++- src/molecules/AutoPasSimpleMolecule.cpp | 2 +- src/molecules/Comp2Param.cpp | 10 +- src/molecules/Component.cpp | 44 ++- src/molecules/FullMolecule.cpp | 27 +- src/molecules/MoleculeInterface.cpp | 5 +- .../mixingrules/LorentzBerthelot.cpp | 3 +- src/molecules/mixingrules/MixingRuleBase.cpp | 5 +- .../CollectiveCommunicationNonBlocking.h | 1 - src/parallel/CommunicationPartner.cpp | 10 +- src/parallel/DomainDecompBase.cpp | 2 +- src/parallel/DomainDecompBase.h | 5 +- src/parallel/DomainDecompMPIBase.cpp | 38 +-- src/parallel/DomainDecomposition.cpp | 6 +- src/parallel/GeneralDomainDecomposition.cpp | 14 +- src/parallel/KDDecomposition.cpp | 174 +++++----- src/parallel/KDNode.cpp | 1 - src/parallel/LoadCalc.cpp | 2 +- src/parallel/NonBlockingMPIHandlerBase.cpp | 1 - .../NonBlockingMPIMultiStepHandler.cpp | 2 - src/parallel/ResilienceComm.cpp | 1 - .../tests/CollectiveCommunicationTest.cpp | 1 - .../tests/CommunicationBufferTest.cpp | 1 - src/parallel/tests/KDDecompositionTest.cpp | 35 +- src/parallel/tests/NeighborAcquirerTest.cpp | 1 - src/particleContainer/AutoPasContainer.cpp | 86 ++--- src/particleContainer/FullParticleCell.cpp | 1 - .../LinkedCellTraversals/C08BasedTraversals.h | 32 +- .../C08CellPairTraversal.h | 38 +-- .../LinkedCellTraversals/MidpointTraversal.h | 12 +- .../OriginalCellPairTraversal.h | 2 +- .../QuickschedTraversal.h | 11 +- .../SlicedCellPairTraversal.h | 50 +-- src/particleContainer/LinkedCells.cpp | 134 ++++---- src/particleContainer/ParticleCellBase.cpp | 2 +- src/particleContainer/ParticleContainer.cpp | 4 +- src/particleContainer/TraversalTuner.h | 85 +++-- src/particleContainer/adapter/FlopCounter.cpp | 9 +- .../adapter/LegacyCellProcessor.cpp | 2 - .../adapter/ParticlePairs2LoadCalcAdapter.h | 2 +- .../adapter/RDFCellProcessor.cpp | 2 - src/particleContainer/adapter/VCP1CLJRMM.cpp | 2 +- .../adapter/VectorizedCellProcessor.cpp | 2 - .../tests/VectorizedCellProcessorTest.cpp | 18 +- .../tests/ParticleContainerFactory.cpp | 1 - src/plugins/DirectedPM.cpp | 18 +- src/plugins/DirectedPM.h | 6 +- src/plugins/ExamplePlugin.cpp | 13 +- src/plugins/InMemoryCheckpointing.cpp | 1 - src/plugins/MaxCheck.cpp | 24 +- src/plugins/Mirror.cpp | 2 - src/plugins/MirrorSystem.cpp | 24 +- src/plugins/NEMD/DensityControl.cpp | 14 +- src/plugins/NEMD/DistControl.cpp | 119 ++++--- src/plugins/NEMD/DistControl.h | 1 - src/plugins/NEMD/DriftCtrl.cpp | 18 +- src/plugins/NEMD/MettDeamon.cpp | 171 +++++----- src/plugins/NEMD/MettDeamon.h | 2 +- .../NEMD/MettDeamonFeedrateDirector.cpp | 40 ++- src/plugins/NEMD/RegionSampling.cpp | 171 +++++----- src/plugins/NEMD/VelocityExchange.cpp | 6 +- src/plugins/Permittivity.cpp | 26 +- src/plugins/PluginFactory.cpp | 20 +- src/plugins/SpatialProfile.cpp | 16 +- src/plugins/TestPlugin.h | 16 +- src/plugins/VectorizationTuner.cpp | 20 +- src/plugins/VectorizationTuner.h | 2 +- src/plugins/WallPotential.cpp | 20 +- src/plugins/WallPotential.h | 8 +- src/plugins/profiles/DOFProfile.cpp | 4 +- src/plugins/profiles/DOFProfile.h | 4 +- src/plugins/profiles/DensityProfile.cpp | 6 +- src/plugins/profiles/DensityProfile.h | 4 +- src/plugins/profiles/KineticProfile.cpp | 4 +- src/plugins/profiles/KineticProfile.h | 4 +- src/plugins/profiles/ProfileBase.cpp | 8 +- src/plugins/profiles/ProfileBase.h | 14 +- src/plugins/profiles/TemperatureProfile.cpp | 6 +- src/plugins/profiles/TemperatureProfile.h | 4 +- src/plugins/profiles/Velocity3dProfile.cpp | 6 +- src/plugins/profiles/Velocity3dProfile.h | 4 +- src/plugins/profiles/VelocityAbsProfile.cpp | 6 +- src/plugins/profiles/VelocityAbsProfile.h | 4 +- src/plugins/profiles/Virial2DProfile.cpp | 6 +- src/plugins/profiles/Virial2DProfile.h | 4 +- src/plugins/profiles/VirialProfile.cpp | 4 +- src/plugins/profiles/VirialProfile.h | 4 +- src/tests/MarDynInitOptionsTest.cpp | 1 - src/thermostats/TemperatureControl.cpp | 31 +- src/thermostats/VelocityScalingThermostat.cpp | 8 +- src/utils/DynAlloc.h | 1 - src/utils/Expression.cpp | 45 ++- src/utils/FileUtils.h | 2 +- src/utils/Logger.h | 14 +- src/utils/MPI_Info_object.cpp | 4 +- src/utils/OptionParser.cpp | 239 +++++++------ src/utils/OptionParser.h | 4 +- src/utils/PrintThreadPinningToCPU.cpp | 6 +- src/utils/SteereoIntegration.cpp | 1 - src/utils/SysMon.cpp | 79 +++-- src/utils/TestWithSimulationSetup.cpp | 1 - src/utils/generator/Basis.cpp | 6 +- src/utils/generator/GridFiller.cpp | 12 +- src/utils/generator/Lattice.cpp | 15 +- src/utils/generator/Objects.cpp | 20 +- src/utils/generator/ReplicaFiller.cpp | 24 +- src/utils/tests/AlignedArrayTest.cpp | 7 +- src/utils/tests/AlignedArrayTripletTest.cpp | 7 +- .../tests/ConcatenatedAlignedArrayRMMTest.cpp | 7 +- src/utils/tests/PermutationTest.cpp | 16 +- src/utils/tests/RandomTest.cpp | 3 +- src/utils/tests/UnorderedVectorTest.cpp | 4 +- src/utils/xmlfile.cpp | 149 ++++---- src/utils/xmlfileUnits.cpp | 97 +++--- 196 files changed, 2322 insertions(+), 2510 deletions(-) create mode 100644 src/MarDyn_version.h diff --git a/src/Common.cpp b/src/Common.cpp index 9ec8ce16cf..3799f36d95 100644 --- a/src/Common.cpp +++ b/src/Common.cpp @@ -45,10 +45,10 @@ void calculateDistances( float * __restrict__ valuesA[3], float* __restrict__ co float ** __restrict__ distances, float *** __restrict__ distanceVectors ) { /* for (int i = 0; i < numValuesA; i++) { - std::cout << "A Points: " << valuesA[0][i] << "," << valuesA[1][i] << "," << valuesA[2][i] << endl; + std::cout << "A Points: " << valuesA[0][i] << "," << valuesA[1][i] << "," << valuesA[2][i] << std::endl; } for (int i = 0; i < numValuesB; i++) { - std::cout << "B Points: " << valuesB[0][i] << "," << valuesB[1][i] << "," << valuesB[2][i] << endl; + std::cout << "B Points: " << valuesB[0][i] << "," << valuesB[1][i] << "," << valuesB[2][i] << std::endl; } */ diff --git a/src/Domain.cpp b/src/Domain.cpp index 27a2bb4333..76dd9eadb2 100644 --- a/src/Domain.cpp +++ b/src/Domain.cpp @@ -21,9 +21,7 @@ #include "utils/Logger.h" #include "utils/arrayMath.h" #include "utils/CommVar.h" -using Log::global_log; -using namespace std; Domain::Domain(int rank) { @@ -34,29 +32,29 @@ Domain::Domain(int rank) { _globalVirial = 0; _globalRho = 0; - this->_componentToThermostatIdMap = map(); - this->_localThermostatN = map(); + this->_componentToThermostatIdMap = std::map(); + this->_localThermostatN = std::map(); this->_localThermostatN[-1] = 0; this->_localThermostatN[0] = 0; - this->_universalThermostatN = map(); + this->_universalThermostatN = std::map(); this->_universalThermostatN[-1] = 0; this->_universalThermostatN[0] = 0; - this->_localRotationalDOF = map(); + this->_localRotationalDOF = std::map(); this->_localRotationalDOF[-1] = 0; this->_localRotationalDOF[0] = 0; - this->_universalRotationalDOF = map(); + this->_universalRotationalDOF = std::map(); this->_universalRotationalDOF[-1] = 0; this->_universalRotationalDOF[0] = 0; this->_globalLength[0] = 0; this->_globalLength[1] = 0; this->_globalLength[2] = 0; - this->_universalBTrans = map(); + this->_universalBTrans = std::map(); this->_universalBTrans[0] = 1.0; - this->_universalBRot = map(); + this->_universalBRot = std::map(); this->_universalBRot[0] = 1.0; - this->_universalTargetTemperature = map(); + this->_universalTargetTemperature = std::map(); this->_universalTargetTemperature[0] = 1.0; - this->_globalTemperatureMap = map(); + this->_globalTemperatureMap = std::map(); this->_globalTemperatureMap[0] = 1.0; this->_local2KETrans[0] = 0.0; this->_local2KERot[0] = 0.0; @@ -67,9 +65,9 @@ Domain::Domain(int rank) { this->_globalSigmaUU = 0.0; this->_componentwiseThermostat = false; #ifdef COMPLEX_POTENTIAL_SET - this->_universalUndirectedThermostat = map(); - this->_universalThermostatDirectedVelocity = map >(); - this->_localThermostatDirectedVelocity = map >(); + this->_universalUndirectedThermostat = std::map(); + this->_universalThermostatDirectedVelocity = std::map >(); + this->_localThermostatDirectedVelocity = std::map >(); #endif this->_universalSelectiveThermostatCounter = 0; this->_universalSelectiveThermostatWarning = 0; @@ -84,17 +82,17 @@ void Domain::readXML(XMLfileUnits& xmlconfig) { if ( xmlconfig.changecurrentnode( "volume" )) { std::string type; xmlconfig.getNodeValue( "@type", type ); - global_log->info() << "Volume type: " << type << endl; + global_log->info() << "Volume type: " << type << std::endl; if( type == "box" ) { xmlconfig.getNodeValueReduced( "lx", _globalLength[0] ); xmlconfig.getNodeValueReduced( "ly", _globalLength[1] ); xmlconfig.getNodeValueReduced( "lz", _globalLength[2] ); global_log->info() << "Box size: " << _globalLength[0] << ", " << _globalLength[1] << ", " - << _globalLength[2] << endl; + << _globalLength[2] << std::endl; } else { - global_log->error() << "Unsupported volume type " << type << endl; + global_log->error() << "Unsupported volume type " << type << std::endl; } xmlconfig.changecurrentnode(".."); } @@ -106,7 +104,7 @@ void Domain::readXML(XMLfileUnits& xmlconfig) { bInputOk = bInputOk && xmlconfig.getNodeValueReduced("temperature", temperature); if(bInputOk) { setGlobalTemperature(temperature); - global_log->info() << "Temperature: " << temperature << endl; + global_log->info() << "Temperature: " << temperature << std::endl; } } @@ -127,7 +125,7 @@ double Domain::getGlobalBetaRot(int thermostat) { return _universalBRot[thermost void Domain::setLocalSummv2(double summv2, int thermostat) { #ifndef NDEBUG - global_log->debug() << "* local thermostat " << thermostat << ": mvv = " << summv2 << endl; + global_log->debug() << "* local thermostat " << thermostat << ": mvv = " << summv2 << std::endl; #endif this->_local2KETrans[thermostat] = summv2; } @@ -188,10 +186,10 @@ void Domain::calculateGlobalValues( * thermostat ID 0 represents the entire system */ - map::iterator thermit; + std::map::iterator thermit; if( _componentwiseThermostat ) { - global_log->debug() << "* applying a component-wise thermostat" << endl; + global_log->debug() << "* applying a component-wise thermostat" << std::endl; this->_localThermostatN[0] = 0; this->_localRotationalDOF[0] = 0; this->_local2KETrans[0] = 0; @@ -227,7 +225,7 @@ void Domain::calculateGlobalValues( rotDOF = domainDecomp->collCommGetUnsLong(); domainDecomp->collCommFinalize(); global_log->debug() << "[ thermostat ID " << thermit->first << "]\tN = " << numMolecules << "\trotDOF = " << rotDOF - << "\tmv2 = " << summv2 << "\tIw2 = " << sumIw2 << endl; + << "\tmv2 = " << summv2 << "\tIw2 = " << sumIw2 << std::endl; this->_universalThermostatN[thermit->first] = numMolecules; this->_universalRotationalDOF[thermit->first] = rotDOF; @@ -259,10 +257,10 @@ void Domain::calculateGlobalValues( if( ( (_universalBTrans[thermit->first] < MIN_BETA) || (_universalBRot[thermit->first] < MIN_BETA) ) && (0 >= _universalSelectiveThermostatError) && _bDoExplosionHeuristics == true) { - global_log->warning() << "Explosion!" << endl; + global_log->warning() << "Explosion!" << std::endl; global_log->debug() << "Selective thermostat will be applied to set " << thermit->first << " (beta_trans = " << this->_universalBTrans[thermit->first] - << ", beta_rot = " << this->_universalBRot[thermit->first] << "!)" << endl; + << ", beta_rot = " << this->_universalBRot[thermit->first] << "!)" << std::endl; int rot_dof; const double limit_energy = KINLIMIT_PER_T * Ti; @@ -276,7 +274,7 @@ void Domain::calculateGlobalValues( Utrans = tM->U_trans(); if (Utrans > limit_energy) { vcorr = sqrt(limit_energy / Utrans); - global_log->debug() << ": v(m" << tM->getID() << ") *= " << vcorr << endl; + global_log->debug() << ": v(m" << tM->getID() << ") *= " << vcorr << std::endl; tM->scale_v(vcorr); tM->scale_F(vcorr); } @@ -287,7 +285,7 @@ void Domain::calculateGlobalValues( Urot = tM->U_rot(); if (Urot > limit_rot_energy) { Dcorr = sqrt(limit_rot_energy / Urot); - global_log->debug() << "D(m" << tM->getID() << ") *= " << Dcorr << endl; + global_log->debug() << "D(m" << tM->getID() << ") *= " << Dcorr << std::endl; tM->scale_D(Dcorr); tM->scale_M(Dcorr); } @@ -320,7 +318,7 @@ void Domain::calculateGlobalValues( /* FIXME: why difference counters? */ global_log->debug() << "counter " << _universalSelectiveThermostatCounter << ",\t warning " << _universalSelectiveThermostatWarning - << ",\t error " << _universalSelectiveThermostatError << endl; + << ",\t error " << _universalSelectiveThermostatError << std::endl; if(collectThermostatVelocities && _universalUndirectedThermostat[thermit->first]) { @@ -346,7 +344,7 @@ void Domain::calculateGlobalValues( << _universalThermostatDirectedVelocity[thermit->first][0] << " / " << _universalThermostatDirectedVelocity[thermit->first][1] << " / " << _universalThermostatDirectedVelocity[thermit->first][2] - << ")" << endl; + << ")" << std::endl; #endif } @@ -373,7 +371,7 @@ void Domain::calculateThermostatDirectedVelocity(ParticleContainer* partCont) { if(this->_componentwiseThermostat) { - for( map::iterator thit = _universalUndirectedThermostat.begin(); + for( std::map::iterator thit = _universalUndirectedThermostat.begin(); thit != _universalUndirectedThermostat.end(); thit ++ ) { @@ -482,25 +480,25 @@ void Domain::calculateVelocitySums(ParticleContainer* partCont) global_log->debug() << " * N = " << this->_localThermostatN[0] << " rotDOF = " << this->_localRotationalDOF[0] << " mv2 = " - << _local2KETrans[0] << " Iw2 = " << _local2KERot[0] << endl; + << _local2KETrans[0] << " Iw2 = " << _local2KERot[0] << std::endl; } } -void Domain::writeCheckpointHeader(string filename, +void Domain::writeCheckpointHeader(std::string filename, ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, double currentTime) { unsigned long globalNumMolecules = this->getglobalNumMolecules(true, particleContainer, domainDecomp); /* Rank 0 writes file header */ if(0 == this->_localRank) { - ofstream checkpointfilestream(filename.c_str()); + std::ofstream checkpointfilestream(filename.c_str()); checkpointfilestream << "mardyn trunk " << CHECKPOINT_FILE_VERSION; checkpointfilestream << "\n"; // store default format flags - ios::fmtflags f( checkpointfilestream.flags() ); + std::ios::fmtflags f( checkpointfilestream.flags() ); checkpointfilestream << "currentTime\t" << FORMAT_SCI_MAX_DIGITS << currentTime << "\n"; //edited by Michaela Heier checkpointfilestream.flags(f); // restore default format flags - checkpointfilestream << " Length\t" << setprecision(9) << _globalLength[0] << " " << _globalLength[1] << " " << _globalLength[2] << "\n"; + checkpointfilestream << " Length\t" << std::setprecision(9) << _globalLength[0] << " " << _globalLength[1] << " " << _globalLength[2] << "\n"; if(this->_componentwiseThermostat) { - for( map::iterator thermit = this->_componentToThermostatIdMap.begin(); + for( std::map::iterator thermit = this->_componentToThermostatIdMap.begin(); thermit != this->_componentToThermostatIdMap.end(); thermit++ ) { @@ -508,7 +506,7 @@ void Domain::writeCheckpointHeader(string filename, checkpointfilestream << " CT\t" << 1+thermit->first << "\t" << thermit->second << "\n"; } - for( map::iterator Tit = this->_universalTargetTemperature.begin(); + for( std::map::iterator Tit = this->_universalTargetTemperature.begin(); Tit != this->_universalTargetTemperature.end(); Tit++ ) { @@ -518,7 +516,7 @@ void Domain::writeCheckpointHeader(string filename, } else { - checkpointfilestream << " Temperature\t" << _universalTargetTemperature[0] << endl; + checkpointfilestream << " Temperature\t" << _universalTargetTemperature[0] << std::endl; } #ifndef NDEBUG checkpointfilestream << "# rho\t" << this->_globalRho << "\n"; @@ -529,14 +527,14 @@ void Domain::writeCheckpointHeader(string filename, if(this->_globalUSteps > 1) if(this->_globalUSteps > 1) { - checkpointfilestream << setprecision(13); + checkpointfilestream << std::setprecision(13); checkpointfilestream << " I\t" << this->_globalUSteps << " " << this->_globalSigmaU << " " << this->_globalSigmaUU << "\n"; - checkpointfilestream << setprecision(8); + checkpointfilestream << std::setprecision(8); } */ - vector* components = _simulation.getEnsemble()->getComponents(); - checkpointfilestream << " NumberOfComponents\t" << components->size() << endl; + std::vector* components = _simulation.getEnsemble()->getComponents(); + checkpointfilestream << " NumberOfComponents\t" << components->size() << std::endl; for(auto pos=components->begin();pos!=components->end();++pos){ pos->write(checkpointfilestream); } @@ -547,7 +545,7 @@ void Domain::writeCheckpointHeader(string filename, iout++; // 2 parameters (xi and eta) if(iout/2>=numperline) { - checkpointfilestream << endl; + checkpointfilestream << std::endl; iout=0; --numperline; } @@ -558,7 +556,7 @@ void Domain::writeCheckpointHeader(string filename, checkpointfilestream << " "; } } - checkpointfilestream << _epsilonRF << endl; + checkpointfilestream << _epsilonRF << std::endl; for( auto uutit = this->_universalUndirectedThermostat.begin(); uutit != this->_universalUndirectedThermostat.end(); uutit++ ) @@ -566,41 +564,41 @@ void Domain::writeCheckpointHeader(string filename, if(0 > uutit->first) continue; if(uutit->second) checkpointfilestream << " U\t" << uutit->first << "\n"; } - checkpointfilestream << " NumberOfMolecules\t" << globalNumMolecules << endl; + checkpointfilestream << " NumberOfMolecules\t" << globalNumMolecules << std::endl; - checkpointfilestream << " MoleculeFormat\t" << Molecule::getWriteFormat() << endl; + checkpointfilestream << " MoleculeFormat\t" << Molecule::getWriteFormat() << std::endl; checkpointfilestream.close(); } } -void Domain::writeCheckpointHeaderXML(string filename, ParticleContainer* particleContainer, +void Domain::writeCheckpointHeaderXML(std::string filename, ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, double currentTime) { unsigned long globalNumMolecules = this->getglobalNumMolecules(true, particleContainer, domainDecomp); if(0 != domainDecomp->getRank() ) return; - ofstream ofs(filename.c_str() ); + std::ofstream ofs(filename.c_str() ); - ofs << "" << endl; - ofs << "" << endl; - ofs << "\t" << endl; - ios::fmtflags f( ofs.flags() ); - ofs << "\t\t" << endl; - ofs << "\t\t" << endl; + ofs << "" << std::endl; + ofs << "" << std::endl; + ofs << "\t" << std::endl; + std::ios::fmtflags f( ofs.flags() ); + ofs << "\t\t" << std::endl; + ofs << "\t\t" << std::endl; ofs << "\t\t\t" << FORMAT_SCI_MAX_DIGITS_WIDTH_21 << _globalLength[0] << " " "" << FORMAT_SCI_MAX_DIGITS_WIDTH_21 << _globalLength[1] << " " - "" << FORMAT_SCI_MAX_DIGITS_WIDTH_21 << _globalLength[2] << "" << endl; - ofs << "\t\t" << endl; + "" << FORMAT_SCI_MAX_DIGITS_WIDTH_21 << _globalLength[2] << "" << std::endl; + ofs << "\t\t" << std::endl; ofs.flags(f); // restore default format flags - ofs << "\t\t" << globalNumMolecules << "" << endl; - ofs << "\t\t" << endl; - ofs << "\t" << endl; - ofs << "" << endl; + ofs << "\t\t" << globalNumMolecules << "" << std::endl; + ofs << "\t\t" << std::endl; + ofs << "\t" << std::endl; + ofs << "" << std::endl; } -void Domain::writeCheckpoint(string filename, +void Domain::writeCheckpoint(std::string filename, ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, double currentTime, bool useBinaryFormat) { domainDecomp->assertDisjunctivity(particleContainer); @@ -661,7 +659,7 @@ void Domain::setTargetTemperature(int thermostatID, double targetT) if(thermostatID < 0) { global_log->warning() << "Warning: thermostat \'" << thermostatID << "\' (T = " - << targetT << ") will be ignored." << endl; + << targetT << ") will be ignored." << std::endl; return; } @@ -672,20 +670,20 @@ void Domain::setTargetTemperature(int thermostatID, double targetT) /* FIXME: Substantial change in program behavior! */ if(thermostatID == 0) { #ifndef UNIT_TESTS - global_log->warning() << "Disabling the component wise thermostat!" << endl; + global_log->warning() << "Disabling the component wise thermostat!" << std::endl; #endif disableComponentwiseThermostat(); } if(thermostatID >= 1) { if( ! _componentwiseThermostat ) { /* FIXME: Substantial change in program behavior! */ - global_log->warning() << "Enabling the component wise thermostat!" << endl; + global_log->warning() << "Enabling the component wise thermostat!" << std::endl; _componentwiseThermostat = true; _universalTargetTemperature.erase(0); _universalUndirectedThermostat.erase(0); this->_universalThermostatDirectedVelocity.erase(0); - vector* components = _simulation.getEnsemble()->getComponents(); - for( vector::iterator tc = components->begin(); tc != components->end(); tc ++ ) { + std::vector* components = _simulation.getEnsemble()->getComponents(); + for( std::vector::iterator tc = components->begin(); tc != components->end(); tc ++ ) { if(!(this->_componentToThermostatIdMap[ tc->ID() ] > 0)) { this->_componentToThermostatIdMap[ tc->ID() ] = -1; } @@ -700,8 +698,8 @@ void Domain::enableComponentwiseThermostat() this->_componentwiseThermostat = true; this->_universalTargetTemperature.erase(0); - vector* components = _simulation.getEnsemble()->getComponents(); - for( vector::iterator tc = components->begin(); tc != components->end(); tc ++ ) { + std::vector* components = _simulation.getEnsemble()->getComponents(); + for( std::vector::iterator tc = components->begin(); tc != components->end(); tc ++ ) { if(!(this->_componentToThermostatIdMap[ tc->ID() ] > 0)) { this->_componentToThermostatIdMap[ tc->ID() ] = -1; } @@ -715,7 +713,7 @@ void Domain::enableUndirectedThermostat(int tst) this->_universalThermostatDirectedVelocity[tst].fill(0.0); } -vector & Domain::getmixcoeff() { return _mixcoeff; } +std::vector & Domain::getmixcoeff() { return _mixcoeff; } double Domain::getepsilonRF() const { return _epsilonRF; } @@ -723,8 +721,8 @@ void Domain::setepsilonRF(double erf) { _epsilonRF = erf; } unsigned long Domain::getglobalNumMolecules(bool bUpdate, ParticleContainer* particleContainer, DomainDecompBase* domainDecomp) { if (bUpdate) { - if (particleContainer == nullptr) { global_log->debug() << "ParticleCont unknown!" << endl; particleContainer = global_simulation->getMoleculeContainer(); } - if (domainDecomp == nullptr) { global_log->debug() << "domainDecomp unknown!" << endl; domainDecomp = &(global_simulation->domainDecomposition()); } + if (particleContainer == nullptr) { global_log->debug() << "ParticleCont unknown!" << std::endl; particleContainer = global_simulation->getMoleculeContainer(); } + if (domainDecomp == nullptr) { global_log->debug() << "domainDecomp unknown!" << std::endl; domainDecomp = &(global_simulation->domainDecomposition()); } this->updateglobalNumMolecules(particleContainer, domainDecomp); } return _globalNumMolecules; diff --git a/src/MarDyn.cpp b/src/MarDyn.cpp index 964f5ae00d..51f7515e5d 100644 --- a/src/MarDyn.cpp +++ b/src/MarDyn.cpp @@ -26,7 +26,6 @@ #endif using Log::global_log; -using std::endl; using optparse::Values; /** @@ -60,45 +59,45 @@ void initOptions(optparse::OptionParser *op) { * @brief Helper function outputting program build information to given logger */ void program_build_info(Log::Logger *log) { - log->info() << "Compilation info:" << endl; + log->info() << "Compilation info:" << std::endl; char info_str[MAX_INFO_STRING_LENGTH]; get_compiler_info(info_str); - log->info() << " Compiler: " << info_str << endl; + log->info() << " Compiler: " << info_str << std::endl; get_compile_time(info_str); - log->info() << " Compiled on: " << info_str << endl; + log->info() << " Compiled on: " << info_str << std::endl; get_precision_info(info_str); - log->info() << " Precision: " << info_str << endl; + log->info() << " Precision: " << info_str << std::endl; get_intrinsics_info(info_str); - log->info() << " Intrinsics: " << info_str << endl; + log->info() << " Intrinsics: " << info_str << std::endl; get_rmm_normal_info(info_str); - log->info() << " RMM/normal: " << info_str << endl; + log->info() << " RMM/normal: " << info_str << std::endl; get_openmp_info(info_str); - log->info() << " OpenMP: " << info_str << endl; + log->info() << " OpenMP: " << info_str << std::endl; get_mpi_info(info_str); - log->info() << " MPI: " << info_str << endl; + log->info() << " MPI: " << info_str << std::endl; } /** * @brief Helper function outputting program invocation information to given logger */ void program_execution_info(int argc, char **argv, Log::Logger *log) { - log->info() << "Execution info:" << endl; + log->info() << "Execution info:" << std::endl; char info_str[MAX_INFO_STRING_LENGTH]; get_timestamp(info_str); - log->info() << " Started: " << info_str << endl; + log->info() << " Started: " << info_str << std::endl; get_host(info_str); - log->info() << " Execution host: " << info_str << endl; + log->info() << " Execution host: " << info_str << std::endl; std::stringstream arguments; for (int i = 0; i < argc; i++) { arguments << " " << argv[i]; } - log->info() << " Started with arguments: " << arguments.str() << endl; + log->info() << " Started with arguments: " << arguments.str() << std::endl; #if defined(_OPENMP) int num_threads = mardyn_get_max_threads(); - global_log->info() << " Running with " << num_threads << " OpenMP threads." << endl; + global_log->info() << " Running with " << num_threads << " OpenMP threads." << std::endl; // print thread pinning info PrintThreadPinningToCPU(); #endif @@ -106,21 +105,21 @@ void program_execution_info(int argc, char **argv, Log::Logger *log) { #ifdef ENABLE_MPI int world_size = 1; MPI_CHECK(MPI_Comm_size(MPI_COMM_WORLD, &world_size)); - global_log->info() << " Running with " << world_size << " MPI processes." << endl; + global_log->info() << " Running with " << world_size << " MPI processes." << std::endl; #endif } /** Run the internal unit tests */ -int run_unit_tests(const Values &options, const vector &args) { - string testcases(""); +int run_unit_tests(const Values &options, const std::vector &args) { + std::string testcases(""); if(args.size() == 1) { testcases = args[0]; - global_log->info() << "Running unit tests: " << testcases << endl; + global_log->info() << "Running unit tests: " << testcases << std::endl; } else { - global_log->info() << "Running all unit tests!" << endl; + global_log->info() << "Running all unit tests!" << std::endl; } std::string testDataDirectory(options.get("testDataDirectory")); - global_log->info() << "Test data directory: " << testDataDirectory << endl; + global_log->info() << "Test data directory: " << testDataDirectory << std::endl; Log::logLevel testLogLevel = (options.is_set("verbose") && options.get("verbose")) ? Log::All : Log::Info; int testresult = runTests(testLogLevel, testDataDirectory, testcases); return testresult; @@ -146,31 +145,31 @@ int main(int argc, char** argv) { optparse::OptionParser op; initOptions(&op); optparse::Values options = op.parse_args(argc, argv); - vector args = op.args(); + std::vector args = op.args(); - global_log->info() << "Running ls1-MarDyn version " << MARDYN_VERSION << endl; + global_log->info() << "Running ls1-MarDyn version " << MARDYN_VERSION << std::endl; #ifdef MARDYN_AUTOPAS global_log->info() << "Built with AutoPas version " << AutoPas_VERSION << std::endl; #endif #ifndef NDEBUG - global_log->warning() << "This ls1-MarDyn binary is a DEBUG build!" << endl; + global_log->warning() << "This ls1-MarDyn binary is a DEBUG build!" << std::endl; #endif if( options.is_set_by_user("logfile") ) { - string logfileNamePrefix(options.get("logfile")); - global_log->info() << "Using logfile with prefix " << logfileNamePrefix << endl; + std::string logfileNamePrefix(options.get("logfile")); + global_log->info() << "Using logfile with prefix " << logfileNamePrefix << std::endl; delete global_log; global_log = new Log::Logger(Log::Info, logfileNamePrefix); } if( options.is_set_by_user("verbose") ) { - global_log->info() << "Enabling verbose log output." << endl; + global_log->info() << "Enabling verbose log output." << std::endl; global_log->set_log_level(Log::All); } #ifdef ENABLE_SIGHANDLER if (options.is_set_by_user("sigsegvhandler")) { - global_log->info() << "Enabling sigsegvhandler." << endl; + global_log->info() << "Enabling sigsegvhandler." << std::endl; registerSigsegvHandler(); // from SigsegvHandler.h } #endif @@ -200,31 +199,31 @@ int main(int argc, char** argv) { /* First read the given config file if it exists, then overwrite parameters with command line arguments. */ std::string configFileName(args[0]); if( fileExists(configFileName.c_str()) ) { - global_log->info() << "Config file: " << configFileName << endl; + global_log->info() << "Config file: " << configFileName << std::endl; simulation.readConfigFile(configFileName); } else { - global_log->error() << "Cannot open config file '" << configFileName << "'" << endl; + global_log->error() << "Cannot open config file '" << configFileName << "'" << std::endl; Simulation::exit(-2); } /* processing command line arguments */ if ( (int) options.get("legacy-cell-processor") > 0 ) { simulation.useLegacyCellProcessor(); - global_log->info() << "--legacy-cell-processor specified, using legacyCellProcessor" << endl; + global_log->info() << "--legacy-cell-processor specified, using legacyCellProcessor" << std::endl; } if ( (int) options.get("final-checkpoint") > 0 ) { simulation.enableFinalCheckpoint(); - global_log->info() << "Final checkpoint enabled" << endl; + global_log->info() << "Final checkpoint enabled" << std::endl; } else { simulation.disableFinalCheckpoint(); - global_log->info() << "Final checkpoint disabled." << endl; + global_log->info() << "Final checkpoint disabled." << std::endl; } if( options.is_set_by_user("timed-checkpoint") ) { double checkpointtime = options.get("timed-checkpoint"); simulation.setForcedCheckpointTime(checkpointtime); - global_log->info() << "Enabling checkpoint after execution time: " << checkpointtime << " sec" << endl; + global_log->info() << "Enabling checkpoint after execution time: " << checkpointtime << " sec" << std::endl; } if (options.is_set_by_user("timesteps")) { @@ -233,10 +232,10 @@ int main(int argc, char** argv) { if (options.is_set_by_user("loop-abort-time")) { simulation.setLoopAbortTime(options.get("loop-abort-time").operator double()); } - global_log->info() << "Simulating " << simulation.getNumTimesteps() << " steps." << endl; + global_log->info() << "Simulating " << simulation.getNumTimesteps() << " steps." << std::endl; if(options.is_set_by_user("print-meminfo")) { - global_log->info() << "Enabling memory info output" << endl; + global_log->info() << "Enabling memory info output" << std::endl; simulation.enableMemoryProfiler(); } size_t lastIndex = configFileName.rfind("."); @@ -245,7 +244,7 @@ int main(int argc, char** argv) { outPrefix = options["outputprefix"]; } simulation.setOutputPrefix(outPrefix.c_str()); - global_log->info() << "Default output prefix: " << simulation.getOutputPrefix() << endl; + global_log->info() << "Default output prefix: " << simulation.getOutputPrefix() << std::endl; simulation.prepare_start(); @@ -256,17 +255,17 @@ int main(int argc, char** argv) { sim_timer.stop(); double runtime = sim_timer.get_etime(); //!@todo time only for simulation.simulate not "main"! - global_log->info() << "main: used " << fixed << setprecision(2) << runtime << " seconds" << endl << fixed << setprecision(5); - // FIXME: The statements "<< fixed << setprecision(5)" after endl are so that the next logger timestamp appears as expected. A better solution would be nice, of course. + global_log->info() << "main: used " << std::fixed << std::setprecision(2) << runtime << " seconds" << std::endl << std::fixed << std::setprecision(5); + // FIXME: The statements "<< std::fixed << std::setprecision(5)" after endl are so that the next logger timestamp appears as expected. A better solution would be nice, of course. // print out total simulation speed const unsigned long numTimesteps = simulation.getNumTimesteps() - simulation.getNumInitTimesteps(); const double speed = simulation.getTotalNumberOfMolecules() * numTimesteps / runtime; - global_log->info() << "Simulation speed: " << scientific << setprecision(6) << speed << " Molecule-updates per second." << endl << fixed << setprecision(5); + global_log->info() << "Simulation speed: " << std::scientific << std::setprecision(6) << speed << " Molecule-updates per second." << std::endl << std::fixed << std::setprecision(5); const double iterationsPerSecond = numTimesteps / runtime; - global_log->info() << "Iterations per second: " << fixed << setprecision(3) << iterationsPerSecond << endl << fixed << setprecision(5); - global_log->info() << "Time per iteration: " << fixed << setprecision(3) << 1.0 / iterationsPerSecond << " seconds." << endl << fixed << setprecision(5); + global_log->info() << "Iterations per second: " << std::fixed << std::setprecision(3) << iterationsPerSecond << std::endl << std::fixed << std::setprecision(5); + global_log->info() << "Time per iteration: " << std::fixed << std::setprecision(3) << 1.0 / iterationsPerSecond << " seconds." << std::endl << std::fixed << std::setprecision(5); double resources = runtime / 3600.0; #if defined(_OPENMP) @@ -278,7 +277,7 @@ int main(int argc, char** argv) { MPI_CHECK(MPI_Comm_size(MPI_COMM_WORLD, &world_size)); resources *= world_size; #endif - global_log->info() << "Used resources: " << fixed << setprecision(3) << resources << " core-hours" << endl << fixed << setprecision(5); + global_log->info() << "Used resources: " << std::fixed << std::setprecision(3) << resources << " core-hours" << std::endl << std::fixed << std::setprecision(5); simulation.finalize(); diff --git a/src/MarDyn_version.h b/src/MarDyn_version.h new file mode 100644 index 0000000000..f2c5d771c3 --- /dev/null +++ b/src/MarDyn_version.h @@ -0,0 +1,20 @@ +#pragma once + +#include + +const std::string MARDYN_VERSION_MAJOR = "1"; +const std::string MARDYN_VERSION_MINOR = "2"; +const std::string MARDYN_VERSION_PATCH = "0"; +const std::string MARDYN_VERSION_BRANCH = "_master"; +// this is the current git commit id +const std::string MARDYN_VERSION_HASH = "_3a847be73"; +// append "dirty" if uncommited code was used +const std::string MARDYN_VERSION_IS_DIRTY = "_dirty"; +// final combined version string +const std::string MARDYN_VERSION = + MARDYN_VERSION_MAJOR + "." + + MARDYN_VERSION_MINOR + "." + + MARDYN_VERSION_PATCH + + MARDYN_VERSION_BRANCH + + MARDYN_VERSION_HASH + + MARDYN_VERSION_IS_DIRTY; diff --git a/src/Simulation.cpp b/src/Simulation.cpp index c96310caaa..5d987c4318 100644 --- a/src/Simulation.cpp +++ b/src/Simulation.cpp @@ -80,8 +80,6 @@ #include "bhfmm/FastMultipoleMethod.h" #include "bhfmm/cellProcessors/VectorizedLJP2PCellProcessor.h" -using Log::global_log; -using namespace std; Simulation* global_simulation; @@ -169,61 +167,61 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { /* integrator */ if(xmlconfig.changecurrentnode("integrator")) { - string integratorType; + std::string integratorType; xmlconfig.getNodeValue("@type", integratorType); - global_log->info() << "Integrator type: " << integratorType << endl; + global_log->info() << "Integrator type: " << integratorType << std::endl; if(integratorType == "Leapfrog") { #ifdef ENABLE_REDUCED_MEMORY_MODE - global_log->error() << "The reduced memory mode (RMM) requires the LeapfrogRMM integrator." << endl; + global_log->error() << "The reduced memory mode (RMM) requires the LeapfrogRMM integrator." << std::endl; Simulation::exit(-1); #endif _integrator = new Leapfrog(); } else if (integratorType == "LeapfrogRMM") { _integrator = new LeapfrogRMM(); } else { - global_log-> error() << "Unknown integrator " << integratorType << endl; + global_log-> error() << "Unknown integrator " << integratorType << std::endl; Simulation::exit(1); } _integrator->readXML(xmlconfig); _integrator->init(); xmlconfig.changecurrentnode(".."); } else { - global_log->error() << "Integrator section missing." << endl; + global_log->error() << "Integrator section missing." << std::endl; } /* run section */ if(xmlconfig.changecurrentnode("run")) { xmlconfig.getNodeValueReduced("currenttime", _simulationTime); - global_log->info() << "Simulation start time: " << _simulationTime << endl; + global_log->info() << "Simulation start time: " << _simulationTime << std::endl; /* steps */ xmlconfig.getNodeValue("equilibration/steps", _initStatistics); - global_log->info() << "Number of equilibration steps: " << _initStatistics << endl; + global_log->info() << "Number of equilibration steps: " << _initStatistics << std::endl; xmlconfig.getNodeValue("production/steps", _numberOfTimesteps); - global_log->info() << "Number of timesteps: " << _numberOfTimesteps << endl; + global_log->info() << "Number of timesteps: " << _numberOfTimesteps << std::endl; xmlconfig.getNodeValue("production/loop-abort-time", _maxWallTime); if(_maxWallTime != -1) { - global_log->info() << "Max loop-abort-time set: " << _maxWallTime << endl; + global_log->info() << "Max loop-abort-time set: " << _maxWallTime << std::endl; _wallTimeEnabled = true; } xmlconfig.changecurrentnode(".."); } else { - global_log->error() << "Run section missing." << endl; + global_log->error() << "Run section missing." << std::endl; } /* ensemble */ if(xmlconfig.changecurrentnode("ensemble")) { - string ensembletype; + std::string ensembletype; xmlconfig.getNodeValue("@type", ensembletype); - global_log->info() << "Ensemble: " << ensembletype<< endl; + global_log->info() << "Ensemble: " << ensembletype<< std::endl; if (ensembletype == "NVT") { delete _ensemble; _ensemble = new CanonicalEnsemble(); } else if (ensembletype == "muVT") { - global_log->error() << "muVT ensemble not completely implemented via XML input." << endl; + global_log->error() << "muVT ensemble not completely implemented via XML input." << std::endl; /* TODO: GrandCanonical terminates as readXML is not implemented and it is not tested yet. */ _ensemble = new GrandCanonicalEnsemble(); } else { - global_log->error() << "Unknown ensemble type: " << ensembletype << endl; + global_log->error() << "Unknown ensemble type: " << ensembletype << std::endl; Simulation::exit(1); } _ensemble->readXML(xmlconfig); @@ -236,7 +234,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { xmlconfig.changecurrentnode(".."); } else { - global_log->error() << "Ensemble section missing." << endl; + global_log->error() << "Ensemble section missing." << std::endl; Simulation::exit(1); } @@ -248,7 +246,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { const std::size_t neededCoeffs = compNum*(compNum-1); if(dmixcoeff.size() < neededCoeffs){ global_log->warning() << "Not enough mixing coefficients were given! (Filling the missing ones with 1)" << '\n'; - global_log->warning() << "This can happen because the xml-input doesn't support these yet!" << endl; + global_log->warning() << "This can happen because the xml-input doesn't support these yet!" << std::endl; unsigned int numcomponents = _simulation.getEnsemble()->getComponents()->size(); for (unsigned int i = dmixcoeff.size(); i < neededCoeffs; i++) { dmixcoeff.push_back(1); @@ -260,25 +258,25 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { /* cutoffs */ if(xmlconfig.changecurrentnode("cutoffs")) { if(xmlconfig.getNodeValueReduced("defaultCutoff", _cutoffRadius)) { - global_log->info() << "dimensionless default cutoff radius:\t" << _cutoffRadius << endl; + global_log->info() << "dimensionless default cutoff radius:\t" << _cutoffRadius << std::endl; } if(xmlconfig.getNodeValueReduced("radiusLJ", _LJCutoffRadius)) { - global_log->info() << "dimensionless LJ cutoff radius:\t" << _LJCutoffRadius << endl; + global_log->info() << "dimensionless LJ cutoff radius:\t" << _LJCutoffRadius << std::endl; for(auto &component: *(_ensemble->getComponents())) { component.updateAllLJcentersShift(_LJCutoffRadius); } } /** @todo introduce maxCutoffRadius here for datastructures, ... * maybe use map/list to store cutoffs for different potentials? */ - _cutoffRadius = max(_cutoffRadius, _LJCutoffRadius); + _cutoffRadius = std::max(_cutoffRadius, _LJCutoffRadius); if(_cutoffRadius <= 0) { - global_log->error() << "cutoff radius <= 0." << endl; + global_log->error() << "cutoff radius <= 0." << std::endl; Simulation::exit(1); } - global_log->info() << "dimensionless cutoff radius:\t" << _cutoffRadius << endl; + global_log->info() << "dimensionless cutoff radius:\t" << _cutoffRadius << std::endl; xmlconfig.changecurrentnode(".."); } else { - global_log->error() << "Cutoff section missing." << endl; + global_log->error() << "Cutoff section missing." << std::endl; Simulation::exit(1); } @@ -287,11 +285,11 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { if(xmlconfig.changecurrentnode("electrostatic[@type='ReactionField']")) { double epsilonRF = 0; xmlconfig.getNodeValueReduced("epsilon", epsilonRF); - global_log->info() << "Epsilon Reaction Field: " << epsilonRF << endl; + global_log->info() << "Epsilon Reaction Field: " << epsilonRF << std::endl; _domain->setepsilonRF(epsilonRF); xmlconfig.changecurrentnode(".."); } else { - global_log->error() << "Electrostatics section for reaction field setup missing." << endl; + global_log->error() << "Electrostatics section for reaction field setup missing." << std::endl; Simulation::exit(1); } @@ -309,15 +307,15 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { /* parallelisation */ if(xmlconfig.changecurrentnode("parallelisation")) { - string parallelisationtype("DomainDecomposition"); + std::string parallelisationtype("DomainDecomposition"); xmlconfig.getNodeValue("@type", parallelisationtype); - global_log->info() << "Parallelisation type: " << parallelisationtype << endl; + global_log->info() << "Parallelisation type: " << parallelisationtype << std::endl; xmlconfig.getNodeValue("overlappingP2P", _overlappingP2P); - global_log->info() << "Using overlapping p2p communication: " << _overlappingP2P << endl; + global_log->info() << "Using overlapping p2p communication: " << _overlappingP2P << std::endl; #ifdef ENABLE_MPI /// @todo Dummy Decomposition now included in DecompBase - still keep this name? if(parallelisationtype == "DummyDecomposition") { - global_log->error() << "DummyDecomposition not available in parallel mode." << endl; + global_log->error() << "DummyDecomposition not available in parallel mode." << std::endl; } else if(parallelisationtype == "DomainDecomposition") { delete _domainDecomposition; @@ -333,34 +331,34 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { // container's xml, because the ParticleContainer needs to be instantiated later. :/ xmlconfig.changecurrentnode(".."); if (xmlconfig.changecurrentnode("datastructure")) { - string datastructuretype; + std::string datastructuretype; xmlconfig.getNodeValue("@type", datastructuretype); if (datastructuretype == "AutoPas" or datastructuretype == "AutoPasContainer") { xmlconfig.getNodeValue("skin", skin); } else { global_log->warning() << "Using the GeneralDomainDecomposition without AutoPas is not " "thoroughly tested and considered BETA." - << endl; + << std::endl; // Force grid! This is needed, as the linked cells container assumes a grid and the calculation // of global values will be faulty without one! global_log->info() << "Forcing a grid for the GeneralDomainDecomposition! This is required " "to get correct global values!" - << endl; + << std::endl; forceLatchingToLinkedCellsGrid = true; } global_log->info() << "Using skin = " << skin << " for the GeneralDomainDecomposition." << std::endl; } else { - global_log->error() << "Datastructure section missing" << endl; + global_log->error() << "Datastructure section missing" << std::endl; Simulation::exit(1); } if(not xmlconfig.changecurrentnode("../parallelisation")){ - global_log->error() << "Could not go back to parallelisation path. Aborting." << endl; + global_log->error() << "Could not go back to parallelisation path. Aborting." << std::endl; Simulation::exit(1); } delete _domainDecomposition; _domainDecomposition = new GeneralDomainDecomposition(getcutoffRadius() + skin, _domain, forceLatchingToLinkedCellsGrid); } else { - global_log->error() << "Unknown parallelisation type: " << parallelisationtype << endl; + global_log->error() << "Unknown parallelisation type: " << parallelisationtype << std::endl; Simulation::exit(1); } #else /* serial */ @@ -368,7 +366,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { global_log->warning() << "Executable was compiled without support for parallel execution: " << parallelisationtype - << " not available. Using serial mode." << endl; + << " not available. Using serial mode." << std::endl; //Simulation::exit(1); } //_domainDecomposition = new DomainDecompBase(); // already set in initialize() @@ -380,7 +378,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { } #endif - string loadTimerStr("SIMULATION_FORCE_CALCULATION"); + std::string loadTimerStr("SIMULATION_FORCE_CALCULATION"); xmlconfig.getNodeValue("timerForLoad", loadTimerStr); global_log->info() << "Using timer " << loadTimerStr << " for the load calculation." << std::endl; _timerForLoad = timers()->getTimer(loadTimerStr); @@ -404,7 +402,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { } else { #ifdef ENABLE_MPI - global_log->error() << "Parallelisation section missing." << endl; + global_log->error() << "Parallelisation section missing." << std::endl; Simulation::exit(1); #else /* serial */ // set _timerForLoad, s.t. it always exists. @@ -415,9 +413,9 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { /* datastructure */ if(xmlconfig.changecurrentnode("datastructure")) { - string datastructuretype; + std::string datastructuretype; xmlconfig.getNodeValue("@type", datastructuretype); - global_log->info() << "Datastructure type: " << datastructuretype << endl; + global_log->info() << "Datastructure type: " << datastructuretype << std::endl; if(datastructuretype == "LinkedCells") { #ifdef MARDYN_AUTOPAS global_log->fatal() @@ -427,7 +425,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { #else _moleculeContainer = new LinkedCells(); /** @todo Review if we need to know the max cutoff radius usable with any datastructure. */ - global_log->info() << "Setting cell cutoff radius for linked cell datastructure to " << _cutoffRadius << endl; + global_log->info() << "Setting cell cutoff radius for linked cell datastructure to " << _cutoffRadius << std::endl; _moleculeContainer->setCutoff(_cutoffRadius); #endif } else if(datastructuretype == "AdaptiveSubCells") { @@ -437,14 +435,14 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { #ifdef MARDYN_AUTOPAS global_log->info() << "Using AutoPas container." << std::endl; _moleculeContainer = new AutoPasContainer(_cutoffRadius); - global_log->info() << "Setting cell cutoff radius for AutoPas container to " << _cutoffRadius << endl; + global_log->info() << "Setting cell cutoff radius for AutoPas container to " << _cutoffRadius << std::endl; #else global_log->fatal() << "AutoPas not compiled (use LinkedCells instead, or compile with enabled autopas mode)!" << std::endl; Simulation::exit(33); #endif } else { - global_log->error() << "Unknown data structure type: " << datastructuretype << endl; + global_log->error() << "Unknown data structure type: " << datastructuretype << std::endl; Simulation::exit(1); } _moleculeContainer->readXML(xmlconfig); @@ -456,7 +454,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { _domainDecomposition->updateSendLeavingWithCopies(sendTogether); xmlconfig.changecurrentnode(".."); } else { - global_log->error() << "Datastructure section missing" << endl; + global_log->error() << "Datastructure section missing" << std::endl; Simulation::exit(1); } @@ -466,32 +464,32 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { long numThermostats = 0; XMLfile::Query query = xmlconfig.query("thermostat"); numThermostats = query.card(); - global_log->info() << "Number of thermostats: " << numThermostats << endl; + global_log->info() << "Number of thermostats: " << numThermostats << std::endl; if(numThermostats > 1) { - global_log->info() << "Enabling component wise thermostat" << endl; + global_log->info() << "Enabling component wise thermostat" << std::endl; _velocityScalingThermostat.enableComponentwise(); } - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); XMLfile::Query::const_iterator thermostatIter; for( thermostatIter = query.begin(); thermostatIter; thermostatIter++ ) { xmlconfig.changecurrentnode( thermostatIter ); - string thermostattype; + std::string thermostattype; xmlconfig.getNodeValue("@type", thermostattype); if(thermostattype == "VelocityScaling") { double temperature = _ensemble->T(); xmlconfig.getNodeValue("temperature", temperature); - string componentName("global"); + std::string componentName("global"); xmlconfig.getNodeValue("@componentId", componentName); if(componentName == "global"){ _domain->setGlobalTemperature(temperature); - global_log->info() << "Adding global velocity scaling thermostat, T = " << temperature << endl; + global_log->info() << "Adding global velocity scaling thermostat, T = " << temperature << std::endl; } else { int componentId = 0; componentId = getEnsemble()->getComponent(componentName)->ID(); int thermostatID = _domain->getThermostat(componentId); _domain->setTargetTemperature(thermostatID, temperature); - global_log->info() << "Adding velocity scaling thermostat for component '" << componentName << "' (ID: " << componentId << "), T = " << temperature << endl; + global_log->info() << "Adding velocity scaling thermostat for component '" << componentName << "' (ID: " << componentId << "), T = " << temperature << std::endl; } } else if(thermostattype == "TemperatureControl") { @@ -500,13 +498,13 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { _temperatureControl->readXML(xmlconfig); } else { global_log->error() << "Instance of TemperatureControl allready exist! Programm exit ..." - << endl; + << std::endl; Simulation::exit(-1); } } else { - global_log->warning() << "Unknown thermostat " << thermostattype << endl; + global_log->warning() << "Unknown thermostat " << thermostattype << std::endl; continue; } } @@ -514,7 +512,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { xmlconfig.changecurrentnode(".."); } else { - global_log->warning() << "Thermostats section missing." << endl; + global_log->warning() << "Thermostats section missing." << std::endl; } /* long range correction */ @@ -523,21 +521,21 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { std::string type; if( !xmlconfig.getNodeValue("@type", type) ) { - global_log->error() << "LongRangeCorrection: Missing type specification. Program exit ..." << endl; + global_log->error() << "LongRangeCorrection: Missing type specification. Program exit ..." << std::endl; Simulation::exit(-1); } if("planar" == type) { unsigned int nSlabs = 10; delete _longRangeCorrection; - global_log->info() << "Initializing planar LRC." << endl; + global_log->info() << "Initializing planar LRC." << std::endl; _longRangeCorrection = new Planar(_cutoffRadius, _LJCutoffRadius, _domain, _domainDecomposition, _moleculeContainer, nSlabs, global_simulation); _longRangeCorrection->readXML(xmlconfig); } else if("homogeneous" == type) { delete _longRangeCorrection; - global_log->info() << "Initializing homogeneous LRC." << endl; + global_log->info() << "Initializing homogeneous LRC." << std::endl; _longRangeCorrection = new Homogeneous(_cutoffRadius, _LJCutoffRadius, _domain, global_simulation); } else if("none" == type) @@ -547,53 +545,53 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { } else { - global_log->error() << "LongRangeCorrection: Wrong type. Expected type == homogeneous|planar|none. Program exit ..." << endl; + global_log->error() << "LongRangeCorrection: Wrong type. Expected type == homogeneous|planar|none. Program exit ..." << std::endl; Simulation::exit(-1); } xmlconfig.changecurrentnode(".."); } else { delete _longRangeCorrection; - global_log->info() << "Initializing default homogeneous LRC, as no LRC was defined." << endl; + global_log->info() << "Initializing default homogeneous LRC, as no LRC was defined." << std::endl; _longRangeCorrection = new Homogeneous(_cutoffRadius, _LJCutoffRadius, _domain, global_simulation); } xmlconfig.changecurrentnode(".."); /* algorithm section */ } else { - global_log->error() << "Algorithm section missing." << endl; + global_log->error() << "Algorithm section missing." << std::endl; } - global_log -> info() << "Registering default plugins..." << endl; + global_log -> info() << "Registering default plugins..." << std::endl; // REGISTERING/ENABLING PLUGINS PluginFactory pluginFactory; pluginFactory.registerDefaultPlugins(); - global_log -> info() << "Successfully registered plugins." << endl; + global_log -> info() << "Successfully registered plugins." << std::endl; long numPlugs = 0; numPlugs += pluginFactory.enablePlugins(_plugins, xmlconfig, "plugin", _domain); numPlugs += pluginFactory.enablePlugins(_plugins, xmlconfig, "output/outputplugin", _domain); - global_log -> info() << "Number of enabled Plugins: " << numPlugs << endl; + global_log -> info() << "Number of enabled Plugins: " << numPlugs << std::endl; - global_log -> info() << "Registering callbacks." << endl; + global_log -> info() << "Registering callbacks." << std::endl; for(auto&& plugin : _plugins) { plugin->registerCallbacks(_callbacks); } - global_log -> info() << _callbacks.size() << " callbacks registered." << endl; + global_log -> info() << _callbacks.size() << " callbacks registered." << std::endl; - global_log -> info() << "Accessing callbacks." << endl; + global_log -> info() << "Accessing callbacks." << std::endl; for(auto&& plugin : _plugins) { plugin->accessAllCallbacks(_callbacks); } - global_log -> info() << "Accessed callbacks." << endl; + global_log -> info() << "Accessed callbacks." << std::endl; - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); if(xmlconfig.changecurrentnode("ensemble/phasespacepoint/file")) { - global_log->info() << "Reading phase space from file." << endl; - string pspfiletype; + global_log->info() << "Reading phase space from file." << std::endl; + std::string pspfiletype; xmlconfig.getNodeValue("@type", pspfiletype); - global_log->info() << "Phase space file type: " << pspfiletype << endl; + global_log->info() << "Phase space file type: " << pspfiletype << std::endl; if (pspfiletype == "ASCII") { _inputReader = new ASCIIReader(); @@ -613,7 +611,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { } #endif else { - global_log->error() << "Unknown phase space file type" << endl; + global_log->error() << "Unknown phase space file type" << std::endl; Simulation::exit(-1); } } @@ -621,9 +619,9 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { oldpath = xmlconfig.getcurrentnodepath(); if(xmlconfig.changecurrentnode("ensemble/phasespacepoint/generator")) { - string generatorName; + std::string generatorName; xmlconfig.getNodeValue("@name", generatorName); - global_log->info() << "Initializing phase space using generator: " << generatorName << endl; + global_log->info() << "Initializing phase space using generator: " << generatorName << std::endl; if(generatorName == "MultiObjectGenerator") { _inputReader = new MultiObjectGenerator(); } @@ -643,7 +641,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { _inputReader = new PerCellGenerator(); } else { - global_log->error() << "Unknown generator: " << generatorName << endl; + global_log->error() << "Unknown generator: " << generatorName << std::endl; Simulation::exit(1); } _inputReader->readXML(xmlconfig); @@ -670,7 +668,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { unsigned long numOptions = 0; XMLfile::Query query = xmlconfig.query("option"); numOptions = query.card(); - global_log->info() << "Number of prepare start options: " << numOptions << endl; + global_log->info() << "Number of prepare start options: " << numOptions << std::endl; XMLfile::Query::const_iterator optionIter; for( optionIter = query.begin(); optionIter; optionIter++ ) { @@ -682,13 +680,13 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { xmlconfig.getNodeValue(".", bVal); _prepare_start_opt.refreshIDs = bVal; if(_prepare_start_opt.refreshIDs) - global_log->info() << "Particle IDs will be refreshed before simulation start." << endl; + global_log->info() << "Particle IDs will be refreshed before simulation start." << std::endl; else - global_log->info() << "Particle IDs will NOT be refreshed before simulation start." << endl; + global_log->info() << "Particle IDs will NOT be refreshed before simulation start." << std::endl; } else { - global_log->warning() << "Unknown option '" << strOptionName << "'" << endl; + global_log->warning() << "Unknown option '" << strOptionName << "'" << std::endl; } } } @@ -696,42 +694,42 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { } -void Simulation::readConfigFile(string filename) { - string extension(getFileExtension(filename.c_str())); - global_log->debug() << "Found config filename extension: " << extension << endl; +void Simulation::readConfigFile(std::string filename) { + std::string extension(getFileExtension(filename.c_str())); + global_log->debug() << "Found config filename extension: " << extension << std::endl; if (extension == "xml") { initConfigXML(filename); } else { - global_log->error() << "Unknown config file extension '" << extension << "'." << endl; + global_log->error() << "Unknown config file extension '" << extension << "'." << std::endl; Simulation::exit(1); } } -void Simulation::initConfigXML(const string& inputfilename) { - global_log->info() << "Initializing XML config file: " << inputfilename << endl; +void Simulation::initConfigXML(const std::string& inputfilename) { + global_log->info() << "Initializing XML config file: " << inputfilename << std::endl; try{ XMLfileUnits inp(inputfilename); - global_log->debug() << "Input XML:" << endl << string(inp) << endl; + global_log->debug() << "Input XML:" << std::endl << std::string(inp) << std::endl; if(inp.changecurrentnode("/mardyn") < 0) { - global_log->error() << "Cound not find root node /mardyn in XML input file." << endl; - global_log->fatal() << "Not a valid MarDyn XML input file." << endl; + global_log->error() << "Cound not find root node /mardyn in XML input file." << std::endl; + global_log->fatal() << "Not a valid MarDyn XML input file." << std::endl; Simulation::exit(1); } - string version("unknown"); + std::string version("unknown"); inp.getNodeValue("@version", version); - global_log->info() << "MarDyn XML config file version: " << version << endl; + global_log->info() << "MarDyn XML config file version: " << version << std::endl; if(inp.changecurrentnode("simulation")) { readXML(inp); inp.changecurrentnode(".."); } // simulation-section else { - global_log->error() << "Simulation section missing" << endl; + global_log->error() << "Simulation section missing" << std::endl; Simulation::exit(1); } } catch (const std::exception& e) { @@ -749,7 +747,7 @@ void Simulation::initConfigXML(const string& inputfilename) { #endif // read particle data (or generate particles, if a generator is chosen) - timers()->registerTimer("PHASESPACE_CREATION", vector{"SIMULATION_IO"}, new Timer()); + timers()->registerTimer("PHASESPACE_CREATION", std::vector{"SIMULATION_IO"}, new Timer()); timers()->setOutputString("PHASESPACE_CREATION", "Phasespace creation took:"); timers()->getTimer("PHASESPACE_CREATION")->start(); @@ -762,7 +760,7 @@ void Simulation::initConfigXML(const string& inputfilename) { unsigned long globalNumMolecules = _domain->getglobalNumMolecules(true, _moleculeContainer, _domainDecomposition); double rho_global = globalNumMolecules / _ensemble->V(); global_log->info() << "Setting domain class parameters: N_global: " << globalNumMolecules - << ", rho_global: " << rho_global << ", T_global: " << _ensemble->T() << endl; + << ", rho_global: " << rho_global << ", T_global: " << _ensemble->T() << std::endl; _domain->setGlobalTemperature(_ensemble->T()); _domain->setglobalRho(rho_global); @@ -785,19 +783,19 @@ void Simulation::updateForces() { } void Simulation::prepare_start() { - global_log->info() << "Initializing simulation" << endl; + global_log->info() << "Initializing simulation" << std::endl; - global_log->info() << "Initialising cell processor" << endl; + global_log->info() << "Initialising cell processor" << std::endl; if (!_legacyCellProcessor) { #ifndef ENABLE_REDUCED_MEMORY_MODE - global_log->info() << "Using vectorized cell processor." << endl; + global_log->info() << "Using vectorized cell processor." << std::endl; _cellProcessor = new VectorizedCellProcessor( *_domain, _cutoffRadius, _LJCutoffRadius); #else - global_log->info() << "Using reduced memory mode (RMM) cell processor." << endl; + global_log->info() << "Using reduced memory mode (RMM) cell processor." << std::endl; _cellProcessor = new VCP1CLJRMM( *_domain, _cutoffRadius, _LJCutoffRadius); #endif } else { - global_log->info() << "Using legacy cell processor." << endl; + global_log->info() << "Using legacy cell processor." << std::endl; _cellProcessor = new LegacyCellProcessor( _cutoffRadius, _LJCutoffRadius, _particlePairsHandler); } @@ -825,9 +823,9 @@ void Simulation::prepare_start() { } #endif - global_log->info() << "Clearing halos" << endl; + global_log->info() << "Clearing halos" << std::endl; _moleculeContainer->deleteOuterParticles(); - global_log->info() << "Updating domain decomposition" << endl; + global_log->info() << "Updating domain decomposition" << std::endl; if(getMemoryProfiler()) { getMemoryProfiler()->doOutput("without halo copies"); @@ -847,17 +845,17 @@ void Simulation::prepare_start() { vcp1clj_wr_cellProcessor->setDtInvm(dt_inv_m * 0.5); #endif /* ENABLE_REDUCED_MEMORY_MODE */ - global_log->info() << "Performing initial force calculation" << endl; + global_log->info() << "Performing initial force calculation" << std::endl; global_simulation->timers()->start("SIMULATION_FORCE_CALCULATION"); _moleculeContainer->traverseCells(*_cellProcessor); global_simulation->timers()->stop("SIMULATION_FORCE_CALCULATION"); if (_longRangeCorrection != nullptr) { - global_log->info() << "Initializing LongRangeCorrection" << endl; + global_log->info() << "Initializing LongRangeCorrection" << std::endl; _longRangeCorrection->init(); } else { - global_log->fatal() << "No _longRangeCorrection set!" << endl; + global_log->fatal() << "No _longRangeCorrection set!" << std::endl; Simulation::exit(93742); } // longRangeCorrection is a site-wise force plugin, so we have to call it before updateForces() @@ -881,7 +879,7 @@ void Simulation::prepare_start() { ++_loopCompTimeSteps; if (_FMM != nullptr) { - global_log->info() << "Performing initial FMM force calculation" << endl; + global_log->info() << "Performing initial FMM force calculation" << std::endl; _FMM->computeElectrostatics(_moleculeContainer); } @@ -891,27 +889,27 @@ void Simulation::prepare_start() { // initializing plugins and starting plugin timers for (auto& plugin : _plugins) { - global_log->info() << "Initializing plugin " << plugin->getPluginName() << endl; + global_log->info() << "Initializing plugin " << plugin->getPluginName() << std::endl; plugin->init(_moleculeContainer, _domainDecomposition, _domain); - string timer_name = plugin->getPluginName(); + std::string timer_name = plugin->getPluginName(); // TODO: real timer - global_simulation->timers()->registerTimer(timer_name, vector{"SIMULATION_PER_STEP_IO"}, new Timer()); - string timer_plugin_string = string("Plugin ") + timer_name + string(" took:"); + global_simulation->timers()->registerTimer(timer_name, std::vector{"SIMULATION_PER_STEP_IO"}, new Timer()); + std::string timer_plugin_string = std::string("Plugin ") + timer_name + std::string(" took:"); global_simulation->timers()->setOutputString(timer_name, timer_plugin_string); } //afterForces Plugin Call global_log->debug() << "[AFTER FORCES] Performing AfterForces plugin call" - << endl; + << std::endl; for (auto plugin : _plugins) { global_log->debug() << "[AFTER FORCES] Plugin: " - << plugin->getPluginName() << endl; + << plugin->getPluginName() << std::endl; plugin->afterForces(_moleculeContainer, _domainDecomposition, _simstep); } #ifndef MARDYN_AUTOPAS // clear halo - global_log->info() << "Clearing halos" << endl; + global_log->info() << "Clearing halos" << std::endl; _moleculeContainer->deleteOuterParticles(); #endif @@ -920,20 +918,20 @@ void Simulation::prepare_start() { // integrator->eventForcesCalculated should not be called, since otherwise the velocities would already be updated. //updateForces(); - global_log->info() << "Calculating global values" << endl; + global_log->info() << "Calculating global values" << std::endl; _domain->calculateThermostatDirectedVelocity(_moleculeContainer); _domain->calculateVelocitySums(_moleculeContainer); _domain->calculateGlobalValues(_domainDecomposition, _moleculeContainer, true, 1.0); - global_log->debug() << "Calculating global values finished." << endl; + global_log->debug() << "Calculating global values finished." << std::endl; _ensemble->prepare_start(); _simstep = _initSimulation = (unsigned long) round(_simulationTime / _integrator->getTimestepLength() ); - global_log->info() << "Set initial time step to start from to " << _initSimulation << endl; - global_log->info() << "System initialised with " << _domain->getglobalNumMolecules(true, _moleculeContainer, _domainDecomposition) << " molecules." << endl; + global_log->info() << "Set initial time step to start from to " << _initSimulation << std::endl; + global_log->info() << "System initialised with " << _domain->getglobalNumMolecules(true, _moleculeContainer, _domainDecomposition) << " molecules." << std::endl; /** refresh particle IDs */ if(_prepare_start_opt.refreshIDs) @@ -941,14 +939,14 @@ void Simulation::prepare_start() { } void Simulation::simulate() { - global_log->info() << "Started simulation" << endl; + global_log->info() << "Started simulation" << std::endl; _ensemble->updateGlobalVariable(_moleculeContainer, NUM_PARTICLES); - global_log->debug() << "Number of particles in the Ensemble: " << _ensemble->N() << endl; + global_log->debug() << "Number of particles in the Ensemble: " << _ensemble->N() << std::endl; // ensemble.updateGlobalVariable(ENERGY); -// global_log->debug() << "Kinetic energy in the Ensemble: " << ensemble.E() << endl; +// global_log->debug() << "Kinetic energy in the Ensemble: " << ensemble.E() << std::endl; // ensemble.updateGlobalVariable(TEMPERATURE); -// global_log->debug() << "Temperature of the Ensemble: " << ensemble.T() << endl;*/ +// global_log->debug() << "Temperature of the Ensemble: " << ensemble.T() << std::endl;*/ /***************************************************************************/ /* BEGIN MAIN LOOP */ @@ -1000,16 +998,16 @@ void Simulation::simulate() { double previousTimeForLoad = 0.; while (keepRunning()) { - global_log->debug() << "timestep: " << getSimulationStep() << endl; - global_log->debug() << "simulation time: " << getSimulationTime() << endl; + global_log->debug() << "timestep: " << getSimulationStep() << std::endl; + global_log->debug() << "simulation time: " << getSimulationTime() << std::endl; global_simulation->timers()->incrementTimerTimestepCounter(); computationTimer->start(); // beforeEventNewTimestep Plugin Call - global_log -> debug() << "[BEFORE EVENT NEW TIMESTEP] Performing beforeEventNewTimestep plugin call" << endl; + global_log -> debug() << "[BEFORE EVENT NEW TIMESTEP] Performing beforeEventNewTimestep plugin call" << std::endl; for (auto plugin : _plugins) { - global_log -> debug() << "[BEFORE EVENT NEW TIMESTEP] Plugin: " << plugin->getPluginName() << endl; + global_log -> debug() << "[BEFORE EVENT NEW TIMESTEP] Plugin: " << plugin->getPluginName() << std::endl; plugin->beforeEventNewTimestep(_moleculeContainer, _domainDecomposition, _simstep); } @@ -1018,9 +1016,9 @@ void Simulation::simulate() { _integrator->eventNewTimestep(_moleculeContainer, _domain); // beforeForces Plugin Call - global_log -> debug() << "[BEFORE FORCES] Performing BeforeForces plugin call" << endl; + global_log -> debug() << "[BEFORE FORCES] Performing BeforeForces plugin call" << std::endl; for (auto plugin : _plugins) { - global_log -> debug() << "[BEFORE FORCES] Plugin: " << plugin->getPluginName() << endl; + global_log -> debug() << "[BEFORE FORCES] Plugin: " << plugin->getPluginName() << std::endl; plugin->beforeForces(_moleculeContainer, _domainDecomposition, _simstep); } @@ -1044,7 +1042,7 @@ void Simulation::simulate() { else { decompositionTimer->start(); // ensure that all Particles are in the right cells and exchange Particles - global_log->debug() << "Updating container and decomposition" << endl; + global_log->debug() << "Updating container and decomposition" << std::endl; double currentTime = _timerForLoad->get_etime(); updateParticleContainerAndDecomposition(currentTime - previousTimeForLoad, true); @@ -1053,7 +1051,7 @@ void Simulation::simulate() { decompositionTimer->stop(); // Force calculation and other pair interaction related computations - global_log->debug() << "Traversing pairs" << endl; + global_log->debug() << "Traversing pairs" << std::endl; computationTimer->start(); forceCalculationTimer->start(); @@ -1062,9 +1060,9 @@ void Simulation::simulate() { } // siteWiseForces Plugin Call - global_log -> debug() << "[SITEWISE FORCES] Performing siteWiseForces plugin call" << endl; + global_log -> debug() << "[SITEWISE FORCES] Performing siteWiseForces plugin call" << std::endl; for (auto plugin : _plugins) { - global_log -> debug() << "[SITEWISE FORCES] Plugin: " << plugin->getPluginName() << endl; + global_log -> debug() << "[SITEWISE FORCES] Plugin: " << plugin->getPluginName() << std::endl; plugin->siteWiseForces(_moleculeContainer, _domainDecomposition, _simstep); } @@ -1091,21 +1089,21 @@ void Simulation::simulate() { if (_FMM != nullptr) { - global_log->debug() << "Performing FMM calculation" << endl; + global_log->debug() << "Performing FMM calculation" << std::endl; _FMM->computeElectrostatics(_moleculeContainer); } //afterForces Plugin Call - global_log -> debug() << "[AFTER FORCES] Performing AfterForces plugin call" << endl; + global_log -> debug() << "[AFTER FORCES] Performing AfterForces plugin call" << std::endl; for (auto plugin : _plugins) { - global_log -> debug() << "[AFTER FORCES] Plugin: " << plugin->getPluginName() << endl; + global_log -> debug() << "[AFTER FORCES] Plugin: " << plugin->getPluginName() << std::endl; plugin->afterForces(_moleculeContainer, _domainDecomposition, _simstep); } _ensemble->afterForces(_moleculeContainer, _domainDecomposition, _cellProcessor, _simstep); // TODO: test deletions and insertions - global_log->debug() << "Deleting outer particles / clearing halo." << endl; + global_log->debug() << "Deleting outer particles / clearing halo." << std::endl; #ifndef MARDYN_AUTOPAS _moleculeContainer->deleteOuterParticles(); #endif @@ -1118,11 +1116,11 @@ void Simulation::simulate() { _ensemble->beforeThermostat(_simstep, _initStatistics); - global_log->debug() << "Inform the integrator (forces calculated)" << endl; + global_log->debug() << "Inform the integrator (forces calculated)" << std::endl; _integrator->eventForcesCalculated(_moleculeContainer, _domain); // calculate the global macroscopic values from the local values - global_log->debug() << "Calculate macroscopic values" << endl; + global_log->debug() << "Calculate macroscopic values" << std::endl; _domain->calculateGlobalValues(_domainDecomposition, _moleculeContainer, (!(_simstep % _collectThermostatDirectedVelocity)), Tfactor(_simstep)); @@ -1130,7 +1128,7 @@ void Simulation::simulate() { // TODO: integrate into Temperature Control if ( !_domain->NVE() && _temperatureControl == nullptr) { if (_thermostatType ==VELSCALE_THERMOSTAT) { - global_log->debug() << "Velocity scaling" << endl; + global_log->debug() << "Velocity scaling" << std::endl; if (_domain->severalThermostats()) { _velocityScalingThermostat.enableComponentwise(); for(unsigned int cid = 0; cid < global_simulation->getEnsemble()->getComponents()->size(); cid++) { @@ -1139,7 +1137,7 @@ void Simulation::simulate() { _velocityScalingThermostat.setBetaRot(thermostatId, _domain->getGlobalBetaRot(thermostatId)); global_log->debug() << "Thermostat for CID: " << cid << " thermID: " << thermostatId << " B_trans: " << _velocityScalingThermostat.getBetaTrans(thermostatId) - << " B_rot: " << _velocityScalingThermostat.getBetaRot(thermostatId) << endl; + << " B_rot: " << _velocityScalingThermostat.getBetaRot(thermostatId) << std::endl; double v[3]; for(int d = 0; d < 3; d++) { v[d] = _domain->getThermostatDirectedVelocity(thermostatId, d); @@ -1173,12 +1171,12 @@ void Simulation::simulate() { //! @todo the number of particles per component stored in components has to be //! updated here in case we insert/remove particles // _ensemble->updateGlobalVariable(NUM_PARTICLES); - // global_log->debug() << "Number of particles in the Ensemble: " << _ensemble->N() << endl; + // global_log->debug() << "Number of particles in the Ensemble: " << _ensemble->N() << std::endl; /* ensemble.updateGlobalVariable(ENERGY); - global_log->debug() << "Kinetic energy in the Ensemble: " << ensemble.E() << endl; + global_log->debug() << "Kinetic energy in the Ensemble: " << ensemble.E() << std::endl; ensemble.updateGlobalVariable(TEMPERATURE); - global_log->debug() << "Temperature of the Ensemble: " << ensemble.T() << endl; + global_log->debug() << "Temperature of the Ensemble: " << ensemble.T() << std::endl; */ /* END PHYSICAL SECTION */ @@ -1191,8 +1189,8 @@ void Simulation::simulate() { if( (_forced_checkpoint_time > 0) && (loopTimer->get_etime() >= _forced_checkpoint_time) ) { /* force checkpoint for specified time */ - string cpfile(_outputPrefix + ".timed.restart.dat"); - global_log->info() << "Writing timed, forced checkpoint to file '" << cpfile << "'" << endl; + std::string cpfile(_outputPrefix + ".timed.restart.dat"); + global_log->info() << "Writing timed, forced checkpoint to file '" << cpfile << "'" << std::endl; _domain->writeCheckpoint(cpfile, _moleculeContainer, _domainDecomposition, _simulationTime); _forced_checkpoint_time = -1; /* disable for further timesteps */ } @@ -1204,34 +1202,34 @@ void Simulation::simulate() { /***************************************************************************/ - global_simulation->timers()->registerTimer("SIMULATION_FINAL_IO", vector{"SIMULATION_IO"}, new Timer()); + global_simulation->timers()->registerTimer("SIMULATION_FINAL_IO", std::vector{"SIMULATION_IO"}, new Timer()); global_simulation->timers()->setOutputString("SIMULATION_FINAL_IO", "Final IO took:"); global_simulation->timers()->getTimer("SIMULATION_FINAL_IO")->start(); if( _finalCheckpoint ) { /* write final checkpoint */ - string cpfile(_outputPrefix + ".restart.dat"); - global_log->info() << "Writing final checkpoint to file '" << cpfile << "'" << endl; + std::string cpfile(_outputPrefix + ".restart.dat"); + global_log->info() << "Writing final checkpoint to file '" << cpfile << "'" << std::endl; _domain->writeCheckpoint(cpfile, _moleculeContainer, _domainDecomposition, _simulationTime, false); } - global_log->info() << "Finish plugins" << endl; + global_log->info() << "Finish plugins" << std::endl; for (auto plugin : _plugins) { plugin->finish(_moleculeContainer, _domainDecomposition, _domain); } global_simulation->timers()->getTimer("SIMULATION_FINAL_IO")->stop(); - global_log->info() << "Timing information:" << endl; + global_log->info() << "Timing information:" << std::endl; global_simulation->timers()->printTimers(); global_simulation->timers()->resetTimers(); if(getMemoryProfiler()) { getMemoryProfiler()->doOutput(); } - global_log->info() << endl; + global_log->info() << std::endl; #ifdef WITH_PAPI - global_log->info() << "PAPI counter values for loop timer:" << endl; + global_log->info() << "PAPI counter values for loop timer:" << std::endl; for(int i = 0; i < loopTimer->get_papi_num_counters(); i++) { - global_log->info() << " " << papi_event_list[i] << ": " << loopTimer->get_global_papi_counter(i) << endl; + global_log->info() << " " << papi_event_list[i] << ": " << loopTimer->get_global_papi_counter(i) << std::endl; } #endif /* WITH_PAPI */ } @@ -1241,7 +1239,7 @@ void Simulation::pluginEndStepCall(unsigned long simstep) { std::list::iterator pluginIter; for (pluginIter = _plugins.begin(); pluginIter != _plugins.end(); pluginIter++) { PluginBase* plugin = (*pluginIter); - global_log->debug() << "Plugin end of step: " << plugin->getPluginName() << endl; + global_log->debug() << "Plugin end of step: " << plugin->getPluginName() << std::endl; global_simulation->timers()->start(plugin->getPluginName()); plugin->endStep(_moleculeContainer, _domainDecomposition, _domain, simstep); global_simulation->timers()->stop(plugin->getPluginName()); @@ -1249,14 +1247,13 @@ void Simulation::pluginEndStepCall(unsigned long simstep) { if (_domain->thermostatWarning()) - global_log->warning() << "Thermostat!" << endl; + global_log->warning() << "Thermostat!" << std::endl; /* TODO: thermostat */ global_log->info() << "Simstep = " << simstep << "\tT = " << _domain->getGlobalCurrentTemperature() << "\tU_pot = " << _domain->getGlobalUpot() << "\tp = " - << _domain->getGlobalPressure() << endl; - using std::isnan; - if (isnan(_domain->getGlobalCurrentTemperature()) || isnan(_domain->getGlobalUpot()) || isnan(_domain->getGlobalPressure())) { + << _domain->getGlobalPressure() << std::endl; + if (std::isnan(_domain->getGlobalCurrentTemperature()) || std::isnan(_domain->getGlobalUpot()) || std::isnan(_domain->getGlobalPressure())) { global_log->error() << "NaN detected, exiting." << std::endl; Simulation::exit(1); } @@ -1375,21 +1372,21 @@ void Simulation::initialize() { delete _domainDecomposition; #ifndef ENABLE_MPI - global_log->info() << "Creating alibi domain decomposition ... " << endl; + global_log->info() << "Creating alibi domain decomposition ... " << std::endl; _domainDecomposition = new DomainDecompBase(); #else - global_log->info() << "Creating standard domain decomposition ... " << endl; + global_log->info() << "Creating standard domain decomposition ... " << std::endl; _domainDecomposition = (DomainDecompBase*) new DomainDecomposition(); #endif _outputPrefix.append(gettimestring()); - global_log->info() << "Creating domain ..." << endl; + global_log->info() << "Creating domain ..." << std::endl; _domain = new Domain(ownrank); - global_log->info() << "Creating ParticlePairs2PotForceAdapter ..." << endl; + global_log->info() << "Creating ParticlePairs2PotForceAdapter ..." << std::endl; _particlePairsHandler = new ParticlePairs2PotForceAdapter(*_domain); - global_log->info() << "Initialization done" << endl; + global_log->info() << "Initialization done" << std::endl; } bool Simulation::keepRunning() { diff --git a/src/Simulation.h b/src/Simulation.h index a81ea891c6..86fb8bf67c 100644 --- a/src/Simulation.h +++ b/src/Simulation.h @@ -4,12 +4,14 @@ #include #include -#include "ensemble/CavityEnsemble.h" #include "io/TimerProfiler.h" #include "thermostats/VelocityScalingThermostat.h" #include "utils/FixedSizeQueue.h" #include "utils/FunctionWrapper.h" #include "utils/SysMon.h" +#include "utils/Random.h" + +using Log::global_log; // plugins #include "plugins/PluginFactory.h" diff --git a/src/bhfmm/FastMultipoleMethod.cpp b/src/bhfmm/FastMultipoleMethod.cpp index 863efd505a..c90aedcf51 100644 --- a/src/bhfmm/FastMultipoleMethod.cpp +++ b/src/bhfmm/FastMultipoleMethod.cpp @@ -14,9 +14,6 @@ #include "bhfmm/containers/AdaptivePseudoParticleContainer.h" #include "utils/xmlfileUnits.h" -using Log::global_log; -using std::endl; - namespace bhfmm { FastMultipoleMethod::~FastMultipoleMethod() { @@ -33,24 +30,24 @@ FastMultipoleMethod::~FastMultipoleMethod() { void FastMultipoleMethod::readXML(XMLfileUnits& xmlconfig) { xmlconfig.getNodeValue("orderOfExpansions", _order); - global_log->info() << "FastMultipoleMethod: orderOfExpansions: " << _order << endl; + global_log->info() << "FastMultipoleMethod: orderOfExpansions: " << _order << std::endl; xmlconfig.getNodeValue("LJCellSubdivisionFactor", _LJCellSubdivisionFactor); - global_log->info() << "FastMultipoleMethod: LJCellSubdivisionFactor: " << _LJCellSubdivisionFactor << endl; + global_log->info() << "FastMultipoleMethod: LJCellSubdivisionFactor: " << _LJCellSubdivisionFactor << std::endl; xmlconfig.getNodeValue("adaptiveContainer", _adaptive); if (_adaptive == 1) { - global_log->warning() << "FastMultipoleMethod: adaptiveContainer is not debugged yet and certainly delivers WRONG results!" << endl; - global_log->warning() << "Unless you are in the process of debugging this container, please stop the simulation and restart with the uniform one" << endl; + global_log->warning() << "FastMultipoleMethod: adaptiveContainer is not debugged yet and certainly delivers WRONG results!" << std::endl; + global_log->warning() << "Unless you are in the process of debugging this container, please stop the simulation and restart with the uniform one" << std::endl; } else { - global_log->info() << "FastMultipoleMethod: UniformPseudoParticleSelected " << endl; + global_log->info() << "FastMultipoleMethod: UniformPseudoParticleSelected " << std::endl; } xmlconfig.getNodeValue("systemIsPeriodic", _periodic); if (_periodic == 0) { - global_log->warning() << "FastMultipoleMethod: periodicity is turned off!" << endl; + global_log->warning() << "FastMultipoleMethod: periodicity is turned off!" << std::endl; } else { - global_log->info() << "FastMultipoleMethod: Periodicity is on." << endl; + global_log->info() << "FastMultipoleMethod: Periodicity is on." << std::endl; } } @@ -70,14 +67,14 @@ void FastMultipoleMethod::init(double globalDomainLength[3], double bBoxMin[3], and _LJCellSubdivisionFactor != 4 and _LJCellSubdivisionFactor != 8) { global_log->error() << "Fast Multipole Method: bad subdivision factor:" - << _LJCellSubdivisionFactor << endl; - global_log->error() << "expected 1,2,4 or 8" << endl; + << _LJCellSubdivisionFactor << std::endl; + global_log->error() << "expected 1,2,4 or 8" << std::endl; Simulation::exit(5); } global_log->info() << "Fast Multipole Method: each LJ cell will be subdivided in " << pow(_LJCellSubdivisionFactor, 3) - << " cells for electrostatic calculations in FMM" << endl; + << " cells for electrostatic calculations in FMM" << std::endl; _P2PProcessor = new VectorizedChargeP2PCellProcessor( *(global_simulation->getDomain())); @@ -102,14 +99,14 @@ void FastMultipoleMethod::init(double globalDomainLength[3], double bBoxMin[3], #ifdef QUICKSCHED global_simulation->getTaskTimingProfiler()->init(_scheduler->count); #else - global_log->warning() << "Profiling tasks without Quicksched not implemented!" << endl; + global_log->warning() << "Profiling tasks without Quicksched not implemented!" << std::endl; #endif #endif } else { // TODO: Debugging in Progress! #if defined(ENABLE_MPI) - global_log->error() << "MPI in combination with adaptive is not supported yet" << endl; + global_log->error() << "MPI in combination with adaptive is not supported yet" << std::endl; Simulation::exit(-1); #endif //int threshold = 100; diff --git a/src/bhfmm/cellProcessors/L2PCellProcessor.cpp b/src/bhfmm/cellProcessors/L2PCellProcessor.cpp index 3b10746be8..59012336e5 100644 --- a/src/bhfmm/cellProcessors/L2PCellProcessor.cpp +++ b/src/bhfmm/cellProcessors/L2PCellProcessor.cpp @@ -30,11 +30,11 @@ void L2PCellProcessor::initTraversal() { // using std::cout; // using std::endl; // Domain* domain = global_simulation->getDomain(); -// cout << "L2P init: LocalUpot " << domain->getLocalUpot() << endl; -// cout << "L2P init: LocalVirial " << domain->getLocalVirial() << endl; -// cout << "L2P init: LocalP_xx " << domain->getLocalP_xx() << endl; -// cout << "L2P init: LocalP_yy " << domain->getLocalP_yy() << endl; -// cout << "L2P init: LocalP_zz " << domain->getLocalP_zz() << endl; +// std::cout << "L2P init: LocalUpot " << domain->getLocalUpot() << std::endl; +// std::cout << "L2P init: LocalVirial " << domain->getLocalVirial() << std::endl; +// std::cout << "L2P init: LocalP_xx " << domain->getLocalP_xx() << std::endl; +// std::cout << "L2P init: LocalP_yy " << domain->getLocalP_yy() << std::endl; +// std::cout << "L2P init: LocalP_zz " << domain->getLocalP_zz() << std::endl; global_simulation->timers()->start("L2P_CELL_PROCESSOR_L2P"); } diff --git a/src/bhfmm/cellProcessors/VectorizedChargeP2PCellProcessor.cpp b/src/bhfmm/cellProcessors/VectorizedChargeP2PCellProcessor.cpp index 0e04f12e50..cf73e870d2 100644 --- a/src/bhfmm/cellProcessors/VectorizedChargeP2PCellProcessor.cpp +++ b/src/bhfmm/cellProcessors/VectorizedChargeP2PCellProcessor.cpp @@ -13,8 +13,6 @@ #include "particleContainer/adapter/vectorization/MaskGatherChooser.h" #include "VectorizedChargeP2PCellProcessor.h" -using namespace Log; -using namespace std; namespace bhfmm { VectorizedChargeP2PCellProcessor::VectorizedChargeP2PCellProcessor(Domain & domain, double cutoffRadius, double LJcutoffRadius) : @@ -227,9 +225,9 @@ void VectorizedChargeP2PCellProcessor::postprocessCell(ParticleCellPointers & c) f[0] = static_cast(soa_charges_f_x[iCharges]); f[1] = static_cast(soa_charges_f_y[iCharges]); f[2] = static_cast(soa_charges_f_z[iCharges]); - mardyn_assert(!isnan(f[0])); - mardyn_assert(!isnan(f[1])); - mardyn_assert(!isnan(f[2])); + mardyn_assert(!std::isnan(f[0])); + mardyn_assert(!std::isnan(f[1])); + mardyn_assert(!std::isnan(f[2])); m.Fchargeadd(j, f); // Store the resulting virial in the molecule. @@ -237,9 +235,9 @@ void VectorizedChargeP2PCellProcessor::postprocessCell(ParticleCellPointers & c) V[0] = static_cast(soa_charges_V_x[iCharges]*0.5); V[1] = static_cast(soa_charges_V_y[iCharges]*0.5); V[2] = static_cast(soa_charges_V_z[iCharges]*0.5); - mardyn_assert(!isnan(V[0])); - mardyn_assert(!isnan(V[1])); - mardyn_assert(!isnan(V[2])); + mardyn_assert(!std::isnan(V[0])); + mardyn_assert(!std::isnan(V[1])); + mardyn_assert(!std::isnan(V[2])); m.Viadd(V); } } diff --git a/src/bhfmm/cellProcessors/VectorizedLJP2PCellProcessor.cpp b/src/bhfmm/cellProcessors/VectorizedLJP2PCellProcessor.cpp index 8804481f5e..223507dafe 100644 --- a/src/bhfmm/cellProcessors/VectorizedLJP2PCellProcessor.cpp +++ b/src/bhfmm/cellProcessors/VectorizedLJP2PCellProcessor.cpp @@ -15,8 +15,6 @@ #include #include "particleContainer/adapter/vectorization/MaskGatherChooser.h" -using namespace Log; -using namespace std; namespace bhfmm { VectorizedLJP2PCellProcessor::VectorizedLJP2PCellProcessor(Domain & domain, double cutoffRadius, double LJcutoffRadius) : CellProcessor(cutoffRadius, LJcutoffRadius), _domain(domain), diff --git a/src/bhfmm/containers/DttNode.cpp b/src/bhfmm/containers/DttNode.cpp index 5ad9005601..797a32b873 100644 --- a/src/bhfmm/containers/DttNode.cpp +++ b/src/bhfmm/containers/DttNode.cpp @@ -265,14 +265,14 @@ int DttNode::getMaxDepth() const { if (_isLeafNode) { return 0; } else { - int max = 0; + int maxVal = 0; for (unsigned int i = 0; i < 8; i++) { if (_children[i]->isOccupied()) { - max = std::max(max, _children[i]->getMaxDepth()); + maxVal = std::max(maxVal, _children[i]->getMaxDepth()); } } - return max + 1; + return maxVal + 1; } } diff --git a/src/bhfmm/containers/LeafNodesContainer.cpp b/src/bhfmm/containers/LeafNodesContainer.cpp index 08c2a3dc78..129843b890 100644 --- a/src/bhfmm/containers/LeafNodesContainer.cpp +++ b/src/bhfmm/containers/LeafNodesContainer.cpp @@ -15,9 +15,6 @@ #include #include -using namespace std; -using Log::global_log; - namespace bhfmm { LeafNodesContainer::LeafNodesContainer(double bBoxMin[3], @@ -143,7 +140,7 @@ void LeafNodesContainer::initializeCells() { } void LeafNodesContainer::calculateNeighbourIndices() { - global_log->debug() << "Setting up cell neighbour index lists." << endl; + global_log->debug() << "Setting up cell neighbour index lists." << std::endl; _forwardNeighbourOffsets.clear(); _backwardNeighbourOffsets.clear(); _maxNeighbourOffset = 0; @@ -169,7 +166,7 @@ void LeafNodesContainer::calculateNeighbourIndices() { } global_log->info() << "Neighbour offsets are bounded by " - << _minNeighbourOffset << ", " << _maxNeighbourOffset << endl; + << _minNeighbourOffset << ", " << _maxNeighbourOffset << std::endl; } long int LeafNodesContainer::cellIndexOf3DIndex(int xIndex, int yIndex, int zIndex) const { @@ -227,8 +224,8 @@ void LeafNodesContainer::traverseCells(SimpleCellProcessor& cellProcessor){ void LeafNodesContainer::traverseCellPairs(VectorizedChargeP2PCellProcessor& cellProcessor) { #ifndef NDEBUG - global_log->debug() << "LeafNodesContainer::traverseCells: Processing pairs." << endl; - global_log->debug() << "_minNeighbourOffset=" << _minNeighbourOffset << "; _maxNeighbourOffset=" << _maxNeighbourOffset<< endl; + global_log->debug() << "LeafNodesContainer::traverseCells: Processing pairs." << std::endl; + global_log->debug() << "_minNeighbourOffset=" << _minNeighbourOffset << "; _maxNeighbourOffset=" << _maxNeighbourOffset<< std::endl; #endif #if defined(_OPENMP) @@ -238,7 +235,7 @@ void LeafNodesContainer::traverseCellPairs(VectorizedChargeP2PCellProcessor& cel #endif } -void LeafNodesContainer::traverseCellPairsOrig(VectorizedChargeP2PCellProcessor& cellProcessor) { vector::iterator neighbourOffsetsIter; +void LeafNodesContainer::traverseCellPairsOrig(VectorizedChargeP2PCellProcessor& cellProcessor) { std::vector::iterator neighbourOffsetsIter; cellProcessor.initTraversal(); // preprocess all cells @@ -341,7 +338,7 @@ void LeafNodesContainer::traverseCellPairsC08(VectorizedChargeP2PCellProcessor& void LeafNodesContainer::c08Step(long int baseIndex, VectorizedChargeP2PCellProcessor &cellProcessor) { const int num_pairs = _cellPairOffsets.size(); for(int j = 0; j < num_pairs; ++j) { - pair current_pair = _cellPairOffsets[j]; + std::pair current_pair = _cellPairOffsets[j]; long int offset1 = current_pair.first; long int cellIndex1 = baseIndex + offset1; @@ -392,33 +389,33 @@ void LeafNodesContainer::calculateCellPairOffsets() { // minimize number of cells simultaneously in memory: - _cellPairOffsets.push_back(make_pair(o, xyz)); + _cellPairOffsets.push_back(std::make_pair(o, xyz)); // evict xyz - _cellPairOffsets.push_back(make_pair(o, yz )); - _cellPairOffsets.push_back(make_pair(x, yz )); + _cellPairOffsets.push_back(std::make_pair(o, yz )); + _cellPairOffsets.push_back(std::make_pair(x, yz )); // evict yz - _cellPairOffsets.push_back(make_pair(o, x )); + _cellPairOffsets.push_back(std::make_pair(o, x )); - _cellPairOffsets.push_back(make_pair(o, xy )); - _cellPairOffsets.push_back(make_pair(xy, z )); + _cellPairOffsets.push_back(std::make_pair(o, xy )); + _cellPairOffsets.push_back(std::make_pair(xy, z )); // evict xy - _cellPairOffsets.push_back(make_pair(o, z )); - _cellPairOffsets.push_back(make_pair(x, z )); - _cellPairOffsets.push_back(make_pair(y, z )); + _cellPairOffsets.push_back(std::make_pair(o, z )); + _cellPairOffsets.push_back(std::make_pair(x, z )); + _cellPairOffsets.push_back(std::make_pair(y, z )); // evict z - _cellPairOffsets.push_back(make_pair(o, y )); - _cellPairOffsets.push_back(make_pair(x, y )); + _cellPairOffsets.push_back(std::make_pair(o, y )); + _cellPairOffsets.push_back(std::make_pair(x, y )); // evict x - _cellPairOffsets.push_back(make_pair(o, xz )); - _cellPairOffsets.push_back(make_pair(y, xz )); + _cellPairOffsets.push_back(std::make_pair(o, xz )); + _cellPairOffsets.push_back(std::make_pair(y, xz )); // evict xz - _cellPairOffsets.push_back(make_pair(o, o )); + _cellPairOffsets.push_back(std::make_pair(o, o )); } void LeafNodesContainer::threeDIndexOfCellIndex(int ind, int r[3], int dim[3]) const { @@ -431,7 +428,7 @@ void LeafNodesContainer::threeDIndexOfCellIndex(int ind, int r[3], int dim[3]) c return _numCellsPerDimension; } - vector & LeafNodesContainer::getCells() { + std::vector & LeafNodesContainer::getCells() { return _cells; } diff --git a/src/bhfmm/containers/ParticleCellPointers.cpp b/src/bhfmm/containers/ParticleCellPointers.cpp index cf5ad2750d..5889b7b8bd 100644 --- a/src/bhfmm/containers/ParticleCellPointers.cpp +++ b/src/bhfmm/containers/ParticleCellPointers.cpp @@ -12,8 +12,6 @@ #include "utils/mardyn_assert.h" #include -using namespace std; - namespace bhfmm { ParticleCellPointers::ParticleCellPointers() : diff --git a/src/bhfmm/containers/UniformPseudoParticleContainer.cpp b/src/bhfmm/containers/UniformPseudoParticleContainer.cpp index 9e65985ae5..1149e4803b 100644 --- a/src/bhfmm/containers/UniformPseudoParticleContainer.cpp +++ b/src/bhfmm/containers/UniformPseudoParticleContainer.cpp @@ -110,7 +110,7 @@ UniformPseudoParticleContainer::UniformPseudoParticleContainer( _comm = domainDecomp.getCommunicator(); #endif #if WIGNER == 1 - //global_log->error() << "not supported yet" << endl; + //global_log->error() << "not supported yet" << std::endl; Simulation::exit(-1); #endif #ifdef ENABLE_MPI @@ -2635,19 +2635,19 @@ void UniformPseudoParticleContainer::M2LCompleteCell(int targetId, int level, in cellSize); // cout << "Level: " << level -// << " | Target: " << setw(5) << targetId -// << " (" << setw(2) << targetCoords[0] -// << ", " << setw(2) << targetCoords[1] -// << ", " << setw(2) << targetCoords[2] -// << ") | Source: " << setw(5) << sourceId -// << " (" << setw(2) << sourceCoords[0] -// << ", " << setw(2) << sourceCoords[1] -// << ", " << setw(2) << sourceCoords[2] +// << " | Target: " << std::setw(5) << targetId +// << " (" << std::setw(2) << targetCoords[0] +// << ", " << std::setw(2) << targetCoords[1] +// << ", " << std::setw(2) << targetCoords[2] +// << ") | Source: " << std::setw(5) << sourceId +// << " (" << std::setw(2) << sourceCoords[0] +// << ", " << std::setw(2) << sourceCoords[1] +// << ", " << std::setw(2) << sourceCoords[2] // << ") | tf: " -// << "(" << setw(2) << sourceRootCoords[0] + x - targetCoords[0] -// << ", " << setw(2) << sourceRootCoords[1] + y - targetCoords[1] -// << ", " << setw(2) << sourceRootCoords[2] + z - targetCoords[2] -// << ")" << endl; +// << "(" << std::setw(2) << sourceRootCoords[0] + x - targetCoords[0] +// << ", " << std::setw(2) << sourceRootCoords[1] + y - targetCoords[1] +// << ", " << std::setw(2) << sourceRootCoords[2] + z - targetCoords[2] +// << ")" << std::endl; // calculate single M2L if(FFTSettings::USE_ORDER_REDUCTION){ @@ -4406,7 +4406,7 @@ void UniformPseudoParticleContainer::printTimers() { #endif } -vector> &UniformPseudoParticleContainer::getMpCellGlobalTop() { +std::vector> &UniformPseudoParticleContainer::getMpCellGlobalTop() { return _mpCellGlobalTop; } diff --git a/src/bhfmm/containers/UniformPseudoParticleContainer_old_Wigner_cpp.txt b/src/bhfmm/containers/UniformPseudoParticleContainer_old_Wigner_cpp.txt index 4b090adbd2..b4ec6dc762 100644 --- a/src/bhfmm/containers/UniformPseudoParticleContainer_old_Wigner_cpp.txt +++ b/src/bhfmm/containers/UniformPseudoParticleContainer_old_Wigner_cpp.txt @@ -44,7 +44,7 @@ UniformPseudoParticleContainer::UniformPseudoParticleContainer( _comm = domainDecomp.getCommunicator(); #endif #if WIGNER == 1 - //global_log->error() << "not supported yet" << endl; + //global_log->error() << "not supported yet" << std::endl; Simulation::exit(-1); #endif #ifdef ENABLE_MPI diff --git a/src/bhfmm/expansions/SolidHarmonicsExpansion.cpp b/src/bhfmm/expansions/SolidHarmonicsExpansion.cpp index 2cc6025851..02071626a2 100644 --- a/src/bhfmm/expansions/SolidHarmonicsExpansion.cpp +++ b/src/bhfmm/expansions/SolidHarmonicsExpansion.cpp @@ -9,8 +9,6 @@ #include #include -using namespace std; - namespace bhfmm { // CONSTRUCTORS // @@ -410,16 +408,16 @@ void SolidHarmonicsExpansion::rotatePhi(const double* CosSinPhi, int negate) { const double val_M_c = acc_C(l, m); const double val_M_s = acc_S(l, m); - mardyn_assert(!isnan(val_M_c)); - mardyn_assert(!isnan(val_M_s)); - mardyn_assert(!isnan(this->acc_C(l, m))); - mardyn_assert(!isnan(this->acc_S(l, m))); + mardyn_assert(!std::isnan(val_M_c)); + mardyn_assert(!std::isnan(val_M_s)); + mardyn_assert(!std::isnan(this->acc_C(l, m))); + mardyn_assert(!std::isnan(this->acc_S(l, m))); acc_C(l, m) = (CosSinPhi[2*m]*val_M_c + negate*CosSinPhi[2*m+1]*val_M_s); acc_S(l, m) = (CosSinPhi[2*m]*val_M_s - negate*CosSinPhi[2*m+1]*val_M_c); - mardyn_assert(!isnan(this->acc_C(l, m))); - mardyn_assert(!isnan(this->acc_S(l, m))); + mardyn_assert(!std::isnan(this->acc_C(l, m))); + mardyn_assert(!std::isnan(this->acc_S(l, m))); } } } @@ -641,22 +639,21 @@ Vector3 forceLAndGradM(const SolidHarmonicsExpansion & LE, const SolidHa void SolidHarmonicsExpansion::print() const { - using namespace std; - int precisionSetting = cout.precision( ); - ios::fmtflags flagSettings = cout.flags(); + int precisionSetting = std::cout.precision( ); + std::ios::fmtflags flagSettings = std::cout.flags(); - cout.setf(ios::dec | ios::showpos | ios::showpoint); - cout.precision(5); + std::cout.setf(std::ios::dec | std::ios::showpos | std::ios::showpoint); + std::cout.precision(5); for (int l = 0; l <= _order; ++l) { for (int m = 0; m <= l; ++m) { - std::cout << "(" < FFTSettings::getAvailableOptions() { - vector options; +std::vector FFTSettings::getAvailableOptions() { + std::vector options; options.push_back("off: disable fft acceleration"); options.push_back("fft: use opt. fft acceleration"); options.push_back("fftw: use FFTW acceleration"); diff --git a/src/bhfmm/fft/FFTSettings.h b/src/bhfmm/fft/FFTSettings.h index 123babedae..169413a931 100644 --- a/src/bhfmm/fft/FFTSettings.h +++ b/src/bhfmm/fft/FFTSettings.h @@ -12,8 +12,6 @@ #include #include "bhfmm/fft/FFTSettings_preprocessor.h" -using namespace std; - /** * Static class containing all the FFT Acceleration's settings * @@ -53,8 +51,8 @@ class FFTSettings { } //Used in the bhfmm code for command line interface - static void setOptions(string option); - static vector getAvailableOptions(); + static void setOptions(std::string option); + static std::vector getAvailableOptions(); static void printCurrentOptions(); }; diff --git a/src/bhfmm/fft/tools/optimizedFFT/FakedOptFFT.h b/src/bhfmm/fft/tools/optimizedFFT/FakedOptFFT.h index 2ac9f02370..92513dfa53 100644 --- a/src/bhfmm/fft/tools/optimizedFFT/FakedOptFFT.h +++ b/src/bhfmm/fft/tools/optimizedFFT/FakedOptFFT.h @@ -17,8 +17,6 @@ #include #include -using namespace std; - //struct storing a int[2] for the map struct pos { int x, y; @@ -60,7 +58,7 @@ class FakedOptFFT: public optFFT_API { const int size_x, const int size_y); private: - map _fftw_api_map; //storage of the various FFTW_API required + std::map _fftw_api_map; //storage of the various FFTW_API required FFTW_API* getFFTW_API(const int size_x, const int size_y); //memoized function using the map }; diff --git a/src/bhfmm/utils/WignerMatrix.cpp b/src/bhfmm/utils/WignerMatrix.cpp index a029ca5c13..34cc3ca98b 100644 --- a/src/bhfmm/utils/WignerMatrix.cpp +++ b/src/bhfmm/utils/WignerMatrix.cpp @@ -148,24 +148,23 @@ void WignerMatrix::apply_minus_one_pow() { void WignerMatrix::print(int maxl) { - using namespace std; - int precisionSetting = cout.precision( ); - ios::fmtflags flagSettings = cout.flags(); + int precisionSetting = std::cout.precision( ); + std::ios::fmtflags flagSettings = std::cout.flags(); - cout.setf(ios::fixed | ios::showpos | ios::showpoint); - cout.precision(5); + std::cout.setf(std::ios::fixed | std::ios::showpos | std::ios::showpoint); + std::cout.precision(5); for(int l = 0; l <= maxl; ++l) { for(int m = 0; m <= l; ++m) { for (int k = -l; k <= l; ++k) { - cout << left << setw(10) << this->acc_c(l,m,k); + std::cout << std::left << std::setw(10) << this->acc_c(l,m,k); } - cout << endl; + std::cout << std::endl; } - cout << endl; + std::cout << std::endl; } - cout.precision(precisionSetting); - cout.flags(flagSettings); + std::cout.precision(precisionSetting); + std::cout.flags(flagSettings); } void WignerMatrix::initializeSqrtLookUp() { diff --git a/src/ensemble/BoxDomain.cpp b/src/ensemble/BoxDomain.cpp index ad3174233a..a201b4d7f1 100644 --- a/src/ensemble/BoxDomain.cpp +++ b/src/ensemble/BoxDomain.cpp @@ -3,7 +3,6 @@ #include "utils/Logger.h" #include "utils/xmlfileUnits.h" -using namespace std; using Log::global_log; BoxDomain::BoxDomain() { @@ -15,8 +14,8 @@ void BoxDomain::readXML(XMLfileUnits& xmlconfig) { xmlconfig.getNodeValueReduced("lx",_rmax[0]); xmlconfig.getNodeValueReduced("ly",_rmax[1]); xmlconfig.getNodeValueReduced("lz",_rmax[2]); - global_log->info() << "Box lower corner (x,y,z): " << _rmin[0] << "," << _rmin[1] << "," << _rmin[2] << endl; - global_log->info() << "Box upper corner (x,y,z): " << _rmax[0] << "," << _rmax[1] << "," << _rmax[2] << endl; + global_log->info() << "Box lower corner (x,y,z): " << _rmin[0] << "," << _rmin[1] << "," << _rmin[2] << std::endl; + global_log->info() << "Box upper corner (x,y,z): " << _rmax[0] << "," << _rmax[1] << "," << _rmax[2] << std::endl; } double BoxDomain::V() { diff --git a/src/ensemble/CanonicalEnsemble.cpp b/src/ensemble/CanonicalEnsemble.cpp index 80c67255fa..1f994edbc5 100644 --- a/src/ensemble/CanonicalEnsemble.cpp +++ b/src/ensemble/CanonicalEnsemble.cpp @@ -19,9 +19,6 @@ #include "utils/xmlfileUnits.h" -using namespace std; -using Log::global_log; - CanonicalEnsemble::CanonicalEnsemble() : _N(0), _V(0), _T(0), _mu(0), _p(0), _E(0), _E_trans(0), _E_rot(0) { _type = NVT; @@ -36,7 +33,7 @@ void CanonicalEnsemble::updateGlobalVariable(ParticleContainer* particleContaine /* "fixed" variables of this ensemble */ if((variable & NUM_PARTICLES) | (variable & TEMPERATURE)) { - global_log->debug() << "Updating particle counts" << endl; + global_log->debug() << "Updating particle counts" << std::endl; /* initializes the number of molecules present in each component! */ std::vector numMolecules(numComponents, 0ul); @@ -72,7 +69,7 @@ void CanonicalEnsemble::updateGlobalVariable(ParticleContainer* particleContaine #ifdef ENABLE_MPI numMolecules[cid] = _simulation.domainDecomposition().collCommGetUnsLong(); #endif - global_log->debug() << "Number of molecules in component " << cid << ": " << numMolecules[cid] << endl; + global_log->debug() << "Number of molecules in component " << cid << ": " << numMolecules[cid] << std::endl; _N += numMolecules[cid]; _components[cid].setNumMolecules(numMolecules[cid]); } @@ -82,22 +79,22 @@ void CanonicalEnsemble::updateGlobalVariable(ParticleContainer* particleContaine } if(variable & VOLUME) { - global_log->debug() << "Updating volume" << endl; + global_log->debug() << "Updating volume" << std::endl; /* TODO: calculate actual volume or return specified volume as * the canonical ensemble should have a fixed volume? */ } /* variable variables of this ensemble */ if(variable & CHEMICAL_POTENTIAL) { - global_log->debug() << "Updating chemical potential" << endl; + global_log->debug() << "Updating chemical potential" << std::endl; } if(variable & PRESSURE) { - global_log->info() << "Updating pressure" << endl; + global_log->info() << "Updating pressure" << std::endl; } if((variable & ENERGY) | (variable & TEMPERATURE)) { - global_log->debug() << "Updating energy" << endl; + global_log->debug() << "Updating energy" << std::endl; std::vector E_trans(numComponents, 0.); std::vector E_rot(numComponents, 0.); @@ -143,7 +140,7 @@ void CanonicalEnsemble::updateGlobalVariable(ParticleContainer* particleContaine E_rot[cid] = _simulation.domainDecomposition().collCommGetDouble(); #endif global_log->debug() << "Kinetic energy in component " << cid << ": " << - "E_trans = " << E_trans[cid] << ", E_rot = " << E_rot[cid] << endl; + "E_trans = " << E_trans[cid] << ", E_rot = " << E_rot[cid] << std::endl; _components[cid].setE_trans(E_trans[cid]); _components[cid].setE_rot(E_rot[cid]); _E_trans += E_trans[cid]; @@ -154,12 +151,12 @@ void CanonicalEnsemble::updateGlobalVariable(ParticleContainer* particleContaine #endif global_log->debug() << "Total Kinetic energy: 2*E_trans = " << _E_trans - << ", 2*E_rot = " << _E_rot << endl; + << ", 2*E_rot = " << _E_rot << std::endl; _E = _E_trans + _E_rot; } if(variable & TEMPERATURE) { - global_log->debug() << "Updating temperature" << endl; + global_log->debug() << "Updating temperature" << std::endl; /* TODO: calculate actual temperature or return specified temperature as * the canonical ensemble should have a fixed temperature? */ long long totalDegreesOfFreedom = 0; @@ -172,7 +169,7 @@ void CanonicalEnsemble::updateGlobalVariable(ParticleContainer* particleContaine double E_kin = _components[cid].E(); double T = E_kin / degreesOfFreedom; global_log->debug() << "Temperature of component " << cid << ": " << - "T = " << T << endl; + "T = " << T << std::endl; _components[cid].setT(T); } _T = _E / totalDegreesOfFreedom; @@ -190,22 +187,22 @@ void CanonicalEnsemble::readXML(XMLfileUnits& xmlconfig) { Ensemble::readXML(xmlconfig); xmlconfig.getNodeValueReduced("temperature", _T); - global_log->info() << "Temperature: " << _T << endl; - string domaintype; + global_log->info() << "Temperature: " << _T << std::endl; + std::string domaintype; xmlconfig.getNodeValue("domain@type", domaintype); - global_log->info() << "Domain type: " << domaintype << endl; + global_log->info() << "Domain type: " << domaintype << std::endl; if("box" == domaintype) { _domain = new BoxDomain(); } else { - global_log->error() << "Volume type not supported." << endl; + global_log->error() << "Volume type not supported." << std::endl; Simulation::exit(1); } xmlconfig.changecurrentnode("domain"); _domain->readXML(xmlconfig); xmlconfig.changecurrentnode(".."); _V = _domain->V(); - global_log->info() << "Volume: " << _V << endl; - global_log->warning() << "Box dimensions not set yet in domain class" << endl; + global_log->info() << "Volume: " << _V << std::endl; + global_log->warning() << "Box dimensions not set yet in domain class" << std::endl; } void CanonicalEnsemble::beforeThermostat(unsigned long simstep, unsigned long initStatistics) { diff --git a/src/ensemble/CavityEnsemble.cpp b/src/ensemble/CavityEnsemble.cpp index 5311123d84..20735980e6 100644 --- a/src/ensemble/CavityEnsemble.cpp +++ b/src/ensemble/CavityEnsemble.cpp @@ -9,8 +9,6 @@ #define COMMUNICATION_THRESHOLD 3 -using Log::global_log; - CavityEnsemble::CavityEnsemble() { this->ownrank = -1; this->initialized = false; @@ -37,8 +35,8 @@ CavityEnsemble::CavityEnsemble() { control_top[1] = 1.0; control_top[2] = 1.0; - this->active = set(); - this->reservoir = map(); + this->active = std::set(); + this->reservoir = std::map(); this->globalActive = 0; this->boundarySpecified = false; @@ -232,7 +230,7 @@ void CavityEnsemble::preprocessStep() { if (this->rotated) return; if (this->reservoir.size() == 0) return; - map::iterator resit = this->reservoir.begin(); + std::map::iterator resit = this->reservoir.begin(); double qtr[4]; Component *tc = resit->second->component(); @@ -268,9 +266,9 @@ bool CavityEnsemble::decideActivity(double /*uPotTilde*/, unsigned long tmid) { return false; } -map CavityEnsemble::activeParticleContainer() { - map retv; - set::iterator resit; +std::map CavityEnsemble::activeParticleContainer() { + std::map retv; + std::set::iterator resit; for (resit = this->active.begin(); resit != active.end(); resit++) { retv[*resit] = this->reservoir[*resit]; } @@ -290,18 +288,18 @@ unsigned CavityEnsemble::countNeighbours(ParticleContainer *container, Molecule lo[d] = std::max(0.0, m1->r(d) - R); hi[d] = std::min(system[d], m1->r(d) + R); } - //global_log->info() << "[CavityWriter] post_lo_hi" << endl; + //global_log->info() << "[CavityWriter] post_lo_hi" << std::endl; - //global_log->info() << "[CavityWriter] post region iterator" << endl; + //global_log->info() << "[CavityWriter] post region iterator" << std::endl; for (auto m2 = container->regionIterator(lo, hi, ParticleIterator::ALL_CELLS); m2.isValid(); ++m2) { if (m2->getID() == m1->getID()) { - //global_log->info() << "[CavityWriter] same ID" << endl; + //global_log->info() << "[CavityWriter] same ID" << std::endl; continue; } double distanceVectorDummy[3] = {0.0, 0.0, 0.0}; double dd = m2->dist2(*m1, distanceVectorDummy); - //global_log->info() << "[CavityWriter] post distance" << endl; + //global_log->info() << "[CavityWriter] post distance" << std::endl; if (dd < RR) { ++m1neigh; } @@ -313,18 +311,18 @@ unsigned CavityEnsemble::countNeighbours(ParticleContainer *container, Molecule void CavityEnsemble::cavityStep(ParticleContainer *globalMoleculeContainer) { // don't confuse with the other ParticleContainer, the base-class of LinkedCells! - map *pc = this->particleContainer(); + std::map *pc = this->particleContainer(); for (auto pcit = pc->begin(); pcit != pc->end(); pcit++) { mardyn_assert(pcit->second != NULL); Molecule *m1 = pcit->second; - //global_log->info() << "[CavityWriter] pre-neighbors" << endl; + //global_log->info() << "[CavityWriter] pre-neighbors" << std::endl; unsigned neigh = this->countNeighbours(globalMoleculeContainer, m1); - //global_log->info() << "[CavityWriter] post-neighbors" << endl; + //global_log->info() << "[CavityWriter] post-neighbors" << std::endl; unsigned long m1id = pcit->first; mardyn_assert(m1id == m1->getID()); this->decideActivity(neigh, m1id); - //global_log->info() << "[CavityWriter] post-activity" << endl; + //global_log->info() << "[CavityWriter] post-activity" << std::endl; } } diff --git a/src/ensemble/CavityEnsemble.h b/src/ensemble/CavityEnsemble.h index 1e080eb48c..ec1d0297a0 100644 --- a/src/ensemble/CavityEnsemble.h +++ b/src/ensemble/CavityEnsemble.h @@ -7,7 +7,6 @@ #include "utils/Random.h" -using namespace std; class DomainDecompBase; @@ -54,9 +53,9 @@ class CavityEnsemble { unsigned long numCavities() { return this->globalActive; } - map *particleContainer() { return &(this->reservoir); } + std::map *particleContainer() { return &(this->reservoir); } - map activeParticleContainer(); + std::map activeParticleContainer(); void determineBoundary(); @@ -88,8 +87,8 @@ class CavityEnsemble { double control_top[3]; unsigned long idoffset; - set active; - map reservoir; + std::set active; + std::map reservoir; unsigned long globalActive; bool boundarySpecified; diff --git a/src/ensemble/ChemicalPotential.cpp b/src/ensemble/ChemicalPotential.cpp index 0b29593492..3ec7c446b5 100644 --- a/src/ensemble/ChemicalPotential.cpp +++ b/src/ensemble/ChemicalPotential.cpp @@ -5,8 +5,6 @@ #include "particleContainer/adapter/ParticlePairs2PotForceAdapter.h" #include "utils/Logger.h" -using namespace std; -using Log::global_log; ChemicalPotential::ChemicalPotential() { @@ -27,11 +25,11 @@ ChemicalPotential::ChemicalPotential() _globalV = 1.0; _restrictedControlVolume = false; - _remainingDeletions = list(); + _remainingDeletions = std::list(); for (int d = 0; d < 3; d++) - _remainingInsertions[d] = list(); - _remainingInsertionIDs = list(); - _remainingDecisions = list(); + _remainingInsertions[d] = std::list(); + _remainingInsertionIDs = std::list(); + _remainingDecisions = std::list(); _reservoir = NULL; _id_increment = 1; _lambda = 1.0; @@ -362,9 +360,9 @@ void ChemicalPotential::submitTemperature(double T_in) #endif if (doOutput >= 0.01) return; - cout << "rank " << _ownrank << " sets mu~ <- " << _muTilde; - cout << ", T <- " << _T << ", lambda <- " << _lambda; - cout << ", and Vred <- " << _globalReducedVolume << "\n"; + std::cout << "rank " << _ownrank << " sets mu~ <- " << _muTilde; + std::cout << ", T <- " << _T << ", lambda <- " << _lambda; + std::cout << ", and Vred <- " << _globalReducedVolume << "\n"; } void ChemicalPotential::assertSynchronization(DomainDecompBase* comm) { @@ -480,13 +478,13 @@ void ChemicalPotential::grandcanonicalStep( accept = this->decideDeletion(DeltaUpot / T); #ifndef NDEBUG if (accept) { - cout << "r" << this->rank() << "d" << m->getID() << " with energy " << DeltaUpot << endl; - cout.flush(); + std::cout << "r" << this->rank() << "d" << m->getID() << " with energy " << DeltaUpot << std::endl; + std::cout.flush(); } /* else cout << " (r" << this->rank() << "-d" << m->getID() - << ")" << endl; + << ")" << std::endl; */ #endif if (accept) { @@ -548,7 +546,7 @@ void ChemicalPotential::grandcanonicalStep( /* cout << "rank " << this->rank() << ": insert " << m->getID() << " at the reduced position (" << ins[0] << "/" - << ins[1] << "/" << ins[2] << ")? " << endl; + << ins[1] << "/" << ins[2] << ")? " << std::endl; */ #endif @@ -561,14 +559,14 @@ void ChemicalPotential::grandcanonicalStep( #ifndef NDEBUG if (accept) { - cout << "r" << this->rank() << "i" << mit->getID() - << " with energy " << DeltaUpot << endl; - cout.flush(); + std::cout << "r" << this->rank() << "i" << mit->getID() + << " with energy " << DeltaUpot << std::endl; + std::cout.flush(); } /* else cout << " (r" << this->rank() << "-i" - << mit->getID() << ")" << endl; + << mit->getID() << ")" << std::endl; */ #endif if (accept) { diff --git a/src/ensemble/EnsembleBase.cpp b/src/ensemble/EnsembleBase.cpp index 9ed13c9cba..81738216ef 100644 --- a/src/ensemble/EnsembleBase.cpp +++ b/src/ensemble/EnsembleBase.cpp @@ -9,8 +9,6 @@ #include -using namespace std; -using Log::global_log; Ensemble::~Ensemble() { delete _domain; @@ -23,21 +21,21 @@ void Ensemble::readXML(XMLfileUnits& xmlconfig) { long numComponents = 0; XMLfile::Query query = xmlconfig.query("components/moleculetype"); numComponents = query.card(); - global_log->info() << "Number of components: " << numComponents << endl; + global_log->info() << "Number of components: " << numComponents << std::endl; if (numComponents == 0) { global_log->fatal() << "No components found. Please verify that you have input them correctly." << std::endl; Simulation::exit(96123); } _components.resize(numComponents); XMLfile::Query::const_iterator componentIter; - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); for(componentIter = query.begin(); componentIter; componentIter++) { xmlconfig.changecurrentnode(componentIter); unsigned int cid = 0; xmlconfig.getNodeValue("@id", cid); _components[cid - 1].readXML(xmlconfig); _componentnamesToIds[_components[cid - 1].getName()] = cid - 1; - global_log->debug() << _components[cid - 1].getName() << " --> " << cid - 1 << endl; + global_log->debug() << _components[cid - 1].getName() << " --> " << cid - 1 << std::endl; } xmlconfig.changecurrentnode(oldpath); @@ -46,7 +44,7 @@ void Ensemble::readXML(XMLfileUnits& xmlconfig) { XMLfile::Query::const_iterator mixingruletIter; uint32_t numMixingrules = 0; numMixingrules = query.card(); - global_log->info() << "Found " << numMixingrules << " mixing rules." << endl; + global_log->info() << "Found " << numMixingrules << " mixing rules." << std::endl; _mixingrules.resize(numMixingrules); // data structure for mixing coefficients of domain class (still in use!!!) @@ -56,15 +54,15 @@ void Ensemble::readXML(XMLfileUnits& xmlconfig) { for(mixingruletIter = query.begin(); mixingruletIter; mixingruletIter++) { xmlconfig.changecurrentnode(mixingruletIter); MixingRuleBase* mixingrule = nullptr; - string mixingruletype; + std::string mixingruletype; xmlconfig.getNodeValue("@type", mixingruletype); - global_log->info() << "Mixing rule type: " << mixingruletype << endl; + global_log->info() << "Mixing rule type: " << mixingruletype << std::endl; if("LB" == mixingruletype) { mixingrule = new LorentzBerthelotMixingRule(); } else { - global_log->error() << "Unknown mixing rule " << mixingruletype << endl; + global_log->error() << "Unknown mixing rule " << mixingruletype << std::endl; Simulation::exit(1); } mixingrule->readXML(xmlconfig); diff --git a/src/ensemble/GrandCanonicalEnsemble.cpp b/src/ensemble/GrandCanonicalEnsemble.cpp index c7b32346b9..0bd790cedd 100644 --- a/src/ensemble/GrandCanonicalEnsemble.cpp +++ b/src/ensemble/GrandCanonicalEnsemble.cpp @@ -64,7 +64,7 @@ void GrandCanonicalEnsemble::prepare_start() { if((Tcur < 0.85 * Ttar) || (Tcur > 1.15 * Ttar)) Tcur = Ttar; - list::iterator cpit; + std::list::iterator cpit; if(global_simulation->getH() == 0.0) global_simulation->setH(sqrt(6.2831853 * Ttar)); for(cpit = _lmu.begin(); cpit != _lmu.end(); cpit++) { @@ -80,7 +80,7 @@ void GrandCanonicalEnsemble::beforeEventNewTimestep(ParticleContainer* moleculeC /** @todo What is this good for? Where come the numbers from? Needs documentation */ if(simstep >= _initGrandCanonical) { unsigned j = 0; - list::iterator cpit; + std::list::iterator cpit; for(cpit = _lmu.begin(); cpit != _lmu.end(); cpit++) { if(!((simstep + 2 * j + 3) % cpit->getInterval())) { cpit->prepareTimestep(moleculeContainer, domainDecomposition); @@ -96,11 +96,11 @@ void GrandCanonicalEnsemble::afterForces(ParticleContainer* moleculeContainer, D if(simstep >= _initGrandCanonical) { unsigned j = 0; - list::iterator cpit; + std::list::iterator cpit; for(cpit = _lmu.begin(); cpit != _lmu.end(); cpit++) { if(!((simstep + 2 * j + 3) % cpit->getInterval())) { global_log->debug() << "Grand canonical ensemble(" << j << "): test deletions and insertions" - << endl; + << std::endl; this->_simulationDomain->setLambda(cpit->getLambda()); this->_simulationDomain->setDensityCoefficient(cpit->getDensityCoefficient()); double localUpotBackup = _simulationDomain->getLocalUpot(); @@ -120,7 +120,7 @@ void GrandCanonicalEnsemble::afterForces(ParticleContainer* moleculeContainer, D int balance = cpit->grandcanonicalBalance(domainDecomposition); global_log->debug() << " b[" << ((balance > 0) ? "+" : "") << balance << "(" << ((localBalance > 0) ? "+" : "") << localBalance << ")" << " / c = " - << cpit->getComponentID() << "] " << endl; + << cpit->getComponentID() << "] " << std::endl; _simulationDomain->Nadd(cpit->getComponentID(), balance, localBalance); } diff --git a/src/ensemble/PressureGradient.cpp b/src/ensemble/PressureGradient.cpp index 126f549404..fcdcc7dc5a 100644 --- a/src/ensemble/PressureGradient.cpp +++ b/src/ensemble/PressureGradient.cpp @@ -9,15 +9,13 @@ #include "utils/Logger.h" #include "Simulation.h" -using namespace Log; -using namespace std; PressureGradient::PressureGradient(int rank) { this->_localRank = rank; this->_universalConstantAccelerationTimesteps = 0; if(!rank) for(unsigned short int d=0; d < 3; d++) - this->_globalVelocitySum[d] = map(); + this->_globalVelocitySum[d] = std::map(); this->_universalConstantTau = true; this->_universalZetaFlow = 0.0; this->_universalTauPrime = 0.0; @@ -45,8 +43,8 @@ void PressureGradient::specifyComponentSet(unsigned int cosetid, double v[3], do sqrt(this->_universalTau[cosetid] / (timestep*this->_universalConstantAccelerationTimesteps)) : this->_universalTauPrime / (timestep*this->_universalConstantAccelerationTimesteps) ); - cout << "coset " << cosetid << " will receive " - << _globalVelocityQueuelength[cosetid] << " velocity queue entries." << endl; + std::cout << "coset " << cosetid << " will receive " + << _globalVelocityQueuelength[cosetid] << " velocity queue entries." << std::endl; } } @@ -98,14 +96,14 @@ void PressureGradient::determineAdditionalAcceleration } domainDecomp->collCommFinalize(); - map::iterator gVSit; + std::map::iterator gVSit; if(!this->_localRank) { for(gVSit = _globalVelocitySum[0].begin(); gVSit != _globalVelocitySum[0].end(); gVSit++) { #ifndef NDEBUG - global_log->debug() << "required entries in velocity queue: " << _globalVelocityQueuelength[gVSit->first] << endl; - global_log->debug() << "entries in velocity queue: " << _globalPriorVelocitySums[0][gVSit->first].size() << endl; + global_log->debug() << "required entries in velocity queue: " << _globalVelocityQueuelength[gVSit->first] << std::endl; + global_log->debug() << "entries in velocity queue: " << _globalPriorVelocitySums[0][gVSit->first].size() << std::endl; #endif for(unsigned short int d = 0; d < 3; d++) { @@ -136,7 +134,7 @@ void PressureGradient::determineAdditionalAcceleration #ifndef NDEBUG global_log->debug() << "accelerator no. " << gVSit->first << "previous vz: " << previousVelocity[2] - << "current vz: " << _globalVelocitySum[2][gVSit->first]*invgN << endl; + << "current vz: " << _globalVelocitySum[2][gVSit->first]*invgN << std::endl; #endif } } @@ -225,11 +223,11 @@ void PressureGradient::specifyTauPrime(double tauPrime, double dt) Simulation::exit(78); } unsigned int vql = (unsigned int)ceil(tauPrime / (dt*this->_universalConstantAccelerationTimesteps)); - map::iterator vqlit; + std::map::iterator vqlit; for(vqlit = _globalVelocityQueuelength.begin(); vqlit != _globalVelocityQueuelength.end(); vqlit++) { vqlit->second = vql; - cout << "coset " << vqlit->first << " will receive " + std::cout << "coset " << vqlit->first << " will receive " << vqlit->second << " velocity queue entries.\n"; } } @@ -239,7 +237,7 @@ void PressureGradient::specifyTauPrime(double tauPrime, double dt) */ void PressureGradient::adjustTau(double dt) { if(this->_universalConstantTau) return; - map::iterator tauit; + std::map::iterator tauit; double increment; for(tauit = _universalTau.begin(); tauit != _universalTau.end(); tauit++) { diff --git a/src/ensemble/PressureGradient.h b/src/ensemble/PressureGradient.h index ac79206667..67ef595aa7 100644 --- a/src/ensemble/PressureGradient.h +++ b/src/ensemble/PressureGradient.h @@ -119,17 +119,17 @@ class PressureGradient { ####### REMOVED PG FROM DOMAIN CONSTRUCTOR -> REMOVED UNIVERSALPG -> REMOVED FORWARD DECL IN .H AND INCLUDE IN .CPP this->_universalPG = pg; - // after: checkpointfilestream << _epsilonRF << endl; - map componentSets = this->_universalPG->getComponentSets(); - for( map::const_iterator uCSIDit = componentSets.begin(); + // after: checkpointfilestream << _epsilonRF << std::endl; + std::map componentSets = this->_universalPG->getComponentSets(); + for( std::map::const_iterator uCSIDit = componentSets.begin(); uCSIDit != componentSets.end(); uCSIDit++ ) { if(uCSIDit->first > 100) continue; checkpointfilestream << " S\t" << 1+uCSIDit->first << "\t" << uCSIDit->second << "\n"; } - map tau = this->_universalPG->getTau(); - for( map::const_iterator gTit = tau.begin(); + std::map tau = this->_universalPG->getTau(); + for( std::map::const_iterator gTit = tau.begin(); gTit != tau.end(); gTit++ ) { @@ -152,13 +152,13 @@ class PressureGradient { PressureGradient* _pressureGradient; //after: _longRangeCorrection->calculateLongRange(); in ####### if (_pressureGradient->isAcceleratingUniformly()) { - global_log->info() << "Initialising uniform acceleration." << endl; + global_log->info() << "Initialising uniform acceleration." << std::endl; unsigned long uCAT = _pressureGradient->getUCAT(); - global_log->info() << "uCAT: " << uCAT << " steps." << endl; + global_log->info() << "uCAT: " << uCAT << " steps." << std::endl; _pressureGradient->determineAdditionalAcceleration( _domainDecomposition, _moleculeContainer, uCAT * _integrator->getTimestepLength()); - global_log->info() << "Uniform acceleration initialised." << endl; + global_log->info() << "Uniform acceleration initialised." << std::endl; } // first in simulate() @@ -168,18 +168,18 @@ class PressureGradient { // after: _domain->calculateThermostatDirectedVelocity(_moleculeContainer); in simulate() if (_pressureGradient->isAcceleratingUniformly()) { if (!(_simstep % uCAT)) { - global_log->debug() << "Determine the additional acceleration" << endl; + global_log->debug() << "Determine the additional acceleration" << std::endl; _pressureGradient->determineAdditionalAcceleration( _domainDecomposition, _moleculeContainer, uCAT * _integrator->getTimestepLength()); } - global_log->debug() << "Process the uniform acceleration" << endl; + global_log->debug() << "Process the uniform acceleration" << std::endl; _integrator->accelerateUniformly(_moleculeContainer, _domain); _pressureGradient->adjustTau(this->_integrator->getTimestepLength()); } // in initialize() before Domain() - global_log->info() << "Creating PressureGradient ... " << endl; + global_log->info() << "Creating PressureGradient ... " << std::endl; _pressureGradient = new PressureGradient(ownrank); ####### REMOVED FUNCTION ONLY CALLED BY PG FROM INTEGRATOR, LEAPFROG AND LEAPFROGRMM @@ -218,10 +218,10 @@ class PressureGradient { ); void Leapfrog::accelerateUniformly(ParticleContainer* molCont, Domain* domain) { - map* additionalAcceleration = domain->getPG()->getUAA(); - vector comp = *(_simulation.getEnsemble()->getComponents()); - vector::iterator compit; - map componentwiseVelocityDelta[3]; + std::map* additionalAcceleration = domain->getPG()->getUAA(); + std::vector comp = *(_simulation.getEnsemble()->getComponents()); + std::vector::iterator compit; + std::map componentwiseVelocityDelta[3]; for (compit = comp.begin(); compit != comp.end(); compit++) { unsigned cosetid = domain->getPG()->getComponentSet(compit->ID()); if (cosetid != 0) @@ -247,9 +247,9 @@ class PressureGradient { } void Leapfrog::accelerateInstantaneously(ParticleContainer* molCont, Domain* domain) { - vector comp = *(_simulation.getEnsemble()->getComponents()); - vector::iterator compit; - map componentwiseVelocityDelta[3]; + std::vector comp = *(_simulation.getEnsemble()->getComponents()); + std::vector::iterator compit; + std::map componentwiseVelocityDelta[3]; for (compit = comp.begin(); compit != comp.end(); compit++) { unsigned cosetid = domain->getPG()->getComponentSet(compit->ID()); if (cosetid != 0) diff --git a/src/ensemble/tests/CanonicalEnsembleTest.cpp b/src/ensemble/tests/CanonicalEnsembleTest.cpp index 3f4a789ef4..16848904fe 100644 --- a/src/ensemble/tests/CanonicalEnsembleTest.cpp +++ b/src/ensemble/tests/CanonicalEnsembleTest.cpp @@ -13,8 +13,6 @@ #include -using namespace std; - TEST_SUITE_REGISTRATION(CanonicalEnsembleTest); CanonicalEnsembleTest::CanonicalEnsembleTest() { } diff --git a/src/integrators/Leapfrog.cpp b/src/integrators/Leapfrog.cpp index c39e5587bd..458ce5bba4 100644 --- a/src/integrators/Leapfrog.cpp +++ b/src/integrators/Leapfrog.cpp @@ -11,9 +11,6 @@ #include "utils/xmlfileUnits.h" -using namespace std; -using Log::global_log; - Leapfrog::Leapfrog(double timestepLength) : Integrator(timestepLength) { init(); } @@ -28,7 +25,7 @@ Leapfrog::~Leapfrog() {} void Leapfrog::readXML(XMLfileUnits& xmlconfig) { _timestepLength = 0; xmlconfig.getNodeValueReduced("timestep", _timestepLength); - global_log->info() << "Timestep: " << _timestepLength << endl; + global_log->info() << "Timestep: " << _timestepLength << std::endl; mardyn_assert(_timestepLength > 0); } @@ -47,7 +44,7 @@ void Leapfrog::eventNewTimestep(ParticleContainer* molCont, Domain* domain) { void Leapfrog::transition1to2(ParticleContainer* molCont, Domain* /*domain*/) { if (this->_state != STATE_NEW_TIMESTEP) { - global_log->error() << "Leapfrog::transition1to2(...): Wrong state for state transition" << endl; + global_log->error() << "Leapfrog::transition1to2(...): Wrong state for state transition" << std::endl; return; } @@ -65,7 +62,7 @@ void Leapfrog::transition1to2(ParticleContainer* molCont, Domain* /*domain*/) { void Leapfrog::transition2to3(ParticleContainer* molCont, Domain* domain) { if (this->_state != STATE_PRE_FORCE_CALCULATION) { - global_log->error() << "Leapfrog::transition2to3(...): Wrong state for state transition" << endl; + global_log->error() << "Leapfrog::transition2to3(...): Wrong state for state transition" << std::endl; } /* TODO introduce @@ -77,20 +74,20 @@ void Leapfrog::transition2to3(ParticleContainer* molCont, Domain* domain) { * (here and in class Domain) is a nightmare. */ - map N; - map rotDOF; - map summv2; - map sumIw2; + std::map N; + std::map rotDOF; + std::map summv2; + std::map sumIw2; double dt_half = 0.5 * this->_timestepLength; if (domain->severalThermostats()) { #if defined(_OPENMP) #pragma omp parallel #endif { - map N_l; - map rotDOF_l; - map summv2_l; - map sumIw2_l; + std::map N_l; + std::map rotDOF_l; + std::map summv2_l; + std::map sumIw2_l; for (auto tM = molCont->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); tM.isValid(); ++tM) { int cid = tM->componentid(); @@ -154,6 +151,6 @@ void Leapfrog::transition3to1(ParticleContainer* /*molCont*/, Domain* /*domain*/ this->_state = STATE_NEW_TIMESTEP; } else { - global_log->error() << "Leapfrog::transition3to1(...): Wrong state for state transition" << endl; + global_log->error() << "Leapfrog::transition3to1(...): Wrong state for state transition" << std::endl; } } \ No newline at end of file diff --git a/src/integrators/LeapfrogRMM.cpp b/src/integrators/LeapfrogRMM.cpp index 98cc38cd85..3560b5fc3c 100644 --- a/src/integrators/LeapfrogRMM.cpp +++ b/src/integrators/LeapfrogRMM.cpp @@ -13,8 +13,6 @@ #include "PositionCellProcessorRMM.h" #include "VelocityCellProcessorRMM.h" -using namespace std; -using Log::global_log; LeapfrogRMM::LeapfrogRMM() { _velocityCellProcessor = nullptr; @@ -34,7 +32,7 @@ LeapfrogRMM::LeapfrogRMM(double timestepLength) : void LeapfrogRMM::readXML(XMLfileUnits & xmlconfig) { _timestepLength = 0; xmlconfig.getNodeValueReduced("timestep", _timestepLength); - global_log->info() << "Timestep: " << _timestepLength << endl; + global_log->info() << "Timestep: " << _timestepLength << std::endl; mardyn_assert(_timestepLength > 0); mardyn_assert(_velocityCellProcessor == nullptr); @@ -65,10 +63,10 @@ void LeapfrogRMM::computeVelocities(ParticleContainer* molCont, Domain* dom) { // leaving old functionality for debugging purposes // TODO: Thermostat functionality is duplicated X times and needs to be rewritten! - map N; - map rotDOF; - map summv2; - map sumIw2; + std::map N; + std::map rotDOF; + std::map summv2; + std::map sumIw2; { unsigned long red_N = 0; unsigned long red_rotDOF = 0; @@ -92,7 +90,7 @@ void LeapfrogRMM::computeVelocities(ParticleContainer* molCont, Domain* dom) { summv2[0] += red_summv2; sumIw2[0] += red_sumIw2; } - for (map::iterator thermit = summv2.begin(); thermit != summv2.end(); thermit++) { + for (std::map::iterator thermit = summv2.begin(); thermit != summv2.end(); thermit++) { dom->setLocalSummv2(thermit->second, thermit->first); dom->setLocalSumIw2(sumIw2[thermit->first], thermit->first); dom->setLocalNrotDOF(thermit->first, N[thermit->first], rotDOF[thermit->first]); diff --git a/src/io/ASCIIReader.cpp b/src/io/ASCIIReader.cpp index 7eaaf910c0..bdebdb23f4 100644 --- a/src/io/ASCIIReader.cpp +++ b/src/io/ASCIIReader.cpp @@ -21,21 +21,19 @@ #include "particleContainer/ParticleContainer.h" #include "utils/Logger.h" -using Log::global_log; - ASCIIReader::ASCIIReader() {} -void ASCIIReader::setPhaseSpaceFile(string filename) { +void ASCIIReader::setPhaseSpaceFile(std::string filename) { _phaseSpaceFile = filename; } -void ASCIIReader::setPhaseSpaceHeaderFile(string filename) { +void ASCIIReader::setPhaseSpaceHeaderFile(std::string filename) { _phaseSpaceHeaderFile = filename; } void ASCIIReader::readXML(XMLfileUnits& xmlconfig) { - string pspfile; + std::string pspfile; if(xmlconfig.getNodeValue(".", pspfile)) { pspfile = string_utils::trim(pspfile); // only prefix xml dir if path is not absolute @@ -48,7 +46,7 @@ void ASCIIReader::readXML(XMLfileUnits& xmlconfig) { } void ASCIIReader::readPhaseSpaceHeader(Domain* domain, double timestep) { - string token; + std::string token; global_log->info() << "Opening phase space header file " << _phaseSpaceHeaderFile << std::endl; _phaseSpaceHeaderFileStream.open(_phaseSpaceHeaderFile.c_str()); @@ -58,7 +56,7 @@ void ASCIIReader::readPhaseSpaceHeader(Domain* domain, double timestep) { Simulation::exit(1); } - string inputversion; + std::string inputversion; _phaseSpaceHeaderFileStream >> token >> inputversion; // FIXME: remove tag trunk from file specification? if(token != "trunk") { @@ -73,7 +71,7 @@ void ASCIIReader::readPhaseSpaceHeader(Domain* domain, double timestep) { global_log->info() << "Reading phase space header from file " << _phaseSpaceHeaderFile << std::endl; - vector& dcomponents = *(_simulation.getEnsemble()->getComponents()); + std::vector& dcomponents = *(_simulation.getEnsemble()->getComponents()); bool header = true; // When the last header element is reached, "header" is set to false while(header) { @@ -210,7 +208,7 @@ void ASCIIReader::readPhaseSpaceHeader(Domain* domain, double timestep) { #endif // Mixing coefficients - vector& dmixcoeff = domain->getmixcoeff(); + std::vector& dmixcoeff = domain->getmixcoeff(); dmixcoeff.clear(); for(unsigned int i = 1; i < numcomponents; i++) { for(unsigned int j = i + 1; j <= numcomponents; j++) { @@ -230,7 +228,7 @@ void ASCIIReader::readPhaseSpaceHeader(Domain* domain, double timestep) { // find out the actual position, because the phase space definition will follow // FIXME: is there a more elegant way? fpos = _phaseSpaceHeaderFileStream.tellg(); - _phaseSpaceFileStream.seekg(fpos, ios::beg); + _phaseSpaceFileStream.seekg(fpos, std::ios::beg); } // FIXME: Is there a better solution than skipping the rest of the file? header = false; @@ -272,12 +270,12 @@ ASCIIReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domain } // Rank 0 only #endif - string token; - vector& dcomponents = *(_simulation.getEnsemble()->getComponents()); + std::string token; + std::vector& dcomponents = *(_simulation.getEnsemble()->getComponents()); unsigned int numcomponents = dcomponents.size(); unsigned long nummolecules = 0; unsigned long maxid = 0; // stores the highest molecule ID found in the phase space file - string ntypestring("ICRVQD"); + std::string ntypestring("ICRVQD"); enum class Ndatatype { ICRVQDV, ICRVQD, IRV, ICRV } ntype = Ndatatype::ICRVQD; @@ -306,7 +304,7 @@ ASCIIReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domain if (domainDecomp->getRank() == 0) { // Rank 0 only #endif - streampos spos = _phaseSpaceFileStream.tellg(); + std::streampos spos = _phaseSpaceFileStream.tellg(); _phaseSpaceFileStream >> token; if((token == "MoleculeFormat") || (token == "M")) { _phaseSpaceFileStream >> ntypestring; diff --git a/src/io/Adios2Reader.cpp b/src/io/Adios2Reader.cpp index f71ba79958..ed95d3cbe3 100644 --- a/src/io/Adios2Reader.cpp +++ b/src/io/Adios2Reader.cpp @@ -18,8 +18,6 @@ #endif #include "utils/xmlfile.h" -using Log::global_log; - void Adios2Reader::init(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain) { }; @@ -27,16 +25,16 @@ void Adios2Reader::init(ParticleContainer* particleContainer, void Adios2Reader::readXML(XMLfileUnits& xmlconfig) { _mode = "rootOnly"; xmlconfig.getNodeValue("mode", _mode); - global_log->info() << "[Adios2Reader] Input mode: " << _mode << endl; + global_log->info() << "[Adios2Reader] Input mode: " << _mode << std::endl; _inputfile = "mardyn.bp"; xmlconfig.getNodeValue("filename", _inputfile); - global_log->info() << "[Adios2Reader] Inputfile: " << _inputfile << endl; + global_log->info() << "[Adios2Reader] Inputfile: " << _inputfile << std::endl; _adios2enginetype = "BP4"; xmlconfig.getNodeValue("adios2enginetype", _adios2enginetype); - global_log->info() << "[Adios2Reader] Adios2 engine type: " << _adios2enginetype << endl; + global_log->info() << "[Adios2Reader] Adios2 engine type: " << _adios2enginetype << std::endl; _step = -1; xmlconfig.getNodeValue("adios2Step", _step); - global_log->info() << "[Adios2Reader] step to load from input file: " << _step << endl; + global_log->info() << "[Adios2Reader] step to load from input file: " << _step << std::endl; if (!mainInstance) initAdios2(); }; @@ -44,13 +42,13 @@ void Adios2Reader::readXML(XMLfileUnits& xmlconfig) { void Adios2Reader::testInit(std::string infile, int step, std::string adios2enginetype, std::string mode) { using std::endl; _inputfile = infile; - global_log->info() << "[Adios2Reader] Inputfile: " << _inputfile << endl; + global_log->info() << "[Adios2Reader] Inputfile: " << _inputfile << std::endl; _adios2enginetype = adios2enginetype; - global_log->info() << "[Adios2Reader] Adios2 engine type: " << _adios2enginetype << endl; + global_log->info() << "[Adios2Reader] Adios2 engine type: " << _adios2enginetype << std::endl; _step = step; - global_log->info() << "[Adios2Reader] step to load from input file: " << _step << endl; + global_log->info() << "[Adios2Reader] step to load from input file: " << _step << std::endl; _mode = mode; - global_log->info() << "[Adios2Reader] Input mode: " << _mode << endl; + global_log->info() << "[Adios2Reader] Input mode: " << _mode << std::endl; if (!mainInstance) initAdios2(); } @@ -104,7 +102,7 @@ unsigned long Adios2Reader::readPhaseSpace(ParticleContainer* particleContainer, if (domain->getglobalRho() == 0.) { domain->setglobalRho(domain->getglobalNumMolecules(true, particleContainer, domainDecomp) / domain->getGlobalVolume()); - global_log->info() << "[Adios2Reader] Calculated Rho_global = " << domain->getglobalRho() << endl; + global_log->info() << "[Adios2Reader] Calculated Rho_global = " << domain->getglobalRho() << std::endl; } engine->Close(); @@ -127,14 +125,14 @@ void Adios2Reader::rootOnlyRead(ParticleContainer* particleContainer, Domain* do auto num_reads = particle_count / bufferSize; if (particle_count % bufferSize != 0) num_reads += 1; - global_log->info() << "[Adios2Reader] Input is divided into " << num_reads << " sequential reads." << endl; + global_log->info() << "[Adios2Reader] Input is divided into " << num_reads << " sequential reads." << std::endl; auto variables = io->AvailableVariables(); for (const auto &var : variables) { if (var.first == "rx") { if (var.second.at("Type") != "double") { - global_log->info() << "[Adios2Reader] Detected single precision" << endl; + global_log->info() << "[Adios2Reader] Detected single precision" << std::endl; _single_precision = true; rx = std::vector(); ry = std::vector(); @@ -150,7 +148,7 @@ void Adios2Reader::rootOnlyRead(ParticleContainer* particleContainer, Domain* do Ly = std::vector(); Lz = std::vector(); } else { - global_log->info() << "[Adios2Reader] Detected double precision" << endl; + global_log->info() << "[Adios2Reader] Detected double precision" << std::endl; rx = std::vector(); ry = std::vector(); rz = std::vector(); @@ -169,7 +167,7 @@ void Adios2Reader::rootOnlyRead(ParticleContainer* particleContainer, Domain* do } for (int read = 0; read < num_reads; read++) { - global_log->info() << "[Adios2Reader] Performing read " << read << endl; + global_log->info() << "[Adios2Reader] Performing read " << read << std::endl; const uint64_t offset = read * bufferSize; if (read == num_reads - 1) bufferSize = particle_count % bufferSize; if (domainDecomp->getRank() == 0) { @@ -193,7 +191,7 @@ void Adios2Reader::rootOnlyRead(ParticleContainer* particleContainer, Domain* do } engine->PerformGets(); - global_log->info() << "[Adios2Reader] Read " << read << " done." << endl; + global_log->info() << "[Adios2Reader] Read " << read << " done." << std::endl; if (_simulation.getEnsemble()->getComponents()->empty()) { auto attributes = io->AvailableAttributes(); @@ -322,7 +320,7 @@ void Adios2Reader::parallelRead(ParticleContainer* particleContainer, Domain* do for (const auto &var : variables) { if (var.first == "rx") { if (var.second.at("Type") != "double") { - global_log->info() << "[Adios2Reader] Detected single precision" << endl; + global_log->info() << "[Adios2Reader] Detected single precision" << std::endl; _single_precision = true; rx = std::vector(); ry = std::vector(); @@ -338,7 +336,7 @@ void Adios2Reader::parallelRead(ParticleContainer* particleContainer, Domain* do Ly = std::vector(); Lz = std::vector(); } else { - global_log->info() << "[Adios2Reader] Detected double precision" << endl; + global_log->info() << "[Adios2Reader] Detected double precision" << std::endl; rx = std::vector(); ry = std::vector(); rz = std::vector(); @@ -378,7 +376,7 @@ void Adios2Reader::parallelRead(ParticleContainer* particleContainer, Domain* do } engine->PerformGets(); - global_log->debug() << "[Adios2Reader] Processed gets." << endl; + global_log->debug() << "[Adios2Reader] Processed gets." << std::endl; std::vector global_component_ids{}; #ifdef ENABLE_MPI diff --git a/src/io/Adios2Writer.cpp b/src/io/Adios2Writer.cpp index 3c429ce563..5fa6a5e6ea 100644 --- a/src/io/Adios2Writer.cpp +++ b/src/io/Adios2Writer.cpp @@ -16,8 +16,6 @@ #include "utils/mardyn_assert.h" #include "utils/xmlfile.h" -using Log::global_log; - constexpr char const* mol_id_name = "molecule_id"; constexpr char const* comp_id_name = "component_id"; constexpr char const* rx_name = "rx"; @@ -128,28 +126,28 @@ void Adios2Writer::readXML(XMLfileUnits& xmlconfig) { using std::endl; _outputfile = "mardyn.bp"; xmlconfig.getNodeValue("outputfile", _outputfile); - global_log->info() << "[Adios2Writer] Outputfile: " << _outputfile << endl; + global_log->info() << "[Adios2Writer] Outputfile: " << _outputfile << std::endl; _adios2enginetype = "BP4"; xmlconfig.getNodeValue("adios2enginetype", _adios2enginetype); - global_log->info() << "[Adios2Writer] Adios2 engine type: " << _adios2enginetype << endl; + global_log->info() << "[Adios2Writer] Adios2 engine type: " << _adios2enginetype << std::endl; _writefrequency = 50000; xmlconfig.getNodeValue("writefrequency", _writefrequency); - global_log->info() << "[Adios2Writer] write frequency: " << _writefrequency << endl; + global_log->info() << "[Adios2Writer] write frequency: " << _writefrequency << std::endl; _append_mode = "OFF"; xmlconfig.getNodeValue("appendmode", _append_mode); - global_log->info() << "[Adios2Writer] Append mode: " << _append_mode << endl; + global_log->info() << "[Adios2Writer] Append mode: " << _append_mode << std::endl; _compression = "none"; xmlconfig.getNodeValue("compression", _compression); - global_log->info() << "[Adios2Writer] compression type: " << _compression << endl; + global_log->info() << "[Adios2Writer] compression type: " << _compression << std::endl; _compression_accuracy = "0.00001"; xmlconfig.getNodeValue("compressionaccuracy", _compression_accuracy); - global_log->info() << "[Adios2Writer] compression accuracy (SZ): " << _compression_accuracy << endl; + global_log->info() << "[Adios2Writer] compression accuracy (SZ): " << _compression_accuracy << std::endl; _compression_rate = "8"; xmlconfig.getNodeValue("compressionrate", _compression_rate); - global_log->info() << "[Adios2Writer] compression rate (ZFP): " << _compression_rate << endl; + global_log->info() << "[Adios2Writer] compression rate (ZFP): " << _compression_rate << std::endl; _num_files = -1; xmlconfig.getNodeValue("numfiles", _num_files); - global_log->info() << "[Adios2Writer] Number of files: " << _num_files << endl; + global_log->info() << "[Adios2Writer] Number of files: " << _num_files << std::endl; xmlconfig.changecurrentnode("/"); @@ -163,17 +161,17 @@ void Adios2Writer::testInit(std::vector& comps, const std::string out const std::string compression_rate) { using std::endl; _outputfile = outfile; - global_log->info() << "[Adios2Writer] Outputfile: " << _outputfile << endl; + global_log->info() << "[Adios2Writer] Outputfile: " << _outputfile << std::endl; _adios2enginetype = adios2enginetype; - global_log->info() << "[Adios2Writer] Adios2 engine type: " << _adios2enginetype << endl; + global_log->info() << "[Adios2Writer] Adios2 engine type: " << _adios2enginetype << std::endl; _writefrequency = writefrequency; - global_log->info() << "[Adios2Writer] write frequency: " << _writefrequency << endl; + global_log->info() << "[Adios2Writer] write frequency: " << _writefrequency << std::endl; _compression = compression; - global_log->info() << "[Adios2Writer] compression type: " << _compression << endl; + global_log->info() << "[Adios2Writer] compression type: " << _compression << std::endl; _compression_accuracy = compression_accuracy; - global_log->info() << "[Adios2Writer] compression accuracy (SZ): " << _compression_accuracy << endl; + global_log->info() << "[Adios2Writer] compression accuracy (SZ): " << _compression_accuracy << std::endl; _compression_rate = compression_rate; - global_log->info() << "[Adios2Writer] compression rate (ZFP): " << _compression_rate << endl; + global_log->info() << "[Adios2Writer] compression rate (ZFP): " << _compression_rate << std::endl; _comps = comps; if (!_inst) initAdios2(); @@ -238,7 +236,7 @@ void Adios2Writer::initAdios2() { for (auto& site : sites) { component_elements_vec.emplace_back(site.getName()); } - string component_elements = + std::string component_elements = std::accumulate(component_elements_vec.begin(), component_elements_vec.end(), std::string(), [](std::string& ss, std::string& s) { return ss.empty() ? s : ss + "," + s; }); diff --git a/src/io/BinaryReader.cpp b/src/io/BinaryReader.cpp index 3d9f534fc3..c115598031 100644 --- a/src/io/BinaryReader.cpp +++ b/src/io/BinaryReader.cpp @@ -31,8 +31,6 @@ #include #include -using Log::global_log; -using namespace std; enum MoleculeFormat : uint32_t { ICRVQD, IRV, ICRV @@ -46,30 +44,30 @@ BinaryReader::BinaryReader() BinaryReader::~BinaryReader() = default; void BinaryReader::readXML(XMLfileUnits& xmlconfig) { - string pspfile; - string pspheaderfile; + std::string pspfile; + std::string pspheaderfile; xmlconfig.getNodeValue("header", pspheaderfile); pspheaderfile = string_utils::trim(pspheaderfile); if (pspheaderfile[0] != '/') { pspheaderfile.insert(0, xmlconfig.getDir()); } - global_log->info() << "phase space header file: " << pspheaderfile << endl; + global_log->info() << "phase space header file: " << pspheaderfile << std::endl; xmlconfig.getNodeValue("data", pspfile); pspfile = string_utils::trim(pspfile); // only prefix xml dir if path is not absolute if (pspfile[0] != '/') { pspfile.insert(0, xmlconfig.getDir()); } - global_log->info() << "phase space data file: " << pspfile << endl; + global_log->info() << "phase space data file: " << pspfile << std::endl; setPhaseSpaceHeaderFile(pspheaderfile); setPhaseSpaceFile(pspfile); } -void BinaryReader::setPhaseSpaceFile(string filename) { +void BinaryReader::setPhaseSpaceFile(std::string filename) { _phaseSpaceFile = filename; } -void BinaryReader::setPhaseSpaceHeaderFile(string filename) { +void BinaryReader::setPhaseSpaceHeaderFile(std::string filename) { _phaseSpaceHeaderFile = filename; } @@ -77,8 +75,8 @@ void BinaryReader::readPhaseSpaceHeader(Domain* domain, double timestep) { XMLfileUnits inp(_phaseSpaceHeaderFile); if(not inp.changecurrentnode("/mardyn")) { - global_log->error() << "Could not find root node /mardyn in XML input file." << endl; - global_log->fatal() << "Not a valid MarDyn XML input file." << endl; + global_log->error() << "Could not find root node /mardyn in XML input file." << std::endl; + global_log->fatal() << "Not a valid MarDyn XML input file." << std::endl; Simulation::exit(1); } @@ -96,7 +94,7 @@ void BinaryReader::readPhaseSpaceHeader(Domain* domain, double timestep) { bInputOk = bInputOk && inp.getNodeValue("format@type", strMoleculeFormat); if(not bInputOk) { - global_log->error() << "Content of file: '" << _phaseSpaceHeaderFile << "' corrupted! Program exit ..." << endl; + global_log->error() << "Content of file: '" << _phaseSpaceHeaderFile << "' corrupted! Program exit ..." << std::endl; Simulation::exit(1); } @@ -107,7 +105,7 @@ void BinaryReader::readPhaseSpaceHeader(Domain* domain, double timestep) { else if("ICRV" == strMoleculeFormat) _nMoleculeFormat = ICRV; else { - global_log->error() << "Not a valid molecule format: " << strMoleculeFormat << ", program exit ..." << endl; + global_log->error() << "Not a valid molecule format: " << strMoleculeFormat << ", program exit ..." << std::endl; Simulation::exit(1); } @@ -129,22 +127,22 @@ BinaryReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domai if (domainDecomp->getRank() == 0) { // Rank 0 only #endif global_log->info() << "Opening phase space file " << _phaseSpaceFile - << endl; + << std::endl; _phaseSpaceFileStream.open(_phaseSpaceFile.c_str(), - ios::binary | ios::in); + std::ios::binary | std::ios::in); if(!_phaseSpaceFileStream.is_open()) { global_log->error() << "Could not open phaseSpaceFile " - << _phaseSpaceFile << endl; + << _phaseSpaceFile << std::endl; Simulation::exit(1); } global_log->info() << "Reading phase space file " << _phaseSpaceFile - << endl; + << std::endl; #ifdef ENABLE_MPI } // Rank 0 only #endif - string token; - vector& dcomponents = *(_simulation.getEnsemble()->getComponents()); + std::string token; + std::vector& dcomponents = *(_simulation.getEnsemble()->getComponents()); size_t numcomponents = dcomponents.size(); unsigned long maxid = 0; // stores the highest molecule ID found in the phase space file @@ -178,7 +176,7 @@ BinaryReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domai #endif if(_phaseSpaceFileStream.eof()) { global_log->error() << "End of file was hit before all " << numMolecules << " expected molecules were read." - << endl; + << std::endl; Simulation::exit(1); } _phaseSpaceFileStream.read(reinterpret_cast (&id), 8); @@ -226,7 +224,7 @@ BinaryReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domai } if ((x < 0.0 || x >= domain->getGlobalLength(0)) || (y < 0.0 || y >= domain->getGlobalLength(1)) || (z < 0.0 || z >= domain->getGlobalLength(2))) { - global_log->warning() << "Molecule " << id << " out of box: " << x << ";" << y << ";" << z << endl; + global_log->warning() << "Molecule " << id << " out of box: " << x << ";" << y << ";" << z << std::endl; } if(componentid > numcomponents) { @@ -234,12 +232,12 @@ BinaryReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domai << " has a component ID greater than the existing number of components: " << componentid << ">" - << numcomponents << endl; + << numcomponents << std::endl; Simulation::exit(1); } if(componentid == 0) { global_log->error() << "Molecule id " << id - << " has componentID == 0." << endl; + << " has componentID == 0." << std::endl; Simulation::exit(1); } // ComponentIDs are used as array IDs, hence need to start at 0. @@ -305,18 +303,18 @@ BinaryReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domai unsigned long iph = numMolecules / 100; if(iph != 0 && (i % iph) == 0) global_log->info() << "Finished reading molecules: " << i / iph - << "%\r" << flush; + << "%\r" << std::flush; } - global_log->info() << "Finished reading molecules: 100%" << endl; - global_log->info() << "Reading Molecules done" << endl; + global_log->info() << "Finished reading molecules: 100%" << std::endl; + global_log->info() << "Reading Molecules done" << std::endl; // TODO: Shouldn't we always calculate this? if (domain->getglobalRho() < 1e-5) { domain->setglobalRho( domain->getglobalNumMolecules(true, particleContainer, domainDecomp) / domain->getGlobalVolume()); global_log->info() << "Calculated Rho_global = " - << domain->getglobalRho() << endl; + << domain->getglobalRho() << std::endl; } #ifdef ENABLE_MPI @@ -329,7 +327,7 @@ BinaryReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domai inputTimer.stop(); global_log->info() << "Initial IO took: " - << inputTimer.get_etime() << " sec" << endl; + << inputTimer.get_etime() << " sec" << std::endl; #ifdef ENABLE_MPI MPI_CHECK(MPI_Type_free(&mpi_Particle)); #endif diff --git a/src/io/CavityWriter.cpp b/src/io/CavityWriter.cpp index d0c60ecab0..182e827cb5 100644 --- a/src/io/CavityWriter.cpp +++ b/src/io/CavityWriter.cpp @@ -12,55 +12,52 @@ #include "Simulation.h" #include "ensemble/CavityEnsemble.h" -using Log::global_log; -using namespace std; - void CavityWriter::readXML(XMLfileUnits &xmlconfig) { _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "[CavityWriter] Write frequency: " << _writeFrequency << endl; + global_log->info() << "[CavityWriter] Write frequency: " << _writeFrequency << std::endl; _outputPrefix = "mardyn"; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "[CavityWriter] Output prefix: " << _outputPrefix << endl; + global_log->info() << "[CavityWriter] Output prefix: " << _outputPrefix << std::endl; int incremental = 1; xmlconfig.getNodeValue("incremental", incremental); _incremental = (incremental != 0); - global_log->info() << "[CavityWriter] Incremental numbers: " << _incremental << endl; + global_log->info() << "[CavityWriter] Incremental numbers: " << _incremental << std::endl; int appendTimestamp = 0; xmlconfig.getNodeValue("appendTimestamp", appendTimestamp); if (appendTimestamp > 0) { _appendTimestamp = true; } - global_log->info() << "[CavityWriter] Append timestamp: " << _appendTimestamp << endl; + global_log->info() << "[CavityWriter] Append timestamp: " << _appendTimestamp << std::endl; xmlconfig.getNodeValue("maxNeighbours", _maxNeighbors); if (_maxNeighbors <= 0) { - global_log->error() << "[CavityWriter] Invalid number of maxNeighbors: " << _maxNeighbors << endl; + global_log->error() << "[CavityWriter] Invalid number of maxNeighbors: " << _maxNeighbors << std::endl; Simulation::exit(999); } xmlconfig.getNodeValue("radius", _radius); if (_radius <= 0.0f) { - global_log->error() << "[CavityWriter] Invalid size of radius: " << _radius << endl; + global_log->error() << "[CavityWriter] Invalid size of radius: " << _radius << std::endl; Simulation::exit(999); } xmlconfig.getNodeValue("Nx", _Nx); if (_Nx <= 0) { - global_log->error() << "[CavityWriter] Invalid number of cells Nx: " << _Nx << endl; + global_log->error() << "[CavityWriter] Invalid number of cells Nx: " << _Nx << std::endl; Simulation::exit(999); } xmlconfig.getNodeValue("Ny", _Ny); if (_Ny <= 0) { - global_log->error() << "[CavityWriter] Invalid number of cells Ny: " << _Ny << endl; + global_log->error() << "[CavityWriter] Invalid number of cells Ny: " << _Ny << std::endl; Simulation::exit(999); } xmlconfig.getNodeValue("Nz", _Nz); if (_Nz <= 0) { - global_log->error() << "[CavityWriter] Invalid number of cells Nz: " << _Nz << endl; + global_log->error() << "[CavityWriter] Invalid number of cells Nz: " << _Nz << std::endl; Simulation::exit(999); } @@ -78,22 +75,22 @@ void CavityWriter::readXML(XMLfileUnits &xmlconfig) { for (int d = 0; d < 3; d++) { if (_controlVolume[d * 2] > _controlVolume[d * 2 + 1]) { global_log->error() << "[CavityWriter] Lower Bound of Control Volume may not be larger than upper bound. " - << endl; + << std::endl; Simulation::exit(999); } if (_controlVolume[d * 2] < 0 || _controlVolume[d * 2 + 1] > global_simulation->getDomain()->getGlobalLength(d)) { global_log->error() << "[CavityWriter] Control volume bounds may not be outside of domain boundaries. " - << endl; + << std::endl; Simulation::exit(999); } } // Get components to check // get root - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); - this->_mcav = map(); + this->_mcav = std::map(); // iterate over all components XMLfile::Query query = xmlconfig.query("componentid"); @@ -101,7 +98,7 @@ void CavityWriter::readXML(XMLfileUnits &xmlconfig) { xmlconfig.changecurrentnode(pluginIter); int componentID = -1; xmlconfig.getNodeValue(xmlconfig.getcurrentnodepath(), componentID); - global_log->info() << "[CavityWriter] Component: " << componentID << endl; + global_log->info() << "[CavityWriter] Component: " << componentID << std::endl; CavityEnsemble *cav = new CavityEnsemble(); _mcav[componentID] = cav; } @@ -123,7 +120,7 @@ void CavityWriter::init(ParticleContainer *particleContainer, DomainDecompBase * if ((Tcur < 0.85 * Ttar) || (Tcur > 1.15 * Ttar)) Tcur = Ttar; - map::iterator ceit; + std::map::iterator ceit; for (ceit = _mcav.begin(); ceit != _mcav.end(); ceit++) { // setup @@ -138,9 +135,9 @@ void CavityWriter::init(ParticleContainer *particleContainer, DomainDecompBase * ceit->second->submitTemperature(Tcur); int cID = ceit->first; Component *c = global_simulation->getEnsemble()->getComponent(cID); - global_log->info() << "[Cavity Writer] init: " << cID << endl; + global_log->info() << "[Cavity Writer] init: " << cID << std::endl; ceit->second->init(c, _Nx, _Ny, _Nz); - global_log->info() << "[Cavity Writer] init done: " << cID << endl; + global_log->info() << "[Cavity Writer] init done: " << cID << std::endl; } } @@ -150,7 +147,7 @@ void CavityWriter::beforeEventNewTimestep( unsigned long simstep ) { if (simstep >= global_simulation->getInitStatistics() && simstep % _writeFrequency == 0) { - map::iterator ceit; + std::map::iterator ceit; for (ceit = this->_mcav.begin(); ceit != this->_mcav.end(); ceit++) { ceit->second->preprocessStep(); } @@ -163,7 +160,7 @@ void CavityWriter::afterForces( ) { if (simstep >= global_simulation->getInitStatistics() && simstep % _writeFrequency == 0) { - map::iterator ceit; + std::map::iterator ceit; for (ceit = this->_mcav.begin(); ceit != this->_mcav.end(); ceit++) { ceit->second->cavityStep(particleContainer); @@ -177,11 +174,11 @@ void CavityWriter::endStep(ParticleContainer * /*particleContainer*/, DomainDeco Domain * /*domain*/, unsigned long simstep) { if (simstep % _writeFrequency == 0) { - map::iterator ceit; + std::map::iterator ceit; - map cav_filenamestream; + std::map cav_filenamestream; for (ceit = _mcav.begin(); ceit != _mcav.end(); ceit++) { - cav_filenamestream[ceit->first] = new stringstream; + cav_filenamestream[ceit->first] = new std::stringstream; *cav_filenamestream[ceit->first] << _outputPrefix << "-c" << ceit->first; } @@ -195,15 +192,15 @@ void CavityWriter::endStep(ParticleContainer * /*particleContainer*/, DomainDeco for (ceit = _mcav.begin(); ceit != _mcav.end(); ceit++) { *cav_filenamestream[ceit->first] << ".cav.xyz"; - global_log->info() << "[CavityWriter] outputName: " << cav_filenamestream[ceit->first]->str() << endl; + global_log->info() << "[CavityWriter] outputName: " << cav_filenamestream[ceit->first]->str() << std::endl; } int ownRank = domainDecomp->getRank(); if (ownRank == 0) { for (ceit = _mcav.begin(); ceit != _mcav.end(); ceit++) { - ofstream cavfilestream(cav_filenamestream[ceit->first]->str().c_str()); - cavfilestream << ceit->second->numCavities() << endl; - cavfilestream << "comment line" << endl; + std::ofstream cavfilestream(cav_filenamestream[ceit->first]->str().c_str()); + cavfilestream << ceit->second->numCavities() << std::endl; + cavfilestream << "comment line" << std::endl; cavfilestream.close(); } } @@ -213,12 +210,12 @@ void CavityWriter::endStep(ParticleContainer * /*particleContainer*/, DomainDeco if (ownRank == process) { for (ceit = _mcav.begin(); ceit != _mcav.end(); ceit++) { - ofstream cavfilestream(cav_filenamestream[ceit->first]->str().c_str(), ios::app); + std::ofstream cavfilestream(cav_filenamestream[ceit->first]->str().c_str(), std::ios::app); - map tcav = ceit->second->activeParticleContainer(); - map::iterator tcit; + std::map tcav = ceit->second->activeParticleContainer(); + std::map::iterator tcit; for (tcit = tcav.begin(); tcit != tcav.end(); tcit++) { - //global_log->info() << "[CavityWriter] output6" << endl; + //global_log->info() << "[CavityWriter] output6" << std::endl; if (ceit->first == 0) { cavfilestream << "C "; } else if (ceit->first == 1) { cavfilestream << "N "; } diff --git a/src/io/CheckpointWriter.cpp b/src/io/CheckpointWriter.cpp index 0b6c224962..94ea82169a 100644 --- a/src/io/CheckpointWriter.cpp +++ b/src/io/CheckpointWriter.cpp @@ -11,16 +11,13 @@ #include "utils/Logger.h" -using Log::global_log; -using namespace std; - void CheckpointWriter::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << endl; + global_log->info() << "Write frequency: " << _writeFrequency << std::endl; if(_writeFrequency == 0) { - global_log->error() << "Write frequency must be a positive nonzero integer, but is " << _writeFrequency << endl; + global_log->error() << "Write frequency must be a positive nonzero integer, but is " << _writeFrequency << std::endl; Simulation::exit(-1); } @@ -33,18 +30,18 @@ void CheckpointWriter::readXML(XMLfileUnits& xmlconfig) { _useBinaryFormat = true; } else { - global_log->error() << "Unknown CheckpointWriter type '" << checkpointType << "', expected: ASCII|binary." << endl; + global_log->error() << "Unknown CheckpointWriter type '" << checkpointType << "', expected: ASCII|binary." << std::endl; Simulation::exit(-1); } _outputPrefix = "mardyn"; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "Output prefix: " << _outputPrefix << endl; + global_log->info() << "Output prefix: " << _outputPrefix << std::endl; int incremental = 1; xmlconfig.getNodeValue("incremental", incremental); _incremental = (incremental != 0); - global_log->info() << "Incremental numbers: " << _incremental << endl; + global_log->info() << "Incremental numbers: " << _incremental << std::endl; int appendTimestamp = 0; xmlconfig.getNodeValue("appendTimestamp", appendTimestamp); @@ -53,7 +50,7 @@ void CheckpointWriter::readXML(XMLfileUnits& xmlconfig) { }else{ _appendTimestamp = false; } - global_log->info() << "Append timestamp: " << _appendTimestamp << endl; + global_log->info() << "Append timestamp: " << _appendTimestamp << std::endl; } void CheckpointWriter::init(ParticleContainer * /*particleContainer*/, DomainDecompBase * /*domainDecomp*/, @@ -62,7 +59,7 @@ void CheckpointWriter::init(ParticleContainer * /*particleContainer*/, DomainDec void CheckpointWriter::endStep(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain, unsigned long simstep) { if( simstep % _writeFrequency == 0 ) { - stringstream filenamestream; + std::stringstream filenamestream; filenamestream << _outputPrefix; if(_incremental) { @@ -81,7 +78,7 @@ void CheckpointWriter::endStep(ParticleContainer *particleContainer, DomainDecom filenamestream << ".restart.dat"; } - string filename = filenamestream.str(); + std::string filename = filenamestream.str(); domain->writeCheckpoint(filename, particleContainer, domainDecomp, _simulation.getSimulationTime(), _useBinaryFormat); } } diff --git a/src/io/CommunicationPartnerWriter.cpp b/src/io/CommunicationPartnerWriter.cpp index c574799ccf..b6d9ea9f70 100644 --- a/src/io/CommunicationPartnerWriter.cpp +++ b/src/io/CommunicationPartnerWriter.cpp @@ -8,17 +8,14 @@ #include "utils/Logger.h" #include "parallel/DomainDecompBase.h" -using Log::global_log; -using namespace std; - void CommunicationPartnerWriter::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << endl; + global_log->info() << "Write frequency: " << _writeFrequency << std::endl; if(_writeFrequency == 0) { - global_log->error() << "Write frequency must be a positive nonzero integer, but is " << _writeFrequency << endl; + global_log->error() << "Write frequency must be a positive nonzero integer, but is " << _writeFrequency << std::endl; Simulation::exit(-1); } @@ -27,12 +24,12 @@ void CommunicationPartnerWriter::readXML(XMLfileUnits& xmlconfig) { _outputPrefix = "mardyn"; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "Output prefix: " << _outputPrefix << endl; + global_log->info() << "Output prefix: " << _outputPrefix << std::endl; int incremental = 1; xmlconfig.getNodeValue("incremental", incremental); _incremental = (incremental != 0); - global_log->info() << "Incremental numbers: " << _incremental << endl; + global_log->info() << "Incremental numbers: " << _incremental << std::endl; int appendTimestamp = 0; xmlconfig.getNodeValue("appendTimestamp", appendTimestamp); @@ -41,7 +38,7 @@ void CommunicationPartnerWriter::readXML(XMLfileUnits& xmlconfig) { }else{ _appendTimestamp = false; } - global_log->info() << "Append timestamp: " << _appendTimestamp << endl; + global_log->info() << "Append timestamp: " << _appendTimestamp << std::endl; } void CommunicationPartnerWriter::init(ParticleContainer * /*particleContainer*/, DomainDecompBase * /*domainDecomp*/, @@ -50,7 +47,7 @@ void CommunicationPartnerWriter::init(ParticleContainer * /*particleContainer*/, void CommunicationPartnerWriter::afterForces(ParticleContainer *particleContainer, DomainDecompBase* domainDecomp, unsigned long simstep) { if( simstep % _writeFrequency == 0 ) { - stringstream filenamestream; + std::stringstream filenamestream; filenamestream << _outputPrefix << "-rank" << domainDecomp->getRank(); if(_incremental) { @@ -65,7 +62,7 @@ void CommunicationPartnerWriter::afterForces(ParticleContainer *particleContaine filenamestream << ".commPartners.dat"; - string filename = filenamestream.str(); + std::string filename = filenamestream.str(); domainDecomp->printCommunicationPartners(filename); diff --git a/src/io/DecompWriter.cpp b/src/io/DecompWriter.cpp index 3e83c70d0b..8dfb4a6989 100644 --- a/src/io/DecompWriter.cpp +++ b/src/io/DecompWriter.cpp @@ -11,9 +11,6 @@ #include "Simulation.h" #include "utils/Logger.h" -using Log::global_log; -using namespace std; - DecompWriter::DecompWriter() : _writeFrequency(1), _appendTimestamp(false), _incremental(true), _outputPrefix("mardyn") @@ -22,21 +19,21 @@ DecompWriter::DecompWriter() : void DecompWriter::readXML(XMLfileUnits& xmlconfig) { xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << endl; + global_log->info() << "Write frequency: " << _writeFrequency << std::endl; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "Output prefix: " << _outputPrefix << endl; + global_log->info() << "Output prefix: " << _outputPrefix << std::endl; int incremental = 1; xmlconfig.getNodeValue("incremental", incremental); _incremental = (incremental != 0); - global_log->info() << "Incremental numbers: " << _incremental << endl; + global_log->info() << "Incremental numbers: " << _incremental << std::endl; int appendTimestamp = 0; xmlconfig.getNodeValue("appendTimestamp", appendTimestamp); if(appendTimestamp > 0) { _appendTimestamp = true; } - global_log->info() << "Append timestamp: " << _appendTimestamp << endl; + global_log->info() << "Append timestamp: " << _appendTimestamp << std::endl; } @@ -46,7 +43,7 @@ void DecompWriter::init(ParticleContainer * /*particleContainer*/, DomainDecompB void DecompWriter::endStep(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain, unsigned long simstep) { if(simstep % _writeFrequency == 0) { - stringstream filenamestream; + std::stringstream filenamestream; filenamestream << _outputPrefix; if(_incremental) { /* align file numbers with preceding '0's in the required range from 0 to _numberOfTimesteps. */ diff --git a/src/io/EnergyLogWriter.cpp b/src/io/EnergyLogWriter.cpp index 96a56050a4..df879d1ef2 100644 --- a/src/io/EnergyLogWriter.cpp +++ b/src/io/EnergyLogWriter.cpp @@ -7,10 +7,9 @@ #include "particleContainer/ParticleContainer.h" #include "utils/xmlfileUnits.h" -using namespace std; void EnergyLogWriter::init(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain) { - global_log->info() << "Init global energy log." << endl; + global_log->info() << "Init global energy log." << std::endl; #ifdef ENABLE_MPI int rank = domainDecomp->getRank(); @@ -22,7 +21,7 @@ void EnergyLogWriter::init(ParticleContainer *particleContainer, DomainDecompBas std::stringstream outputstream; outputstream.write(reinterpret_cast(&_writeFrequency), 8); - ofstream fileout(_outputFilename, std::ios::out | std::ios::binary); + std::ofstream fileout(_outputFilename, std::ios::out | std::ios::binary); fileout << outputstream.str(); fileout.close(); } @@ -30,10 +29,10 @@ void EnergyLogWriter::init(ParticleContainer *particleContainer, DomainDecompBas void EnergyLogWriter::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << endl; + global_log->info() << "Write frequency: " << _writeFrequency << std::endl; _outputFilename = "global_energy.log"; xmlconfig.getNodeValue("outputfilename", _outputFilename); - global_log->info() << "Output filename: " << _outputFilename << endl; + global_log->info() << "Output filename: " << _outputFilename << std::endl; } void EnergyLogWriter::endStep(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain, @@ -92,7 +91,7 @@ void EnergyLogWriter::endStep(ParticleContainer *particleContainer, DomainDecomp outputstream.write(reinterpret_cast(&globalT), 8); outputstream.write(reinterpret_cast(&globalPressure), 8); - ofstream fileout(_outputFilename, std::ios::app | std::ios::binary); + std::ofstream fileout(_outputFilename, std::ios::app | std::ios::binary); fileout << outputstream.str(); fileout.close(); } diff --git a/src/io/FlopRateWriter.cpp b/src/io/FlopRateWriter.cpp index b4ebd2bcf7..15adfce151 100644 --- a/src/io/FlopRateWriter.cpp +++ b/src/io/FlopRateWriter.cpp @@ -25,23 +25,23 @@ void FlopRateWriter::readXML(XMLfileUnits& xmlconfig) { _writeToStdout = true; _writeToFile = true; } else { - global_log->error() << "Unknown FlopRateOutputPlugin::mode. Choose \"stdout\", \"file\" or \"both\"." << endl; + global_log->error() << "Unknown FlopRateOutputPlugin::mode. Choose \"stdout\", \"file\" or \"both\"." << std::endl; } _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << endl; + global_log->info() << "Write frequency: " << _writeFrequency << std::endl; // TODO: if(_writeToFile) { - global_log->error() << "TODO: file output not yet supported." << endl; + global_log->error() << "TODO: file output not yet supported." << std::endl; Simulation::exit(1); } if(_writeToFile) { _outputPrefix = "mardyn"; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "Output prefix: " << _outputPrefix << endl; + global_log->info() << "Output prefix: " << _outputPrefix << std::endl; } } @@ -52,12 +52,12 @@ void FlopRateWriter::init(ParticleContainer * /*particleContainer*/, return; // initialize result file - string resultfile(_outputPrefix+".res"); + std::string resultfile(_outputPrefix+".res"); const auto now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); tm unused{}; if(domainDecomp->getRank()==0){ _fileStream.open(resultfile.c_str()); - _fileStream << "# ls1 MarDyn simulation started at " << std::put_time(localtime_r(&now, &unused), "%c") << endl; + _fileStream << "# ls1 MarDyn simulation started at " << std::put_time(localtime_r(&now, &unused), "%c") << std::endl; _fileStream << "#step\tt\t\tFLOP-Count\tFLOP-Rate-force\t\tFLOP-Rate-loop\tefficiency(%)\t\n"; } } @@ -102,10 +102,10 @@ void FlopRateWriter::endStep(ParticleContainer *particleContainer, setPrefix(flop_rate_loop, flop_rate_loop_normalized, prefix_flop_rate_loop); if(_writeToStdout) { - global_log->info() << "FlopRateWriter (simulation step " << simstep << ")" << endl - << "\tFLOP-Count per Iteration : " << flops_normalized << " " << prefix_flops << "FLOPs" << endl - << "\tFLOP-rate in force calculation : " << flop_rate_force_normalized << " " << prefix_flop_rate_force << "FLOP/sec" << endl - << "\tFLOP-rate for main loop : " << flop_rate_loop_normalized << " " << prefix_flop_rate_loop << "FLOP/sec (" << percentage << " %)" << endl; + global_log->info() << "FlopRateWriter (simulation step " << simstep << ")" << std::endl + << "\tFLOP-Count per Iteration : " << flops_normalized << " " << prefix_flops << "FLOPs" << std::endl + << "\tFLOP-rate in force calculation : " << flop_rate_force_normalized << " " << prefix_flop_rate_force << "FLOP/sec" << std::endl + << "\tFLOP-rate for main loop : " << flop_rate_loop_normalized << " " << prefix_flop_rate_loop << "FLOP/sec (" << percentage << " %)" << std::endl; _flopCounter->printStats(); } @@ -121,7 +121,7 @@ void FlopRateWriter::finish(ParticleContainer *particleContainer, const auto now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); tm unused{}; - _fileStream << "# ls1 mardyn simulation finished at " << std::put_time(localtime_r(&now, &unused), "%c") << endl; + _fileStream << "# ls1 mardyn simulation finished at " << std::put_time(localtime_r(&now, &unused), "%c") << std::endl; _fileStream << "# \n# Please address your questions and suggestions to the ls1 mardyn contact point:\n# \n# E-mail: contact@ls1-mardyn.de\n# \n# Phone: +49 631 205 3227\n# University of Kaiserslautern\n# Computational Molecular Engineering\n# Erwin-Schroedinger-Str. 44\n# D-67663 Kaiserslautern, Germany\n# \n# http://www.ls1-mardyn.de/\n"; _fileStream.close(); diff --git a/src/io/GammaWriter.cpp b/src/io/GammaWriter.cpp index f362a1d7ab..476c0bba91 100644 --- a/src/io/GammaWriter.cpp +++ b/src/io/GammaWriter.cpp @@ -36,12 +36,12 @@ void GammaWriter::init(ParticleContainer *particleContainer, DomainDecompBase *d // Rank 0 writes data to file if (domainDecomp->getRank() == 0) { - string resultfilename(_outputPrefix + ".dat"); + std::string resultfilename(_outputPrefix + ".dat"); _gammaStream.open(resultfilename); _gammaStream.precision(6); - _gammaStream << setw(24) << "simstep"; + _gammaStream << std::setw(24) << "simstep"; for (unsigned int componentId = 0; componentId < _numComp; ++componentId) { - _gammaStream << setw(22) << "gamma[" << componentId << "]"; + _gammaStream << std::setw(22) << "gamma[" << componentId << "]"; } _gammaStream << std::endl; _gammaStream.close(); @@ -57,7 +57,7 @@ void GammaWriter::endStep(ParticleContainer *particleContainer, DomainDecompBase if ((simstep % _writeFrequency == 0) && (simstep > global_simulation->getNumInitTimesteps())) { // Rank 0 writes data to file if (domainDecomp->getRank() == 0) { - string resultfilename(_outputPrefix + ".dat"); + std::string resultfilename(_outputPrefix + ".dat"); _gammaStream.open(resultfilename, std::ios::app); _gammaStream << FORMAT_SCI_MAX_DIGITS << simstep; diff --git a/src/io/HaloParticleWriter.cpp b/src/io/HaloParticleWriter.cpp index 6dd1111b06..fae17f980c 100644 --- a/src/io/HaloParticleWriter.cpp +++ b/src/io/HaloParticleWriter.cpp @@ -8,17 +8,14 @@ #include "utils/Logger.h" #include "parallel/DomainDecompBase.h" -using Log::global_log; -using namespace std; - void HaloParticleWriter::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << endl; + global_log->info() << "Write frequency: " << _writeFrequency << std::endl; if(_writeFrequency == 0) { - global_log->error() << "Write frequency must be a positive nonzero integer, but is " << _writeFrequency << endl; + global_log->error() << "Write frequency must be a positive nonzero integer, but is " << _writeFrequency << std::endl; Simulation::exit(-1); } @@ -27,17 +24,17 @@ void HaloParticleWriter::readXML(XMLfileUnits& xmlconfig) { _outputPrefix = "mardyn"; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "Output prefix: " << _outputPrefix << endl; + global_log->info() << "Output prefix: " << _outputPrefix << std::endl; _incremental = true; xmlconfig.getNodeValue("incremental", _incremental); - global_log->info() << "Incremental numbers: " << _incremental << endl; + global_log->info() << "Incremental numbers: " << _incremental << std::endl; _appendTimestamp = false; xmlconfig.getNodeValue("appendTimestamp", _appendTimestamp); - global_log->info() << "Append timestamp: " << _appendTimestamp << endl; + global_log->info() << "Append timestamp: " << _appendTimestamp << std::endl; } void HaloParticleWriter::init(ParticleContainer * /*particleContainer*/, DomainDecompBase * /*domainDecomp*/, @@ -46,7 +43,7 @@ void HaloParticleWriter::init(ParticleContainer * /*particleContainer*/, DomainD void HaloParticleWriter::afterForces(ParticleContainer *particleContainer, DomainDecompBase* domainDecomp, unsigned long simstep) { if( simstep % _writeFrequency == 0 ) { - stringstream filenamestream; + std::stringstream filenamestream; filenamestream << _outputPrefix << "-rank" << domainDecomp->getRank(); if(_incremental) { @@ -61,7 +58,7 @@ void HaloParticleWriter::afterForces(ParticleContainer *particleContainer, Domai filenamestream << ".halos.dat"; - string filename = filenamestream.str(); + std::string filename = filenamestream.str(); //global_simulation->getDomain()->writeCheckpoint(filename, particleContainer, domainDecomp, _simulation.getSimulationTime(), false); double rmin[3],rmax[3]; diff --git a/src/io/LoadBalanceWriter.cpp b/src/io/LoadBalanceWriter.cpp index f587fcc2cf..d94dfa00e7 100644 --- a/src/io/LoadBalanceWriter.cpp +++ b/src/io/LoadBalanceWriter.cpp @@ -17,11 +17,11 @@ LoadbalanceWriter::LoadbalanceWriter::LoadbalanceWriter() : void LoadbalanceWriter::readXML(XMLfileUnits& xmlconfig) { xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << endl; + global_log->info() << "Write frequency: " << _writeFrequency << std::endl; xmlconfig.getNodeValue("averageLength", _averageLength); - global_log->info() << "Average length: " << _averageLength << endl; + global_log->info() << "Average length: " << _averageLength << std::endl; xmlconfig.getNodeValue("outputfilename", _outputFilename); - global_log->info() << "Output filename: " << _outputFilename << endl; + global_log->info() << "Output filename: " << _outputFilename << std::endl; XMLfile::Query query = xmlconfig.query("timers/timer"); std::string oldpath = xmlconfig.getcurrentnodepath(); @@ -57,7 +57,7 @@ void LoadbalanceWriter::init(ParticleContainer */*particleContainer*/, // memory of this timer is managed by TimerProfiler. _defaultTimer = new Timer(); - global_simulation->timers()->registerTimer(default_timer_name, vector{"SIMULATION"}, _defaultTimer); + global_simulation->timers()->registerTimer(default_timer_name, std::vector{"SIMULATION"}, _defaultTimer); _timerNames.push_back(default_timer_name); size_t timestep_entry_offset = 2 * _timerNames.size(); @@ -92,7 +92,7 @@ void LoadbalanceWriter::endStep( _defaultTimer->reset(); if((simstep % _writeFrequency) == 0) { - flush(domainDecomp); + LoadbalanceWriter::flush(domainDecomp); } _defaultTimer->start(); } diff --git a/src/io/MPICheckpointWriter.cpp b/src/io/MPICheckpointWriter.cpp index 8e0d58ecbd..1dbd780075 100644 --- a/src/io/MPICheckpointWriter.cpp +++ b/src/io/MPICheckpointWriter.cpp @@ -23,8 +23,6 @@ #include "parallel/ParticleData.h" #endif -using Log::global_log; -using namespace std; extern Simulation* global_simulation; @@ -32,7 +30,7 @@ const char MPICheckpointWriter::_magicVersion[] = "MarDyn20150211trunk"; // int32_t const int MPICheckpointWriter::_endiannesstest = 0x0a0b0c0d; -MPICheckpointWriter::MPICheckpointWriter(unsigned long writeFrequency, string outputPrefix, bool incremental, string datarep) +MPICheckpointWriter::MPICheckpointWriter(unsigned long writeFrequency, std::string outputPrefix, bool incremental, std::string datarep) : _outputPrefix(outputPrefix), _writeFrequency(writeFrequency), _incremental(incremental), _appendTimestamp(false), _datarep(datarep) { if (outputPrefix == "") @@ -49,11 +47,11 @@ void MPICheckpointWriter::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "[MPICheckpointWriter]\twrite frequency: " << _writeFrequency << endl; + global_log->info() << "[MPICheckpointWriter]\twrite frequency: " << _writeFrequency << std::endl; _outputPrefix = "mardyn"; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "[MPICheckpointWriter]\toutput prefix: " << _outputPrefix << endl; + global_log->info() << "[MPICheckpointWriter]\toutput prefix: " << _outputPrefix << std::endl; _incremental = false; int incremental = 1; @@ -61,7 +59,7 @@ void MPICheckpointWriter::readXML(XMLfileUnits& xmlconfig) //_incremental = (incremental != 0); if(incremental > 0) { _incremental = true; - global_log->info() << "[MPICheckpointWriter]\tusing incremental numbers in file names" << endl; + global_log->info() << "[MPICheckpointWriter]\tusing incremental numbers in file names" << std::endl; } _appendTimestamp = false; @@ -70,14 +68,14 @@ void MPICheckpointWriter::readXML(XMLfileUnits& xmlconfig) //_appendTimestamp = (appendTimestamp != 0); if(appendTimestamp > 0) { _appendTimestamp = true; - global_log->info() << "[MPICheckpointWriter]\tappend timestamp to file names" << endl; + global_log->info() << "[MPICheckpointWriter]\tappend timestamp to file names" << std::endl; } _datarep = ""; // -> NULL //_datarep = "external32"; // "native", "internal", "external32" xmlconfig.getNodeValue("datarep", _datarep); if(!_datarep.empty()) - global_log->info() << "[MPICheckpointWriter]\tdata representation: " << _datarep << endl; + global_log->info() << "[MPICheckpointWriter]\tdata representation: " << _datarep << std::endl; _measureTime = false; int measureTime = 0; @@ -85,15 +83,15 @@ void MPICheckpointWriter::readXML(XMLfileUnits& xmlconfig) //_measureTime = (measureTime != 0); if(measureTime > 0) { _measureTime = true; - global_log->info() << "[MPICheckpointWriter]\texecution wall time will be measured" << endl; + global_log->info() << "[MPICheckpointWriter]\texecution wall time will be measured" << std::endl; } if(xmlconfig.changecurrentnode("mpi_info")) { #ifdef ENABLE_MPI - global_log->info() << "[MPICheckpointWriter] Setting MPI info object for IO" << endl; + global_log->info() << "[MPICheckpointWriter] Setting MPI info object for IO" << std::endl; _mpiinfo.readXML(xmlconfig); #else - global_log->info() << "[MPICheckpointWriter] mpi_info only used in parallel/MPI version" << endl; + global_log->info() << "[MPICheckpointWriter] mpi_info only used in parallel/MPI version" << std::endl; #endif xmlconfig.changecurrentnode(".."); } @@ -103,9 +101,9 @@ void MPICheckpointWriter::readXML(XMLfileUnits& xmlconfig) if(_particlesbuffersize) { #ifdef ENABLE_MPI - global_log->info() << "[MPICheckpointWriter]\tparticles buffer size: " << _particlesbuffersize << endl; + global_log->info() << "[MPICheckpointWriter]\tparticles buffer size: " << _particlesbuffersize << std::endl; #else - global_log->info() << "[MPICheckpointWriter]\tparticles buffer size (" << _particlesbuffersize << ") only used in parallel/MPI version" << endl; + global_log->info() << "[MPICheckpointWriter]\tparticles buffer size (" << _particlesbuffersize << ") only used in parallel/MPI version" << std::endl; #endif } } @@ -115,7 +113,7 @@ void MPICheckpointWriter::init(ParticleContainer * /*particleContainer*/, Domain { if(_incremental && _appendTimestamp) { // use the same timestamp for all increments: add it to the outputPrefix - stringstream outputPrefixstream; + std::stringstream outputPrefixstream; outputPrefixstream << _outputPrefix; char fmt[] = "%Y%m%dT%H%M%S"; // must have fixed size format for all time values/processes char timestring[256]; @@ -126,7 +124,7 @@ void MPICheckpointWriter::init(ParticleContainer * /*particleContainer*/, Domain #else gettimestr(fmt, timestring, sizeof(timestring)/sizeof(timestring[0])); #endif - outputPrefixstream << "_" << string(timestring); + outputPrefixstream << "_" << std::string(timestring); _outputPrefix = outputPrefixstream.str(); } } @@ -139,7 +137,7 @@ void MPICheckpointWriter::endStep(ParticleContainer *particleContainer, DomainDe #endif if( simstep % _writeFrequency == 0 ) { - stringstream filenamestream; + std::stringstream filenamestream; filenamestream << _outputPrefix; if(_incremental) @@ -160,12 +158,12 @@ void MPICheckpointWriter::endStep(ParticleContainer *particleContainer, DomainDe #else gettimestr(fmt, timestring, sizeof(timestring)/sizeof(timestring[0])); #endif - filenamestream << "_" << string(timestring); + filenamestream << "_" << std::string(timestring); } filenamestream << ".MPIrestart.dat"; - string filename = filenamestream.str(); - global_log->info() << "[MPICheckpointWriter]\tfilename: " << filename << endl; + std::string filename = filenamestream.str(); + global_log->info() << "[MPICheckpointWriter]\tfilename: " << filename << std::endl; unsigned long numParticles_global = domain->getglobalNumMolecules(true, particleContainer, domainDecomp); unsigned long numParticles = particleContainer->getNumberOfParticles(); // local @@ -173,7 +171,7 @@ void MPICheckpointWriter::endStep(ParticleContainer *particleContainer, DomainDe #ifdef ENABLE_MPI global_log->info() << "[MPICheckpointWriter]\tnumber of particles: " << numParticles_global << "\t(*" << sizeof(ParticleData) << "=" << numParticles_global*sizeof(ParticleData) << " Bytes in memory)" - << endl; + << std::endl; //global_log->set_mpi_output_all() int num_procs; MPI_CHECK( MPI_Comm_size(MPI_COMM_WORLD, &num_procs) ); @@ -183,7 +181,7 @@ void MPICheckpointWriter::endStep(ParticleContainer *particleContainer, DomainDe double mpistarttime=0; // =0 to prevent Jenkins/gcc complaining about uninitialized mpistarttime [-Werror=uninitialized] if(_measureTime) { - //if(ownrank==0) global_log->debug() << "MPICheckpointWriter (" << filename << ")\tstart measuring time" << endl; + //if(ownrank==0) global_log->debug() << "MPICheckpointWriter (" << filename << ")\tstart measuring time" << std::endl; MPI_CHECK( MPI_Barrier(MPI_COMM_WORLD) ); mpistarttime=MPI_Wtime(); // global_simulation->timers()->start("MPI_CHECKPOINT_WRITER_INPUT"); // should use Timer instead @@ -257,7 +255,7 @@ void MPICheckpointWriter::endStep(ParticleContainer *particleContainer, DomainDe global_log->debug() << "[MPICheckpointWriter](" << ownrank << ")\tBB " << ":\t" << bbmin[0] << ", " << bbmin[1] << ", " << bbmin[2] << " - " << bbmax[0] << ", " << bbmax[1] << ", " << bbmax[2] - << "\tstarting index=" << startidx << " numParticles=" << numParticles << endl; + << "\tstarting index=" << startidx << " numParticles=" << numParticles << std::endl; // MPI_Datatype mpidtParticleM, mpidtParticleD; ParticleData::getMPIType(mpidtParticleM); @@ -275,19 +273,19 @@ void MPICheckpointWriter::endStep(ParticleContainer *particleContainer, DomainDe */ mpioffset=64+gap+startidx*mpidtParticleMsize; MPI_CHECK( MPI_File_set_view(mpifh, mpioffset, mpidtParticleM, mpidtParticleM, const_cast(mpidatarep), _mpiinfo) ); // arg 5 type cast due to old MPI (<=V2) implementations (should be const char* now) - global_log->debug() << "[MPICheckpointWriter](" << ownrank << ")\twriting molecule data for " << numParticles << " particles of size " << mpidtParticleDts << endl; + global_log->debug() << "[MPICheckpointWriter](" << ownrank << ")\twriting molecule data for " << numParticles << " particles of size " << mpidtParticleDts << std::endl; //unsigned long writecounter=0; if(_particlesbuffersize>0) { ParticleData* particleStructBuffer=new ParticleData[_particlesbuffersize]; unsigned long bufidx=0; for (auto pos = particleContainer->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); pos.isValid(); ++pos) { - //global_log->debug() << "MPICheckpointWriter[" << ownrank << "]\t" << pos->getID() << "\t" << pos->componentid() << "\t" << pos->r(0) << "," << pos->r(1) << "," << pos->r(2) << endl; + //global_log->debug() << "MPICheckpointWriter[" << ownrank << "]\t" << pos->getID() << "\t" << pos->componentid() << "\t" << pos->r(0) << "," << pos->r(1) << "," << pos->r(2) << std::endl; ParticleData::MoleculeToParticleData(particleStructBuffer[bufidx], *pos); ++bufidx; if(bufidx==_particlesbuffersize) { - //global_log->debug() << "MPICheckpointWriter[" << ownrank << "]\twriting" << _particlesbuffersize << " particles" << endl + //global_log->debug() << "MPICheckpointWriter[" << ownrank << "]\twriting" << _particlesbuffersize << " particles" << std::endl MPI_CHECK( MPI_File_write(mpifh, particleStructBuffer, _particlesbuffersize, mpidtParticleD, &mpistat) ); //++writecounter; bufidx=0; @@ -295,7 +293,7 @@ void MPICheckpointWriter::endStep(ParticleContainer *particleContainer, DomainDe } if(bufidx>0) { - //global_log->debug() << "MPICheckpointWriter[" << ownrank << "]\twriting" << bufidx << " particles" << endl + //global_log->debug() << "MPICheckpointWriter[" << ownrank << "]\twriting" << bufidx << " particles" << std::endl MPI_CHECK( MPI_File_write(mpifh, particleStructBuffer, bufidx, mpidtParticleD, &mpistat) ); //++writecounter; } @@ -305,9 +303,9 @@ void MPICheckpointWriter::endStep(ParticleContainer *particleContainer, DomainDe { ParticleData particleStruct; for (auto pos = particleContainer->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); pos.isValid(); ++pos) { - //global_log->debug() << "MPICheckpointWriter[" << ownrank << "]\t" << pos->getID() << "\t" << pos->componentid() << "\t" << pos->r(0) << "," << pos->r(1) << "," << pos->r(2) << endl; + //global_log->debug() << "MPICheckpointWriter[" << ownrank << "]\t" << pos->getID() << "\t" << pos->componentid() << "\t" << pos->r(0) << "," << pos->r(1) << "," << pos->r(2) << std::endl; ParticleData::MoleculeToParticleData(particleStruct, *pos); - //global_log->debug() << "MPICheckpointWriter[" << ownrank << "]\twriting particle" << endl + //global_log->debug() << "MPICheckpointWriter[" << ownrank << "]\twriting particle" << std::endl MPI_CHECK( MPI_File_write(mpifh, &particleStruct, 1, mpidtParticleD, &mpistat) ); //++writecounter; // saving a struct directly will also save padding zeros... @@ -325,25 +323,25 @@ void MPICheckpointWriter::endStep(ParticleContainer *particleContainer, DomainDe if(ownrank==0) global_log->info() << "[MPICheckpointWriter]\tmeasured time: " << mpimeasuredtime << " sec (par., " << num_procs << " proc.; " << numParticles_global << "*" << mpidtParticleDts << "=" << numParticles_global*mpidtParticleDts << " Bytes)" - << endl; + << std::endl; } #else global_log->info() << "[MPICheckpointWriter]\tnumber of particles: " << numParticles_global << "\t(*" << 2*sizeof(unsigned long)+13*sizeof(double) << "=" << numParticles_global*(2*sizeof(unsigned long)+13*sizeof(double)) << " Bytes in memory)" - << endl; + << std::endl; unsigned long gap=7+3+sizeof(unsigned long)+(6*sizeof(double)+2*sizeof(unsigned long)); unsigned int i; unsigned int offset=0; - if (!_datarep.empty()) global_log->warning() << "[MPICheckpointWriter]\tsetting data representation (" << _datarep << ") is not supported (yet) in sequential version" << endl; + if (!_datarep.empty()) global_log->warning() << "[MPICheckpointWriter]\tsetting data representation (" << _datarep << ") is not supported (yet) in sequential version" << std::endl; // should use Timer instead struct timeval tod_start; if(_measureTime) { - //global_log->debug() << "MPICheckpointWriter (" << filename << ")\tstart measuring time" << endl; + //global_log->debug() << "MPICheckpointWriter (" << filename << ")\tstart measuring time" << std::endl; gettimeofday( &tod_start, NULL ); // global_simulation->timers()->start("MPI_CHECKPOINT_WRITER_INPUT"); } // - ofstream ostrm(filename.c_str(),ios::out|ios::binary); + std::ofstream ostrm(filename.c_str(),std::ios::out|std::ios::binary); ostrm << _magicVersion; offset+=strlen(_magicVersion); for(i=0;i<64-offset-sizeof(unsigned long)-sizeof(int);++i) ostrm << '\0'; @@ -398,7 +396,7 @@ void MPICheckpointWriter::endStep(ParticleContainer *particleContainer, DomainDe double measuredtime=(double)(tod_end.tv_sec-tod_start.tv_sec)+(double)(tod_end.tv_usec-tod_start.tv_usec)/1.E6; // global_simulation->timers()->stop("MPI_CHECKPOINT_WRITER_INPUT"); // double measuredtime=global_simulation->timers()->getTime("MPI_CHECKPOINT_WRITER_INPUT"); - global_log->info() << "[MPICheckpointWriter]\tmeasured time: " << measuredtime << " sec (seq.)" << endl; + global_log->info() << "[MPICheckpointWriter]\tmeasured time: " << measuredtime << " sec (seq.)" << std::endl; } #endif } diff --git a/src/io/MPI_IOCheckpointWriter.cpp b/src/io/MPI_IOCheckpointWriter.cpp index 0b390a9aef..73edf3d996 100644 --- a/src/io/MPI_IOCheckpointWriter.cpp +++ b/src/io/MPI_IOCheckpointWriter.cpp @@ -28,7 +28,6 @@ #include "particleContainer/Cell.h" #include -using Log::global_log; MPI_IOCheckpointWriter::MPI_IOCheckpointWriter(unsigned long writeFrequency, std::string outputPrefix, bool incremental) { @@ -107,8 +106,8 @@ void MPI_IOCheckpointWriter::endStep(ParticleContainer *particleContainer, Domai long realLocalNumCells = boxCellDimension[0]*boxCellDimension[1]*boxCellDimension[2]; long realGlobalNumCells = 0; MPI_Allreduce(&realLocalNumCells, &realGlobalNumCells, 1, MPI_LONG, MPI_SUM, MPI_COMM_WORLD); - cout << "Rank: " << domainDecomp->getRank() << " realGlobalNumCells: " << realGlobalNumCells << std::endl; - cout << "Rank: " << domainDecomp->getRank() << " BoundingBoxMin: " << domainDecomp->getBoundingBoxMin(0, domain) << "," << domainDecomp->getBoundingBoxMin(1, domain) << "," << domainDecomp->getBoundingBoxMin(2, domain) << " BoundingBoxMax: " << domainDecomp->getBoundingBoxMax(0, domain) << "," << domainDecomp->getBoundingBoxMax(1, domain) << "," << domainDecomp->getBoundingBoxMax(2, domain) << std::endl; + std::cout << "Rank: " << domainDecomp->getRank() << " realGlobalNumCells: " << realGlobalNumCells << std::endl; + std::cout << "Rank: " << domainDecomp->getRank() << " BoundingBoxMin: " << domainDecomp->getBoundingBoxMin(0, domain) << "," << domainDecomp->getBoundingBoxMin(1, domain) << "," << domainDecomp->getBoundingBoxMin(2, domain) << " BoundingBoxMax: " << domainDecomp->getBoundingBoxMax(0, domain) << "," << domainDecomp->getBoundingBoxMax(1, domain) << "," << domainDecomp->getBoundingBoxMax(2, domain) << std::endl; domainDecomp->getBoundingBoxMin(0, domain); */ diff --git a/src/io/MPI_IOReader.cpp b/src/io/MPI_IOReader.cpp index 5bb19e0c3a..9761c415b7 100644 --- a/src/io/MPI_IOReader.cpp +++ b/src/io/MPI_IOReader.cpp @@ -32,8 +32,6 @@ //#include -using Log::global_log; -using namespace std; MPI_IOReader::MPI_IOReader() { // TODO Auto-generated constructor stub @@ -44,42 +42,42 @@ MPI_IOReader::~MPI_IOReader() { // TODO Auto-generated destructor stub } -void MPI_IOReader::setPhaseSpaceFile(string filename) { +void MPI_IOReader::setPhaseSpaceFile(std::string filename) { _phaseSpaceFile = filename; } -void MPI_IOReader::setPhaseSpaceHeaderFile(string filename) { +void MPI_IOReader::setPhaseSpaceHeaderFile(std::string filename) { _phaseSpaceHeaderFile = filename; } void MPI_IOReader::readPhaseSpaceHeader(Domain* domain, double timestep) { - string token, token2; + std::string token, token2; - global_log->info() << "Opening phase space header file " << _phaseSpaceHeaderFile << endl; + global_log->info() << "Opening phase space header file " << _phaseSpaceHeaderFile << std::endl; _phaseSpaceHeaderFileStream.open(_phaseSpaceHeaderFile.c_str()); _phaseSpaceHeaderFileStream >> token; if(token != "mardyn") { - global_log->error() << _phaseSpaceHeaderFile << " not a valid mardyn input file." << endl; + global_log->error() << _phaseSpaceHeaderFile << " not a valid mardyn input file." << std::endl; Simulation::exit(1); } - string inputversion; + std::string inputversion; _phaseSpaceHeaderFileStream >> token >> inputversion; // FIXME: remove tag trunk from file specification? if(token != "trunk") { - global_log->error() << "Wrong input file specifier (\'" << token << "\' instead of \'trunk\')." << endl; + global_log->error() << "Wrong input file specifier (\'" << token << "\' instead of \'trunk\')." << std::endl; Simulation::exit(1); } if(strtoul(inputversion.c_str(), NULL, 0) < 20080701) { - global_log->error() << "Input version tool old (" << inputversion << ")" << endl; + global_log->error() << "Input version tool old (" << inputversion << ")" << std::endl; Simulation::exit(1); } - global_log->info() << "Reading phase space header from file " << _phaseSpaceHeaderFile << endl; + global_log->info() << "Reading phase space header from file " << _phaseSpaceHeaderFile << std::endl; - vector& dcomponents = *(_simulation.getEnsemble()->getComponents()); + std::vector& dcomponents = *(_simulation.getEnsemble()->getComponents()); bool header = true; // When the last header element is reached, "header" is set to false while(header) { @@ -94,7 +92,7 @@ void MPI_IOReader::readPhaseSpaceHeader(Domain* domain, double timestep) { token.clear(); _phaseSpaceHeaderFileStream >> token; - global_log->info() << "{{" << token << "}}" << endl; + global_log->info() << "{{" << token << "}}" << std::endl; if((token == "currentTime") || (token == "t")) { // set current simulation time @@ -108,7 +106,7 @@ void MPI_IOReader::readPhaseSpaceHeader(Domain* domain, double timestep) { domain->setGlobalTemperature(targetT); } else if((token == "MoleculeFormat") || (token == "M")) { - string ntypestring("ICRVQD"); + std::string ntypestring("ICRVQD"); _phaseSpaceFileStream >> ntypestring; ntypestring.erase(ntypestring.find_last_not_of(" \t\n") + 1); @@ -117,11 +115,11 @@ void MPI_IOReader::readPhaseSpaceHeader(Domain* domain, double timestep) { if(!(ntypestring == "ICRVQD" || ntypestring == "ICRV" || ntypestring == "IRV")) { global_log->error() << "Unknown molecule format: '" - << ntypestring << "'" << endl; + << ntypestring << "'" << std::endl; Simulation::exit(1); } _moleculeFormat = ntypestring; - global_log->info() << " molecule format: " << ntypestring << endl; + global_log->info() << " molecule format: " << ntypestring << std::endl; header = false; } else if((token == "ThermostatTemperature") || (token == "ThT") || (token == "h")) { // set up a new thermostat @@ -170,10 +168,10 @@ void MPI_IOReader::readPhaseSpaceHeader(Domain* domain, double timestep) { // components: unsigned int numcomponents = 0; _phaseSpaceHeaderFileStream >> numcomponents; - global_log->info() << "Reading " << numcomponents << " components" << endl; + global_log->info() << "Reading " << numcomponents << " components" << std::endl; dcomponents.resize(numcomponents); for(unsigned int i = 0; i < numcomponents; i++) { - global_log->info() << "comp. i = " << i << ": " << endl; + global_log->info() << "comp. i = " << i << ": " << std::endl; dcomponents[i].setID(i); unsigned int numljcenters = 0; unsigned int numcharges = 0; @@ -192,26 +190,26 @@ void MPI_IOReader::readPhaseSpaceHeader(Domain* domain, double timestep) { _phaseSpaceHeaderFileStream >> x >> y >> z >> m >> eps >> sigma >> tcutoff >> do_shift; dcomponents[i].addLJcenter(x, y, z, m, eps, sigma, tcutoff, (do_shift != 0)); global_log->info() << "LJ at [" << x << " " << y << " " << z - << "], mass: " << m << ", epsilon: " << eps << ", sigma: " << sigma << endl; + << "], mass: " << m << ", epsilon: " << eps << ", sigma: " << sigma << std::endl; } for(unsigned int j = 0; j < numcharges; j++) { double q; _phaseSpaceHeaderFileStream >> x >> y >> z >> m >> q; dcomponents[i].addCharge(x, y, z, m, q); global_log->info() << "charge at [" << x << " " << y << " " << z - << "], mass: " << m << ", q: " << q << endl; + << "], mass: " << m << ", q: " << q << std::endl; } for(unsigned int j = 0; j < numdipoles; j++) { double eMyx, eMyy, eMyz, absMy; _phaseSpaceHeaderFileStream >> x >> y >> z >> eMyx >> eMyy >> eMyz >> absMy; dcomponents[i].addDipole(x, y, z, eMyx, eMyy, eMyz, absMy); - global_log->info() << "dipole at [" << x << " " << y << " " << z << "] " << endl; + global_log->info() << "dipole at [" << x << " " << y << " " << z << "] " << std::endl; } for(unsigned int j = 0; j < numquadrupoles; j++) { double eQx, eQy, eQz, absQ; _phaseSpaceHeaderFileStream >> x >> y >> z >> eQx >> eQy >> eQz >> absQ; dcomponents[i].addQuadrupole(x, y, z, eQx, eQy, eQz, absQ); - global_log->info() << "quad at [" << x << " " << y << " " << z << "] " << endl; + global_log->info() << "quad at [" << x << " " << y << " " << z << "] " << std::endl; } double IDummy1, IDummy2, IDummy3; // FIXME! Was soll das hier? Was ist mit der Initialisierung im Fall I <= 0. @@ -223,18 +221,18 @@ void MPI_IOReader::readPhaseSpaceHeader(Domain* domain, double timestep) { if(IDummy3 > 0.) dcomponents[i].setI33(IDummy3); domain->setProfiledComponentMass(dcomponents[i].m()); - global_log->info() << endl; + global_log->info() << std::endl; } #ifndef NDEBUG for(unsigned int i = 0; i < numcomponents; i++) { - global_log->debug() << "Component " << (i + 1) << " of " << numcomponents << endl; - global_log->debug() << dcomponents[i] << endl; + global_log->debug() << "Component " << (i + 1) << " of " << numcomponents << std::endl; + global_log->debug() << dcomponents[i] << std::endl; } #endif // Mixing coefficients - vector& dmixcoeff = domain->getmixcoeff(); + std::vector& dmixcoeff = domain->getmixcoeff(); dmixcoeff.clear(); for(unsigned int i = 1; i < numcomponents; i++) { for(unsigned int j = i + 1; j <= numcomponents; j++) { @@ -254,7 +252,7 @@ void MPI_IOReader::readPhaseSpaceHeader(Domain* domain, double timestep) { // find out the actual position, because the phase space definition will follow // FIXME: is there a more elegant way? fpos = _phaseSpaceHeaderFileStream.tellg(); - _phaseSpaceFileStream.seekg(fpos, ios::beg); + _phaseSpaceFileStream.seekg(fpos, std::ios::beg); } // FIXME: Is there a better solution than skipping the rest of the file? // This is not the last line of the header. The last line is 'MoleculeFormat' @@ -268,7 +266,7 @@ void MPI_IOReader::readPhaseSpaceHeader(Domain* domain, double timestep) { } // LOCATION OF OLD PRESSURE GRADIENT TOKENS else { - global_log->error() << "Invalid token \'" << token << "\' found. Skipping rest of the header." << endl; + global_log->error() << "Invalid token \'" << token << "\' found. Skipping rest of the header." << std::endl; header = false; } } @@ -284,15 +282,15 @@ MPI_IOReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domai Timer inputTimer; inputTimer.start(); - string token; - vector& dcomponents = *(_simulation.getEnsemble()->getComponents()); + std::string token; + std::vector& dcomponents = *(_simulation.getEnsemble()->getComponents()); unsigned int numcomponents = dcomponents.size(); unsigned long localMaxid = 0; // stores the highest molecule ID found in the phase space file if (numcomponents < 1) { global_log->warning() << "No components defined! Setting up single one-centered LJ" - << endl; + << std::endl; numcomponents = 1; dcomponents.resize(numcomponents); dcomponents[0].setID(0); @@ -301,7 +299,7 @@ MPI_IOReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domai if (domainDecomp->getRank() == 0) { global_log->info() << "Opening phase space file " << _phaseSpaceFile - << endl; + << std::endl; } const char * fileName = _phaseSpaceFile.c_str(); @@ -326,7 +324,7 @@ MPI_IOReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domai ret = MPI_File_open(MPI_COMM_WORLD, fileName, MPI_MODE_RDONLY, info, &fh); if (ret != MPI_SUCCESS) { std::cerr << "Could not open phaseSpaceFile " << _phaseSpaceFile - << endl; + << std::endl; handle_error(ret); } @@ -624,15 +622,15 @@ MPI_IOReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domai } */ - global_log->info() << "Finished reading molecules: 100%" << endl; - global_log->info() << "Reading Molecules done" << endl; + global_log->info() << "Finished reading molecules: 100%" << std::endl; + global_log->info() << "Reading Molecules done" << std::endl; // TODO: Shouldn't we always calculate this? if (domain->getglobalRho() < 1e-5) { domain->setglobalRho( domain->getglobalNumMolecules(true, particleContainer, domainDecomp) / domain->getGlobalVolume()); global_log->info() << "Calculated Rho_global = " - << domain->getglobalRho() << endl; + << domain->getglobalRho() << std::endl; } //get maximum I/O time of each process and output it inputTimer.stop(); @@ -643,7 +641,7 @@ MPI_IOReader::readPhaseSpace(ParticleContainer* particleContainer, Domain* domai MPI_Reduce(&ioTime, &maxIOTime, 1, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD); if (domainDecomp->getRank() == 0) { global_log->info() << "Initial IO took: " << maxIOTime - << " sec" << endl; + << " sec" << std::endl; } //get the global maximumID diff --git a/src/io/MaxWriter.cpp b/src/io/MaxWriter.cpp index bbc180fc0e..bdb5623966 100644 --- a/src/io/MaxWriter.cpp +++ b/src/io/MaxWriter.cpp @@ -10,8 +10,6 @@ #include #include -using Log::global_log; -using namespace std; MaxWriter::MaxWriter() : @@ -37,11 +35,11 @@ void MaxWriter::readXML(XMLfileUnits& xmlconfig) _writeFrequency = 1000; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << endl; + global_log->info() << "Write frequency: " << _writeFrequency << std::endl; _outputPrefix = "maxvals"; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "Output prefix: " << _outputPrefix << endl; + global_log->info() << "Output prefix: " << _outputPrefix << std::endl; global_log->info() << "------------------------------------------------------------------------" << std::endl; } @@ -107,8 +105,8 @@ void MaxWriter::init(ParticleContainer * /*particleContainer*/, for(uint32_t qi=0; qi<_numQuantities; ++qi) { - ofstream ofs(sstrFilename[qi].str().c_str(), ios::out); - sstrOutput[qi] << endl; + std::ofstream ofs(sstrFilename[qi].str().c_str(), std::ios::out); + sstrOutput[qi] << std::endl; ofs << sstrOutput[qi].str(); ofs.close(); } @@ -250,13 +248,13 @@ void MaxWriter::writeData(DomainDecompBase* domainDecomp) for(uint32_t vi=1; vi<_numValsPerQuantity; ++vi) sstrOutput[qi] << FORMAT_SCI_MAX_DIGITS << _dMaxValuesGlobal[nOffsetComponent+nOffsetQuantity+vi]; } - sstrOutput[qi] << endl; + sstrOutput[qi] << std::endl; } // write streams to files for(uint32_t qi=0; qi<_numQuantities; ++qi) { - ofstream ofs(sstrFilename[qi].str().c_str(), ios::app); + std::ofstream ofs(sstrFilename[qi].str().c_str(), std::ios::app); ofs << sstrOutput[qi].str(); ofs.close(); } diff --git a/src/io/MemoryProfiler.cpp b/src/io/MemoryProfiler.cpp index 49aca0dc0c..7653c4b764 100644 --- a/src/io/MemoryProfiler.cpp +++ b/src/io/MemoryProfiler.cpp @@ -50,8 +50,8 @@ void MemoryProfiler::registerObject(MemoryProfilable** object) { Log::global_log->debug() << "MemoryProfiler: added object" << std::endl; } -void MemoryProfiler::doOutput(const std::string& string) { - printGeneralInfo(string); +void MemoryProfiler::doOutput(const std::string& myString) { + printGeneralInfo(myString); // further info Log::global_log->debug() << "MemoryProfiler: number of objects: " << _list.size() << std::endl; @@ -135,7 +135,7 @@ int MemoryProfiler::getOwnMemory() { //Note: this value is in KB! return result; } -void MemoryProfiler::printGeneralInfo(const std::string& string) { +void MemoryProfiler::printGeneralInfo(const std::string& myString) { #ifndef _SX struct sysinfo memInfo; sysinfo(&memInfo); @@ -143,8 +143,8 @@ void MemoryProfiler::printGeneralInfo(const std::string& string) { long long usedMem = ((memInfo.totalram - memInfo.freeram - memInfo.bufferram) * memInfo.mem_unit / 1024 - getCachedSize()) / 1024; std::stringstream additionalinfo; - if (string.length() > 0) { - additionalinfo << " (" << string << ")"; + if (myString.length() > 0) { + additionalinfo << " (" << myString << ")"; } additionalinfo << ":" << std::endl; Log::global_log->info() << "Memory consumption" << additionalinfo.str(); diff --git a/src/io/Mkesfera.cpp b/src/io/Mkesfera.cpp index de3c9d7cd8..d1ddee88f4 100755 --- a/src/io/Mkesfera.cpp +++ b/src/io/Mkesfera.cpp @@ -20,8 +20,6 @@ //might be necessary to increase for exascale #define OVERLAPFACTOR 1.5 -using namespace std; -using Log::global_log; void MkesferaGenerator::readXML(XMLfileUnits& xmlconfig) { #define MAX(a, b) (((a) >= (b)) (a) : (b)); @@ -32,23 +30,23 @@ void MkesferaGenerator::readXML(XMLfileUnits& xmlconfig) { boxLength = length; } } - global_log->info() << "Box length: " << boxLength << endl; + global_log->info() << "Box length: " << boxLength << std::endl; R_o = boxLength / 2; xmlconfig.getNodeValueReduced("outer-density", rho_o); - global_log->info() << "Outer density: " << rho_o << endl; + global_log->info() << "Outer density: " << rho_o << std::endl; xmlconfig.getNodeValueReduced("droplet/radius", R_i); - global_log->info() << "Droplet radius: " << R_i << endl; + global_log->info() << "Droplet radius: " << R_i << std::endl; xmlconfig.getNodeValueReduced("droplet/density", rho_i); - global_log->info() << "Droplet density: " << rho_i << endl; + global_log->info() << "Droplet density: " << rho_i << std::endl; for(int d = 0; d < 3; d++) { center[d] = R_o; } xmlconfig.getNodeValueReduced("droplet/center/x", center[0]); xmlconfig.getNodeValueReduced("droplet/center/y", center[1]); xmlconfig.getNodeValueReduced("droplet/center/z", center[2]); - global_log->info() << "Droplet center: " << center[0] << ", " << center[0] << ", " << center[0] << endl; + global_log->info() << "Droplet center: " << center[0] << ", " << center[0] << ", " << center[0] << std::endl; } unsigned long @@ -88,9 +86,9 @@ MkesferaGenerator::readPhaseSpace(ParticleContainer* particleContainer, Domain* } for(int d = 0; d < 3; d++) { - endx[d] = min(fl_units - 1, endx[d] + 1); + endx[d] = std::min(fl_units - 1, endx[d] + 1); - startx[d] = max(0, startx[d] - 1); + startx[d] = std::max(0, startx[d] - 1); fl_units_local[d] = endx[d] - startx[d] + 1; @@ -98,7 +96,7 @@ MkesferaGenerator::readPhaseSpace(ParticleContainer* particleContainer, Domain* } double T = _simulation.getEnsemble()->T(); - global_log->info() << "Temperature: " << T << endl; + global_log->info() << "Temperature: " << T << std::endl; double cutoff = _simulation.getcutoffRadius(); Random* rnd = new Random(); @@ -120,10 +118,10 @@ MkesferaGenerator::readPhaseSpace(ParticleContainer* particleContainer, Domain* } unsigned slots = 3.0 * fl_units * fl_units * fl_units; double boxdensity = (double) slots / (8.0 * R_o * R_o * R_o); - global_log->debug() << "Box density: " << boxdensity << " (unit cell: " << fl_unit << ")" << endl; + global_log->debug() << "Box density: " << boxdensity << " (unit cell: " << fl_unit << ")" << std::endl; double P_in = rho_i / boxdensity; double P_out = rho_o / boxdensity; - global_log->debug() << "Insertion probability: " << P_in << " inside, " << P_out << " outside" << endl; + global_log->debug() << "Insertion probability: " << P_in << " inside, " << P_out << " outside" << std::endl; /* box min is assumed to be 0 (not in parallel!)*/ for(int d = 0; d < 3; d++) { @@ -194,8 +192,8 @@ MkesferaGenerator::readPhaseSpace(ParticleContainer* particleContainer, Domain* MPI_Allreduce(MPI_IN_PLACE, &N, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); #endif - global_log->debug() << "Filling " << N << " out of " << slots << " slots" << endl; - global_log->debug() << "Density: " << N / (8.0 * R_o * R_o * R_o) << endl; + global_log->debug() << "Filling " << N << " out of " << slots << " slots" << std::endl; + global_log->debug() << "Density: " << N / (8.0 * R_o * R_o * R_o) << std::endl; double v_avg = sqrt(3.0 * T); @@ -213,7 +211,7 @@ MkesferaGenerator::readPhaseSpace(ParticleContainer* particleContainer, Domain* if(idx[0] >= startx[0] and idx[0] <= endx[0] and idx[1] >= startx[1] and idx[1] <= endx[1] and idx[2] >= startx[2] and idx[2] <= endx[2]) { if(fill[idx[0] - startx[0]][idx[1] - startx[1]][idx[2] - startx[2]][p]) { - //global_log->debug() << "Inserting: " << idx[0] << "," << idx[1] << "," << idx[2] << "; " << p << endl; + //global_log->debug() << "Inserting: " << idx[0] << "," << idx[1] << "," << idx[2] << "; " << p << std::endl; double q[3]; bool notInBox = false; for(int d = 0; d < 3; d++) { @@ -260,7 +258,7 @@ MkesferaGenerator::readPhaseSpace(ParticleContainer* particleContainer, Domain* domain->setglobalNumMolecules(numberOfMolecules); domain->setglobalRho(numberOfMolecules / _simulation.getEnsemble()->V()); - global_log->info() << "Inserted number of molecules: " << numberOfMolecules << endl; + global_log->info() << "Inserted number of molecules: " << numberOfMolecules << std::endl; return ID; } diff --git a/src/io/MmpldWriter.cpp b/src/io/MmpldWriter.cpp index 6b26c11f01..51fa2aa7bc 100644 --- a/src/io/MmpldWriter.cpp +++ b/src/io/MmpldWriter.cpp @@ -36,8 +36,6 @@ #define MMPLD_HEADER_DATA_SIZE 60 #define MMPLD_SEEK_TABLE_OFFSET MMPLD_HEADER_DATA_SIZE -using Log::global_log; - std::string MmpldWriter::getOutputFilename() { std::stringstream filenamestream; filenamestream << _outputPrefix << "_" << fill_width('0', 4) << _fileCount << ".mmpld"; @@ -106,7 +104,7 @@ void MmpldWriter::readXML(XMLfileUnits& xmlconfig) global_log->fatal() << "[MMPLD Writer] No site parameters specified." << std::endl; Simulation::exit(48973); } - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); XMLfile::Query::const_iterator outputSiteIter; for( outputSiteIter = query.begin(); outputSiteIter; outputSiteIter++ ) { @@ -150,7 +148,7 @@ void MmpldWriter::init(ParticleContainer *particleContainer, _frameCount = 0; // number of components / sites - vector *components = global_simulation->getEnsemble()->getComponents(); + std::vector *components = global_simulation->getEnsemble()->getComponents(); _numComponents = components->size(); _numSitesPerComp.resize(_numComponents); _nCompSitesOffset.resize(_numComponents); @@ -171,7 +169,7 @@ void MmpldWriter::init(ParticleContainer *particleContainer, this->InitSphereData(); this->SetNumSphereTypes(); - string filename = getOutputFilename(); + std::string filename = getOutputFilename(); uint8_t magicIdentifier[6] = {0x4D, 0x4D, 0x50, 0x4C, 0x44, 0x00}; // format marker uint16_t mmpldversion_le = htole16(_mmpldversion); uint32_t numframes = _numFramesPerFile; // number of frames @@ -184,7 +182,7 @@ void MmpldWriter::init(ParticleContainer *particleContainer, int rank = domainDecomp->getRank(); if (rank == 0){ #endif - ofstream mmpldfstream(filename.c_str(), ios::binary|ios::out); + std::ofstream mmpldfstream(filename.c_str(), std::ios::binary|std::ios::out); mmpldfstream.write((char*)magicIdentifier, sizeof(magicIdentifier)); mmpldfstream.write((char*)&mmpldversion_le, sizeof(mmpldversion_le)); mmpldfstream.write((char*)&numframes_le,sizeof(numframes_le)); @@ -222,7 +220,7 @@ void MmpldWriter::init(ParticleContainer *particleContainer, void MmpldWriter::write_frame(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp) { - string filename = getOutputFilename(); + std::string filename = getOutputFilename(); // calculate local number of spheres per component|siteType std::vector numSpheresPerType(_numSphereTypes); @@ -314,14 +312,14 @@ void MmpldWriter::endStep(ParticleContainer *particleContainer, MultiFileApproachReset(particleContainer, domainDecomp, domain); // begin new file } - string filename = getOutputFilename(); + std::string filename = getOutputFilename(); global_log->debug() << "[MMPLD Writer] Writing MMPLD frame " << _frameCount << " for simstep " << simstep << " to file " << filename << std::endl; write_frame(particleContainer, domainDecomp); } void MmpldWriter::finish(ParticleContainer * /*particleContainer*/, DomainDecompBase *domainDecomp, Domain * /*domain*/) { - string filename = getOutputFilename(); + std::string filename = getOutputFilename(); #ifdef ENABLE_MPI int rank = domainDecomp->getRank(); diff --git a/src/io/MmspdBinWriter.cpp b/src/io/MmspdBinWriter.cpp index d3f85c8648..7b02a1dddf 100644 --- a/src/io/MmspdBinWriter.cpp +++ b/src/io/MmspdBinWriter.cpp @@ -15,10 +15,8 @@ #include "Simulation.h" #include "utils/Logger.h" -using Log::global_log; -using namespace std; -MmspdBinWriter::MmspdBinWriter(unsigned long writeFrequency, string outputPrefix) { +MmspdBinWriter::MmspdBinWriter(unsigned long writeFrequency, std::string outputPrefix) { _outputPrefix = outputPrefix; _writeFrequency = writeFrequency; @@ -35,23 +33,23 @@ MmspdBinWriter::~MmspdBinWriter(){} void MmspdBinWriter::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << endl; + global_log->info() << "Write frequency: " << _writeFrequency << std::endl; _outputPrefix = "mardyn"; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "Output prefix: " << _outputPrefix << endl; + global_log->info() << "Output prefix: " << _outputPrefix << std::endl; int appendTimestamp = 0; xmlconfig.getNodeValue("appendTimestamp", appendTimestamp); if(appendTimestamp > 0) { _appendTimestamp = true; } - global_log->info() << "Append timestamp: " << _appendTimestamp << endl; + global_log->info() << "Append timestamp: " << _appendTimestamp << std::endl; } void MmspdBinWriter::init(ParticleContainer * /*particleContainer*/, DomainDecompBase *domainDecomp, Domain *domain) { - stringstream filenamestream; + std::stringstream filenamestream; filenamestream << _outputPrefix; if(_appendTimestamp) { @@ -66,7 +64,7 @@ void MmspdBinWriter::init(ParticleContainer * /*particleContainer*/, int rank = domainDecomp->getRank(); if (rank == 0){ #endif - ofstream mmspdfstream(filename.data(), ios::binary|ios::out); + std::ofstream mmspdfstream(filename.data(), std::ios::binary|std::ios::out); // format marker mmspdfstream << "MMSPDb"; @@ -176,7 +174,7 @@ void MmspdBinWriter::endStep(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain, unsigned long simstep){ if (simstep % _writeFrequency == 0) { - stringstream filenamestream, outputstream; + std::stringstream filenamestream, outputstream; filenamestream << _outputPrefix; if(_appendTimestamp) { @@ -224,7 +222,7 @@ void MmspdBinWriter::endStep(ParticleContainer *particleContainer, offset += outputsize_get; } - global_log->debug() << "MmspdBinWriter rank: " << rank << "; step: " << simstep << "; offset: " << offset << endl; + global_log->debug() << "MmspdBinWriter rank: " << rank << "; step: " << simstep << "; offset: " << offset << std::endl; MPI_File_seek(fh, offset, MPI_SEEK_END); diff --git a/src/io/MmspdWriter.cpp b/src/io/MmspdWriter.cpp index d75107b4ac..954b7eb316 100644 --- a/src/io/MmspdWriter.cpp +++ b/src/io/MmspdWriter.cpp @@ -15,10 +15,8 @@ #include "Simulation.h" #include "utils/Logger.h" -using Log::global_log; -using namespace std; -MmspdWriter::MmspdWriter(unsigned long writeFrequency, string outputPrefix) { +MmspdWriter::MmspdWriter(unsigned long writeFrequency, std::string outputPrefix) { _outputPrefix = outputPrefix; _writeFrequency = writeFrequency; @@ -36,18 +34,18 @@ MmspdWriter::~MmspdWriter(){} void MmspdWriter::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << endl; + global_log->info() << "Write frequency: " << _writeFrequency << std::endl; _outputPrefix = "mardyn"; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "Output prefix: " << _outputPrefix << endl; + global_log->info() << "Output prefix: " << _outputPrefix << std::endl; int appendTimestamp = 0; xmlconfig.getNodeValue("appendTimestamp", appendTimestamp); if(appendTimestamp > 0) { _appendTimestamp = true; } - global_log->info() << "Append timestamp: " << _appendTimestamp << endl; + global_log->info() << "Append timestamp: " << _appendTimestamp << std::endl; } void MmspdWriter::init(ParticleContainer * /*particleContainer*/, @@ -56,7 +54,7 @@ void MmspdWriter::init(ParticleContainer * /*particleContainer*/, int rank = domainDecomp->getRank(); if (rank == 0){ #endif - stringstream filenamestream; + std::stringstream filenamestream; filenamestream << _outputPrefix; if(_appendTimestamp) { @@ -64,7 +62,7 @@ void MmspdWriter::init(ParticleContainer * /*particleContainer*/, } filenamestream << ".mmspd"; _filename = filenamestream.str(); - ofstream mmspdfstream(_filename.c_str(), ios::binary|ios::out); + std::ofstream mmspdfstream(_filename.c_str(), std::ios::binary|std::ios::out); /* writing the header of the mmspd file, i.e. writing the BOM, the format marker (UTF-8), the header line and defining the particle types */ @@ -112,7 +110,7 @@ void MmspdWriter::init(ParticleContainer * /*particleContainer*/, else { mmspdfstream << "**************** Error: Unspecified component!*************\n Possible reason: more than 5 components?\n"; } - mmspdfstream<< setprecision(4) << domain->getSigma(i,0)*0.7 << " x f y f z f" << "\n"; + mmspdfstream<< std::setprecision(4) << domain->getSigma(i,0)*0.7 << " x f y f z f" << "\n"; } // end of particle definitions mmspdfstream.close(); @@ -131,7 +129,7 @@ void MmspdWriter::endStep(ParticleContainer *particleContainer, int tag = 4711; if (rank == 0){ #endif - ofstream mmspdfstream(_filename.c_str(), ios::out|ios::app); + std::ofstream mmspdfstream(_filename.c_str(), std::ios::out|std::ios::app); mmspdfstream << "> " << globalNumMolecules << "\n"; for (auto pos = particleContainer->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); pos.isValid(); ++pos) { bool halo = false; @@ -142,9 +140,9 @@ void MmspdWriter::endStep(ParticleContainer *particleContainer, } } if (!halo) { - mmspdfstream << setiosflags(ios::fixed) << setw(8) << pos->getID() << setw(3) - << pos->componentid() << setprecision(3) << " "; - for (unsigned short d = 0; d < 3; d++) mmspdfstream << setw(7) << pos->r(d) << " " ; + mmspdfstream << setiosflags(std::ios::fixed) << std::setw(8) << pos->getID() << std::setw(3) + << pos->componentid() << std::setprecision(3) << " "; + for (unsigned short d = 0; d < 3; d++) mmspdfstream << std::setw(7) << pos->r(d) << " " ; mmspdfstream << "\n"; } } @@ -157,7 +155,7 @@ void MmspdWriter::endStep(ParticleContainer *particleContainer, MPI_Get_count(&status_probe, MPI_CHAR, &numchars); char *recvbuff = new char[numchars]; MPI_Recv(recvbuff, numchars, MPI_CHAR, fromrank, tag, MPI_COMM_WORLD, &status_recv); - mmspdfstream << string(recvbuff); + mmspdfstream << std::string(recvbuff); delete[] recvbuff; } #endif @@ -165,7 +163,7 @@ void MmspdWriter::endStep(ParticleContainer *particleContainer, #ifdef ENABLE_MPI } else { - stringstream mmspdfstream; + std::stringstream mmspdfstream; for (auto pos = particleContainer->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); pos.isValid(); ++pos) { bool halo = false; for (unsigned short d = 0; d < 3; d++) { @@ -175,14 +173,14 @@ void MmspdWriter::endStep(ParticleContainer *particleContainer, } } if (!halo) { - mmspdfstream << setiosflags(ios::fixed) << setw(8) << pos->getID() << setw(3) - << pos->componentid() << setprecision(3) << " "; - for (unsigned short d = 0; d < 3; d++) mmspdfstream << setw(7) << pos->r(d) << " " ; + mmspdfstream << setiosflags(std::ios::fixed) << std::setw(8) << pos->getID() << std::setw(3) + << pos->componentid() << std::setprecision(3) << " "; + for (unsigned short d = 0; d < 3; d++) mmspdfstream << std::setw(7) << pos->r(d) << " " ; mmspdfstream << "\n"; } } - string sendbuff; + std::string sendbuff; sendbuff = mmspdfstream.str(); MPI_Send(sendbuff.c_str(), sendbuff.length() + 1, MPI_CHAR, 0, tag, MPI_COMM_WORLD); } diff --git a/src/io/MultiObjectGenerator.cpp b/src/io/MultiObjectGenerator.cpp index 2c0367c3cf..a6d242e5a8 100644 --- a/src/io/MultiObjectGenerator.cpp +++ b/src/io/MultiObjectGenerator.cpp @@ -23,9 +23,6 @@ #include "utils/xmlfileUnits.h" -using Log::global_log; -using namespace std; - MultiObjectGenerator::MultiObjectGenerator::~MultiObjectGenerator() { for(auto& generator : _generators) { delete generator; @@ -36,8 +33,8 @@ MultiObjectGenerator::MultiObjectGenerator::~MultiObjectGenerator() { void MultiObjectGenerator::readXML(XMLfileUnits& xmlconfig) { XMLfile::Query query = xmlconfig.query("objectgenerator"); - global_log->info() << "Number of sub-objectgenerators: " << query.card() << endl; - string oldpath = xmlconfig.getcurrentnodepath(); + global_log->info() << "Number of sub-objectgenerators: " << query.card() << std::endl; + std::string oldpath = xmlconfig.getcurrentnodepath(); for(auto generatorIter = query.begin(); generatorIter; ++generatorIter) { xmlconfig.changecurrentnode(generatorIter); ObjectGenerator* generator = new ObjectGenerator(); @@ -59,12 +56,12 @@ unsigned long MultiObjectGenerator::readPhaseSpace(ParticleContainer* particleCo numMolecules += generator->readPhaseSpace(particleContainer, domain, domainDecomp); } particleContainer->updateMoleculeCaches(); - global_log->info() << "Number of locally inserted molecules: " << numMolecules << endl; + global_log->info() << "Number of locally inserted molecules: " << numMolecules << std::endl; _globalNumMolecules = numMolecules; #ifdef ENABLE_MPI MPI_Allreduce(MPI_IN_PLACE, &_globalNumMolecules, 1, MPI_UNSIGNED_LONG, MPI_SUM, domainDecomp->getCommunicator()); #endif - global_log->info() << "Number of globally inserted molecules: " << _globalNumMolecules << endl; + global_log->info() << "Number of globally inserted molecules: " << _globalNumMolecules << std::endl; //! @todo Get rid of the domain class calls at this place here... return _globalNumMolecules; } diff --git a/src/io/ODF.cpp b/src/io/ODF.cpp index dff6b11a70..cd5be1bfaf 100644 --- a/src/io/ODF.cpp +++ b/src/io/ODF.cpp @@ -6,21 +6,21 @@ void ODF::readXML(XMLfileUnits& xmlconfig) { global_log->debug() << "[ODF] enabled. Dipole orientations must be set to [0 0 1]!" << std::endl; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "[ODF] Write frequency: " << _writeFrequency << endl; + global_log->info() << "[ODF] Write frequency: " << _writeFrequency << std::endl; xmlconfig.getNodeValue("initstatistics", _initStatistics); - global_log->info() << "[ODF] Init Statistics: " << _initStatistics << endl; + global_log->info() << "[ODF] Init Statistics: " << _initStatistics << std::endl; xmlconfig.getNodeValue("recordingtimesteps", _recordingTimesteps); - global_log->info() << "[ODF] Recording Timesteps: " << _recordingTimesteps << endl; + global_log->info() << "[ODF] Recording Timesteps: " << _recordingTimesteps << std::endl; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "[ODF] Output prefix: " << _outputPrefix << endl; + global_log->info() << "[ODF] Output prefix: " << _outputPrefix << std::endl; xmlconfig.getNodeValue("phi1increments", _phi1Increments); - global_log->info() << "[ODF] Phi1 increments: " << _phi1Increments << endl; + global_log->info() << "[ODF] Phi1 increments: " << _phi1Increments << std::endl; xmlconfig.getNodeValue("phi2increments", _phi2Increments); - global_log->info() << "[ODF] Phi2 increments: " << _phi2Increments << endl; + global_log->info() << "[ODF] Phi2 increments: " << _phi2Increments << std::endl; xmlconfig.getNodeValue("gammaincrements", _gammaIncrements); - global_log->info() << "[ODF] Gamma increments: " << _gammaIncrements << endl; + global_log->info() << "[ODF] Gamma increments: " << _gammaIncrements << std::endl; xmlconfig.getNodeValue("shellcutoff", _shellCutOff); - global_log->info() << "[ODF] Shell cutoff: " << _shellCutOff << endl; + global_log->info() << "[ODF] Shell cutoff: " << _shellCutOff << std::endl; } void ODF::init(ParticleContainer* particleContainer, DomainDecompBase* /*domainDecomp*/, Domain* domain) { @@ -41,7 +41,7 @@ void ODF::init(ParticleContainer* particleContainer, DomainDecompBase* /*domainD if (isDipole[i] == 1) { bool orientationIsCorrect = ci.dipole(0).e() == std::array{0,0,1}; if(orientationIsCorrect == false){ - global_log->error() << "Wrong dipole vector chosen! Please always choose [eMyx eMyy eMyz] = [0 0 1] when using the ODF plugin" << endl; + global_log->error() << "Wrong dipole vector chosen! Please always choose [eMyx eMyy eMyz] = [0 0 1] when using the ODF plugin" << std::endl; } numPairs++; } @@ -50,7 +50,7 @@ void ODF::init(ParticleContainer* particleContainer, DomainDecompBase* /*domainD _numPairs = numPairs * numPairs; _numElements = _phi1Increments * _phi2Increments * _gammaIncrements + 1; global_log->info() << "ODF arrays contains " << _numElements << " elements each for " << _numPairs << "pairings" - << endl; + << std::endl; _ODF11.resize(_numElements); _ODF12.resize(_numElements); _ODF21.resize(_numElements); @@ -69,10 +69,10 @@ void ODF::init(ParticleContainer* particleContainer, DomainDecompBase* /*domainD resize2D(_threadLocalODF22, mardyn_get_max_threads(), _numElements); if (_numPairs < 1) { - global_log->error() << "No components with dipoles. ODF's not being calculated!" << endl; + global_log->error() << "No components with dipoles. ODF's not being calculated!" << std::endl; } else if (_numPairs > 4) { global_log->error() - << "Number of pairings for ODF calculation too high. Current maximum number of ODF pairings is 4." << endl; + << "Number of pairings for ODF calculation too high. Current maximum number of ODF pairings is 4." << std::endl; } reset(); @@ -102,7 +102,7 @@ void ODF::endStep(ParticleContainer* /*particleContainer*/, DomainDecompBase* do } void ODF::reset() { - global_log->info() << "[ODF] resetting data sets" << endl; + global_log->info() << "[ODF] resetting data sets" << std::endl; // // C++ 14: // auto fillZero = [](auto& vec) {std::fill(vec.begin(), vec.end(), 0);}; @@ -120,8 +120,8 @@ void ODF::reset() { std::for_each(_threadLocalODF22.begin(), _threadLocalODF22.end(), fillZero); } -void ODF::calculateOrientation(const array& simBoxSize, const Molecule& mol1, const Molecule& mol2, - const array& orientationVector1) { +void ODF::calculateOrientation(const std::array& simBoxSize, const Molecule& mol1, const Molecule& mol2, + const std::array& orientationVector1) { // TODO Implement rotation matrices to calculate orientations for dipole direction unit vectors other than [0 0 1]; @@ -246,8 +246,8 @@ void ODF::calculateOrientation(const array& simBoxSize, const Molecul // determine array element // NOTE: element 0 of array ODF is unused - maximumIncrements = max(_phi1Increments, _phi2Increments); - maximumIncrements = max(maximumIncrements, _gammaIncrements); + maximumIncrements = std::max(_phi1Increments, _phi2Increments); + maximumIncrements = std::max(maximumIncrements, _gammaIncrements); // calculate indices for phi1, phi2 and gamma12 for bin assignment for (unsigned i = 0; i < maximumIncrements; i++) { @@ -291,14 +291,14 @@ void ODF::calculateOrientation(const array& simBoxSize, const Molecul // notification if anything goes wrong during calculataion if (assignPhi1 == 0 || assignPhi2 == 0 || assignGamma12 == 0) { - global_log->warning() << "Array element in ODF calculation not properly assigned!" << endl; - global_log->warning() << "Mol-ID 1 = " << mol1.getID() << " Mol-ID 2 = " << mol2.getID() << endl; - global_log->warning() << "orientationVector1=" << orientationVector1[0] << " " << orientationVector1[1] << " " << orientationVector1[2] << " " << endl; - global_log->warning() << "orientationVector2=" << orientationVector2[0] << " " << orientationVector2[1] << " " << orientationVector2[2] << " " << endl; - global_log->warning() << "distanceVector12=" << distanceVector12[0] << " " << distanceVector12[1] << " " << distanceVector12[2] << " " << endl; + global_log->warning() << "Array element in ODF calculation not properly assigned!" << std::endl; + global_log->warning() << "Mol-ID 1 = " << mol1.getID() << " Mol-ID 2 = " << mol2.getID() << std::endl; + global_log->warning() << "orientationVector1=" << orientationVector1[0] << " " << orientationVector1[1] << " " << orientationVector1[2] << " " << std::endl; + global_log->warning() << "orientationVector2=" << orientationVector2[0] << " " << orientationVector2[1] << " " << orientationVector2[2] << " " << std::endl; + global_log->warning() << "distanceVector12=" << distanceVector12[0] << " " << distanceVector12[1] << " " << distanceVector12[2] << " " << std::endl; global_log->warning() << "[cosphi1 cosphi2 cosgamma12] = [" << cosPhi1 << " " << cosPhi2 << " " - << cosGamma12 << "]" << endl; - global_log->warning() << "indices are " << indexPhi1 << " " << indexPhi2 << " " << indexGamma12 << endl; + << cosGamma12 << "]" << std::endl; + global_log->warning() << "indices are " << indexPhi1 << " " << indexPhi2 << " " << indexGamma12 << std::endl; } // assignment of bin ID @@ -391,19 +391,19 @@ void ODF::output(Domain* /*domain*/, long unsigned timestep) { double cosPhi2 = 1. - 2. / _phi2Increments; double Gamma12 = 0.; double averageODF11 = 0.; - string prefix; - ostringstream osstrm; + std::string prefix; + std::ostringstream osstrm; osstrm << _outputPrefix; osstrm.fill('0'); osstrm.width(7); - osstrm << right << timestep; + osstrm << std::right << timestep; prefix = osstrm.str(); osstrm.str(""); osstrm.clear(); if (_numPairs == 1) { - string ODF11name = prefix + ".ODF11"; - ofstream outfile(ODF11name.c_str()); + std::string ODF11name = prefix + ".ODF11"; + std::ofstream outfile(ODF11name.c_str()); outfile.precision(6); for (unsigned long i = 1; i < _numElements; i++) { @@ -447,15 +447,15 @@ void ODF::output(Domain* /*domain*/, long unsigned timestep) { averageODF21 /= ((double)_numElements - 1.); averageODF22 /= ((double)_numElements - 1.); - string ODF11name = prefix + ".ODF11"; - string ODF12name = prefix + ".ODF12"; - string ODF22name = prefix + ".ODF22"; - string ODF21name = prefix + ".ODF21"; - - ofstream ODF11(ODF11name.c_str()); - ofstream ODF12(ODF12name.c_str()); - ofstream ODF22(ODF22name.c_str()); - ofstream ODF21(ODF21name.c_str()); + std::string ODF11name = prefix + ".ODF11"; + std::string ODF12name = prefix + ".ODF12"; + std::string ODF22name = prefix + ".ODF22"; + std::string ODF21name = prefix + ".ODF21"; + + std::ofstream ODF11(ODF11name.c_str()); + std::ofstream ODF12(ODF12name.c_str()); + std::ofstream ODF22(ODF22name.c_str()); + std::ofstream ODF21(ODF21name.c_str()); ODF11.precision(5); ODF12.precision(5); ODF22.precision(5); diff --git a/src/io/ODF.h b/src/io/ODF.h index 6b4e07fc1c..9ed44f03fa 100644 --- a/src/io/ODF.h +++ b/src/io/ODF.h @@ -34,10 +34,10 @@ class ODF : public PluginBase { unsigned long simstep) override; void reset(); void collect(DomainDecompBase* domainDecomp); - void calculateOrientation(const array &simBoxSize, + void calculateOrientation(const std::array &simBoxSize, const Molecule &mol1, const Molecule &mol2, - const array &orientationVector1); + const std::array &orientationVector1); void output(Domain* domain, long unsigned timestep); void finish(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain) override{}; std::string getPluginName() override { return std::string("ODF"); } diff --git a/src/io/ObjectGenerator.cpp b/src/io/ObjectGenerator.cpp index e959c271e6..667cfa4dce 100644 --- a/src/io/ObjectGenerator.cpp +++ b/src/io/ObjectGenerator.cpp @@ -16,48 +16,46 @@ #include "utils/generator/VelocityAssignerBase.h" -using std::endl; - void ObjectGenerator::readXML(XMLfileUnits& xmlconfig) { if(xmlconfig.changecurrentnode("filler")) { std::string fillerType; xmlconfig.getNodeValue("@type", fillerType); - global_log->debug() << "Filler type: " << fillerType << endl; + global_log->debug() << "Filler type: " << fillerType << std::endl; ObjectFillerFactory objectFillerFactory; _filler = std::shared_ptr(objectFillerFactory.create(fillerType)); if(!_filler) { - global_log->error() << "Object filler could not be created" << endl; + global_log->error() << "Object filler could not be created" << std::endl; Simulation::exit(1); } - global_log->debug() << "Using object filler of type: " << _filler->getPluginName() << endl; + global_log->debug() << "Using object filler of type: " << _filler->getPluginName() << std::endl; _filler->readXML(xmlconfig); xmlconfig.changecurrentnode(".."); } else { - global_log->error() << "No filler specified." << endl; + global_log->error() << "No filler specified." << std::endl; Simulation::exit(1); } if(xmlconfig.changecurrentnode("object")) { std::string objectType; xmlconfig.getNodeValue("@type", objectType); - global_log->debug() << "Obj name: " << objectType << endl; + global_log->debug() << "Obj name: " << objectType << std::endl; ObjectFactory objectFactory; _object = std::shared_ptr(objectFactory.create(objectType)); if(!_object) { - global_log->error() << "Unknown object type: " << objectType << endl; + global_log->error() << "Unknown object type: " << objectType << std::endl; } - global_log->debug() << "Created object of type: " << _object->getPluginName() << endl; + global_log->debug() << "Created object of type: " << _object->getPluginName() << std::endl; _object->readXML(xmlconfig); xmlconfig.changecurrentnode(".."); } else { - global_log->error() << "No object specified." << endl; + global_log->error() << "No object specified." << std::endl; Simulation::exit(1); } if(xmlconfig.changecurrentnode("velocityAssigner")) { std::string velocityAssignerName; xmlconfig.getNodeValue("@type", velocityAssignerName); - global_log->info() << "Velocity assigner: " << velocityAssignerName << endl; + global_log->info() << "Velocity assigner: " << velocityAssignerName << std::endl; const long seed = [&]() -> long { bool enableRandomSeed = false; @@ -74,22 +72,22 @@ void ObjectGenerator::readXML(XMLfileUnits& xmlconfig) { return 0; } }(); - global_log->info() << "Seed for velocity assigner: " << seed << endl; + global_log->info() << "Seed for velocity assigner: " << seed << std::endl; if(velocityAssignerName == "EqualVelocityDistribution") { _velocityAssigner = std::make_shared(0, seed); } else if(velocityAssignerName == "MaxwellVelocityDistribution") { _velocityAssigner = std::make_shared(0, seed); } else { - global_log->error() << "Unknown velocity assigner specified." << endl; + global_log->error() << "Unknown velocity assigner specified." << std::endl; Simulation::exit(1); } Ensemble* ensemble = _simulation.getEnsemble(); - global_log->info() << "Setting temperature for velocity assigner to " << ensemble->T() << endl; + global_log->info() << "Setting temperature for velocity assigner to " << ensemble->T() << std::endl; _velocityAssigner->setTemperature(ensemble->T()); xmlconfig.changecurrentnode(".."); } else { global_log->warning() << "No velocityAssigner specified. Will not change velocities provided by filler." - << endl; + << std::endl; } } diff --git a/src/io/PovWriter.cpp b/src/io/PovWriter.cpp index 5d717e8fce..191b399bbb 100644 --- a/src/io/PovWriter.cpp +++ b/src/io/PovWriter.cpp @@ -12,12 +12,8 @@ #include "Simulation.h" #include "utils/Logger.h" -using Log::global_log; -using namespace std; - - -static void writePOVobjs(Component const &component, std::ostream& ostrm, string para) { +static void writePOVobjs(Component const &component, std::ostream& ostrm, std::string para) { if (component.numLJcenters() <= 0) return; if (component.numLJcenters() == 1) { LJcenter LJsite = component.ljcenter(0); @@ -36,16 +32,16 @@ static void writePOVobjs(Component const &component, std::ostream& ostrm, string void PovWriter::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << endl; + global_log->info() << "Write frequency: " << _writeFrequency << std::endl; _outputPrefix = "mardyn"; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "Output prefix: " << _outputPrefix << endl; + global_log->info() << "Output prefix: " << _outputPrefix << std::endl; int incremental = 1; xmlconfig.getNodeValue("incremental", incremental); _incremental = (incremental != 0); - global_log->info() << "Incremental numbers: " << _incremental << endl; + global_log->info() << "Incremental numbers: " << _incremental << std::endl; int appendTimestamp = 0; xmlconfig.getNodeValue("appendTimestamp", appendTimestamp); @@ -54,7 +50,7 @@ void PovWriter::readXML(XMLfileUnits& xmlconfig) { } else{ _appendTimestamp = false; } - global_log->info() << "Append timestamp: " << _appendTimestamp << endl; + global_log->info() << "Append timestamp: " << _appendTimestamp << std::endl; } void PovWriter::init(ParticleContainer * /*particleContainer*/, @@ -65,7 +61,7 @@ void PovWriter::endStep(ParticleContainer *particleContainer, DomainDecompBase * /*domainDecomp*/, Domain *domain, unsigned long simstep) { if (simstep % _writeFrequency == 0) { - stringstream filenamestream; + std::stringstream filenamestream; filenamestream << _outputPrefix; if(_incremental) { @@ -79,49 +75,49 @@ void PovWriter::endStep(ParticleContainer *particleContainer, } filenamestream << ".pov"; - ofstream ostrm(filenamestream.str().c_str()); + std::ofstream ostrm(filenamestream.str().c_str()); - ostrm << "// " << filenamestream.str() << endl; - ostrm << "// moldy" << endl; + ostrm << "// " << filenamestream.str() << std::endl; + ostrm << "// moldy" << std::endl; const auto now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); tm unused{}; - ostrm << "// " << std::put_time(localtime_r(&now, &unused), "%c") << endl; + ostrm << "// " << std::put_time(localtime_r(&now, &unused), "%c") << std::endl; - ostrm << "// bb: [0," << domain->getGlobalLength(0) << "]^3" << endl; - ostrm << "//*PMRawBegin" << endl; - ostrm << "background {rgb <1,1,1>}" << endl; - ostrm << "//*PMRawEnd" << endl; - vector* dcomponents = _simulation.getEnsemble()->getComponents(); + ostrm << "// bb: [0," << domain->getGlobalLength(0) << "]^3" << std::endl; + ostrm << "//*PMRawBegin" << std::endl; + ostrm << "background {rgb <1,1,1>}" << std::endl; + ostrm << "//*PMRawEnd" << std::endl; + std::vector* dcomponents = _simulation.getEnsemble()->getComponents(); for (unsigned int i = 0; i < dcomponents->size(); ++i) { - ostringstream osstrm; + std::ostringstream osstrm; osstrm.clear(); osstrm.str(""); osstrm << " pigment {color rgb <" << (i + 1) % 2 << "," << (i + 1) / 2 % 2 << "," << (i + 1) / 4 % 2 << ">}"; osstrm << " finish{ambient 0.5 diffuse 0.4 phong 0.3 phong_size 3}"; ostrm << "#declare T" << i << " = "; writePOVobjs(dcomponents->at(i), ostrm, osstrm.str()); - ostrm << endl; + ostrm << std::endl; } - ostrm << endl; - ostrm << "camera { perspective" << endl; + ostrm << std::endl; + ostrm << "camera { perspective" << std::endl; float xloc = -.1 * domain->getGlobalLength(0); float yloc = 1.1 * domain->getGlobalLength(1); float zloc = -1.5 * domain->getGlobalLength(2); - ostrm << " location <" << xloc << ", " << yloc << ", " << zloc << ">" << endl; - ostrm << " look_at <" << .5 * domain->getGlobalLength(0) << ", " << .5 * domain->getGlobalLength(1) << ", " << .5 * domain->getGlobalLength(2) << ">" << endl; - ostrm << "}" << endl; - ostrm << endl; - ostrm << "light_source { <" << xloc << ", " << yloc << ", " << zloc << ">, color rgb <1,1,1> }" << endl; - ostrm << "light_source { <0,0,0>, color rgb <1,1,1> }" << endl; - ostrm << "light_source { <0,0," << domain->getGlobalLength(2) << ">, color rgb <1,1,1> }" << endl; - ostrm << "light_source { <0," << domain->getGlobalLength(1) << ",0>, color rgb <1,1,1> }" << endl; - ostrm << "light_source { <0," << domain->getGlobalLength(1) << "," << domain->getGlobalLength(2) << ">, color rgb <1,1,1> }" << endl; - ostrm << "light_source { <" << domain->getGlobalLength(0) << ",0,0>, color rgb <1,1,1> }" << endl; - ostrm << "light_source { <" << domain->getGlobalLength(0) << ",0," << domain->getGlobalLength(2) << ">, color rgb <1,1,1> }" << endl; - ostrm << "light_source { <" << domain->getGlobalLength(0) << "," << domain->getGlobalLength(1) << ",0>, color rgb <1,1,1> }" << endl; - ostrm << "light_source { <" << domain->getGlobalLength(0) << "," << domain->getGlobalLength(1) << "," << domain->getGlobalLength(2) << ">, color rgb <1,1,1> }" << endl; - ostrm << endl; - ostrm << "// " << dcomponents->size() << " objects for the atoms following..." << endl; + ostrm << " location <" << xloc << ", " << yloc << ", " << zloc << ">" << std::endl; + ostrm << " look_at <" << .5 * domain->getGlobalLength(0) << ", " << .5 * domain->getGlobalLength(1) << ", " << .5 * domain->getGlobalLength(2) << ">" << std::endl; + ostrm << "}" << std::endl; + ostrm << std::endl; + ostrm << "light_source { <" << xloc << ", " << yloc << ", " << zloc << ">, color rgb <1,1,1> }" << std::endl; + ostrm << "light_source { <0,0,0>, color rgb <1,1,1> }" << std::endl; + ostrm << "light_source { <0,0," << domain->getGlobalLength(2) << ">, color rgb <1,1,1> }" << std::endl; + ostrm << "light_source { <0," << domain->getGlobalLength(1) << ",0>, color rgb <1,1,1> }" << std::endl; + ostrm << "light_source { <0," << domain->getGlobalLength(1) << "," << domain->getGlobalLength(2) << ">, color rgb <1,1,1> }" << std::endl; + ostrm << "light_source { <" << domain->getGlobalLength(0) << ",0,0>, color rgb <1,1,1> }" << std::endl; + ostrm << "light_source { <" << domain->getGlobalLength(0) << ",0," << domain->getGlobalLength(2) << ">, color rgb <1,1,1> }" << std::endl; + ostrm << "light_source { <" << domain->getGlobalLength(0) << "," << domain->getGlobalLength(1) << ",0>, color rgb <1,1,1> }" << std::endl; + ostrm << "light_source { <" << domain->getGlobalLength(0) << "," << domain->getGlobalLength(1) << "," << domain->getGlobalLength(2) << ">, color rgb <1,1,1> }" << std::endl; + ostrm << std::endl; + ostrm << "// " << dcomponents->size() << " objects for the atoms following..." << std::endl; double mrot[3][3]; for (auto pos = particleContainer->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); pos.isValid(); ++pos) { (pos->q()).getRotMatrix(mrot); diff --git a/src/io/RDF.cpp b/src/io/RDF.cpp index cdabde5414..711aee7e51 100644 --- a/src/io/RDF.cpp +++ b/src/io/RDF.cpp @@ -12,8 +12,6 @@ #include #include -using namespace std; -using namespace Log; RDF::RDF() : _intervalLength(0), @@ -154,27 +152,27 @@ void RDF::init() { void RDF::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << endl; + global_log->info() << "Write frequency: " << _writeFrequency << std::endl; _samplingFrequency = 1; xmlconfig.getNodeValue("samplingfrequency", _samplingFrequency); - global_log->info() << "Sampling frequency: " << _samplingFrequency << endl; + global_log->info() << "Sampling frequency: " << _samplingFrequency << std::endl; _outputPrefix = "mardyn"; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "Output prefix: " << _outputPrefix << endl; + global_log->info() << "Output prefix: " << _outputPrefix << std::endl; _bins = 1; xmlconfig.getNodeValue("bins", _bins); - global_log->info() << "Number of bins: " << _bins << endl; + global_log->info() << "Number of bins: " << _bins << std::endl; _angularBins = 1; xmlconfig.getNodeValue("angularbins", _angularBins); - global_log->info() << "Number of angular bins: " << _angularBins << endl; + global_log->info() << "Number of angular bins: " << _angularBins << std::endl; _intervalLength = 1; xmlconfig.getNodeValueReduced("intervallength", _intervalLength); - global_log->info() << "Interval length: " << _intervalLength << endl; + global_log->info() << "Interval length: " << _intervalLength << std::endl; _readConfig = true; } @@ -192,7 +190,7 @@ RDF::~RDF() { // nothing to do since refactoring to vectors } -void RDF::accumulateNumberOfMolecules(vector& components) { +void RDF::accumulateNumberOfMolecules(std::vector& components) { for (size_t i = 0; i < components.size(); i++) { _globalCtr[i] += components[i].getNumMolecules(); } @@ -351,7 +349,7 @@ void RDF::endStep(ParticleContainer * /*particleContainer*/, DomainDecompBase *d accumulateRDF(); for (unsigned i = 0; i < _numberOfComponents; i++) { for (unsigned j = i; j < _numberOfComponents; j++) { - ostringstream osstrm; + std::ostringstream osstrm; osstrm << _outputPrefix << "_" << i << "-" << j << "."; osstrm.fill('0'); osstrm.width(9); @@ -360,7 +358,7 @@ void RDF::endStep(ParticleContainer * /*particleContainer*/, DomainDecompBase *d } if( _doARDF) { for (unsigned j = 0; j < _numberOfComponents; j++){ - ostringstream osstrm2; + std::ostringstream osstrm2; osstrm2 << _outputPrefix << "_" << i << "-" << j << "."; osstrm2.fill('0'); osstrm2.width(9); @@ -375,9 +373,9 @@ void RDF::endStep(ParticleContainer * /*particleContainer*/, DomainDecompBase *d } void RDF::writeToFileARDF(const Domain* domain, const std::string& filename, unsigned i, unsigned j) const { - ofstream ardfout(filename); + std::ofstream ardfout(filename); if( ardfout.fail() ) { - global_log->error() << "[ARDF] Failed opening output file '" << filename << "'" << endl; + global_log->error() << "[ARDF] Failed opening output file '" << filename << "'" << std::endl; return; } double V = domain->getGlobalVolume(); @@ -455,13 +453,13 @@ void RDF::writeToFileARDF(const Domain* domain, const std::string& filename, uns void RDF::writeToFile(const Domain* domain, const std::string& filename, unsigned i, unsigned j) const { - ofstream rdfout(filename); + std::ofstream rdfout(filename); if( rdfout.fail() ) { - global_log->error() << "[RDF] Failed opening output file '" << filename << "'" << endl; + global_log->error() << "[RDF] Failed opening output file '" << filename << "'" << std::endl; return; } - global_log->debug() << "[RDF] Writing output" << endl; + global_log->debug() << "[RDF] Writing output" << std::endl; unsigned ni = (*_components)[i].numSites(); unsigned nj = (*_components)[j].numSites(); @@ -573,7 +571,7 @@ void RDF::writeToFile(const Domain* domain, const std::string& filename, unsigne void RDF::afterForces(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, unsigned long simstep) { if (simstep % _samplingFrequency == 0 && simstep > global_simulation->getInitStatistics()) { - global_log->debug() << "Activating the RDF sampling" << endl; + global_log->debug() << "Activating the RDF sampling" << std::endl; tickRDF(); accumulateNumberOfMolecules(*(global_simulation->getEnsemble()->getComponents())); particleContainer->traverseCells(*_cellProcessor); diff --git a/src/io/ReplicaGenerator.cpp b/src/io/ReplicaGenerator.cpp index 7225fab67a..9c6719bf52 100755 --- a/src/io/ReplicaGenerator.cpp +++ b/src/io/ReplicaGenerator.cpp @@ -23,7 +23,6 @@ #include "Simulation.h" #include "utils/Logger.h" -using Log::global_log; enum MoleculeFormat : uint32_t { ICRVQD, IRV, ICRV @@ -56,8 +55,8 @@ void ReplicaGenerator::readReplicaPhaseSpaceHeader(SubDomain& subDomain) { XMLfileUnits inp(subDomain.strFilePathHeader); if(not inp.changecurrentnode("/mardyn")) { - global_log->error() << "Could not find root node /mardyn in XML input file." << endl; - global_log->fatal() << "Not a valid MarDyn XML input file." << endl; + global_log->error() << "Could not find root node /mardyn in XML input file." << std::endl; + global_log->fatal() << "Not a valid MarDyn XML input file." << std::endl; Simulation::exit(1); } @@ -81,7 +80,7 @@ void ReplicaGenerator::readReplicaPhaseSpaceHeader(SubDomain& subDomain) { if(not bInputOk) { global_log->error() << "Content of file: '" << subDomain.strFilePathHeader << "' corrupted! Program exit ..." - << endl; + << std::endl; Simulation::exit(1); } @@ -92,7 +91,7 @@ void ReplicaGenerator::readReplicaPhaseSpaceHeader(SubDomain& subDomain) { else if("ICRV" == strMoleculeFormat) _nMoleculeFormat = ICRV; else { - global_log->error() << "Not a valid molecule format: " << strMoleculeFormat << ", program exit ..." << endl; + global_log->error() << "Not a valid molecule format: " << strMoleculeFormat << ", program exit ..." << std::endl; Simulation::exit(1); } } @@ -102,17 +101,17 @@ void ReplicaGenerator::readReplicaPhaseSpaceData(SubDomain& subDomain, DomainDec if(domainDecomp->getRank() == 0) { #endif subDomain.strFilePathData = string_utils::trim(subDomain.strFilePathData); - global_log->info() << "Opening phase space file " << subDomain.strFilePathData << endl; + global_log->info() << "Opening phase space file " << subDomain.strFilePathData << std::endl; std::ifstream ifs; - ifs.open(subDomain.strFilePathData.c_str(), ios::binary | ios::in); + ifs.open(subDomain.strFilePathData.c_str(), std::ios::binary | std::ios::in); if(!ifs.is_open()) { - global_log->error() << "Could not open phaseSpaceFile " << subDomain.strFilePathData << endl; + global_log->error() << "Could not open phaseSpaceFile " << subDomain.strFilePathData << std::endl; Simulation::exit(1); } - global_log->info() << "Reading phase space file " << subDomain.strFilePathData << endl; + global_log->info() << "Reading phase space file " << subDomain.strFilePathData << std::endl; - vector& components = *(_simulation.getEnsemble()->getComponents()); + std::vector& components = *(_simulation.getEnsemble()->getComponents()); // Select appropriate reader switch (_nMoleculeFormat) { @@ -152,7 +151,7 @@ void ReplicaGenerator::readReplicaPhaseSpaceData(SubDomain& subDomain, DomainDec ParticleData::MoleculeToParticleData(particle_buff[particle_buff_pos], subDomain.vecParticles[i]); particle_buff_pos++; if ((particle_buff_pos >= PARTICLE_BUFFER_SIZE) || (i == num_particles - 1)) { - global_log->debug() << "broadcasting(sending) particles" << endl; + global_log->debug() << "broadcasting(sending) particles" << std::endl; MPI_Bcast(particle_buff, PARTICLE_BUFFER_SIZE, mpi_Particle, 0, domainDecomp->getCommunicator()); particle_buff_pos = 0; } @@ -160,7 +159,7 @@ void ReplicaGenerator::readReplicaPhaseSpaceData(SubDomain& subDomain, DomainDec } else { for(unsigned long i = 0; i < num_particles; ++i) { if(i % PARTICLE_BUFFER_SIZE == 0) { - global_log->debug() << "broadcasting(receiving) particles" << endl; + global_log->debug() << "broadcasting(receiving) particles" << std::endl; MPI_Bcast(particle_buff, PARTICLE_BUFFER_SIZE, mpi_Particle, 0, domainDecomp->getCommunicator()); particle_buff_pos = 0; } @@ -170,13 +169,13 @@ void ReplicaGenerator::readReplicaPhaseSpaceData(SubDomain& subDomain, DomainDec subDomain.vecParticles.push_back(m); } } - global_log->debug() << "broadcasting(sending/receiving) particles complete" << endl; + global_log->debug() << "broadcasting(sending/receiving) particles complete" << std::endl; #endif - global_log->info() << "Reading Molecules done" << endl; + global_log->info() << "Reading Molecules done" << std::endl; } void ReplicaGenerator::readXML(XMLfileUnits& xmlconfig) { - global_log->debug() << "Reading config for ReplicaGenerator" << endl; + global_log->debug() << "Reading config for ReplicaGenerator" << std::endl; _nSystemType = ST_UNKNOWN; std::string strType = "unknown"; @@ -189,7 +188,7 @@ void ReplicaGenerator::readXML(XMLfileUnits& xmlconfig) { _nSystemType = ST_HETEROGENEOUS_LIQUID_VAPOR; } else { global_log->error() << "Specified wrong type at XML path: " << xmlconfig.getcurrentnodepath() << "/type" - << endl; + << std::endl; Simulation::exit(-1); } @@ -233,14 +232,14 @@ void ReplicaGenerator::readXML(XMLfileUnits& xmlconfig) { // change identity of molecules by component ID (zero based)) { // vapor system - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); if(xmlconfig.changecurrentnode("componentIDs/vapor")) { uint8_t numChanges = 0; XMLfile::Query query = xmlconfig.query("change"); numChanges = query.card(); - global_log->info() << "Number of components to change: " << (uint32_t) numChanges << endl; + global_log->info() << "Number of components to change: " << (uint32_t) numChanges << std::endl; if(numChanges < 1) { - global_log->error() << "No component change defined in XML-config file. Program exit ..." << endl; + global_log->error() << "No component change defined in XML-config file. Program exit ..." << std::endl; Simulation::exit(-1); } XMLfile::Query::const_iterator changeIter; @@ -261,9 +260,9 @@ void ReplicaGenerator::readXML(XMLfileUnits& xmlconfig) { uint8_t numChanges = 0; XMLfile::Query query = xmlconfig.query("change"); numChanges = query.card(); - global_log->info() << "Number of components to change: " << (uint32_t) numChanges << endl; + global_log->info() << "Number of components to change: " << (uint32_t) numChanges << std::endl; if(numChanges < 1) { - global_log->error() << "No component change defined in XML-config file. Program exit ..." << endl; + global_log->error() << "No component change defined in XML-config file. Program exit ..." << std::endl; Simulation::exit(-1); } XMLfile::Query::const_iterator changeIter; @@ -284,7 +283,7 @@ void ReplicaGenerator::readXML(XMLfileUnits& xmlconfig) { void ReplicaGenerator::init() { DomainDecompBase* domainDecomp = &global_simulation->domainDecomposition(); - global_log->info() << domainDecomp->getRank() << ": Init Replica VLE ..." << endl; + global_log->info() << domainDecomp->getRank() << ": Init Replica VLE ..." << std::endl; for(auto&& sd : _vecSubDomains) { this->readReplicaPhaseSpaceHeader(sd); @@ -330,7 +329,7 @@ void ReplicaGenerator::init() { dLength[2] = _numBlocksXZ * _vecSubDomains.at(0).arrBoxLength.at(2); for(uint8_t di = 0; di < 3; ++di) global_simulation->getDomain()->setGlobalLength(di, dLength[di]); - global_log->info() << "Domain box length = " << dLength[0] << ", " << dLength[1] << ", " << dLength[2] << endl; + global_log->info() << "Domain box length = " << dLength[0] << ", " << dLength[1] << ", " << dLength[2] << std::endl; /* // Reset domain decomposition @@ -338,13 +337,13 @@ void ReplicaGenerator::init() { delete domainDecomp; } #ifndef ENABLE_MPI - global_log->info() << "Initializing the alibi domain decomposition ... " << endl; + global_log->info() << "Initializing the alibi domain decomposition ... " << std::endl; domainDecomp = new DomainDecompBase(); #else - global_log->info() << "Initializing the standard domain decomposition ... " << endl; + global_log->info() << "Initializing the standard domain decomposition ... " << std::endl; domainDecomp = (DomainDecompBase*) new DomainDecomposition(); #endif - global_log->info() << "Initialization done" << endl; + global_log->info() << "Initialization done" << std::endl; domainDecomp->readXML(xmlconfig); */ @@ -407,24 +406,24 @@ ReplicaGenerator::readPhaseSpace(ParticleContainer* particleContainer, Domain* d } #ifndef NDEBUG - cout << domainDecomp->getRank() << ": bbMin = " << bbMin[0] << ", " << bbMin[1] << ", " << bbMin[2] << endl; - cout << domainDecomp->getRank() << ": bbMax = " << bbMax[0] << ", " << bbMax[1] << ", " << bbMax[2] << endl; - cout << domainDecomp->getRank() << ": bbLength = " << bbLength[0] << ", " << bbLength[1] << ", " << bbLength[2] - << endl; - cout << domainDecomp->getRank() << ": numBlocks = " << numBlocks[0] << ", " << numBlocks[1] << ", " << numBlocks[2] - << endl; - cout << domainDecomp->getRank() << ": startIndex = " << startIndex[0] << ", " << startIndex[1] << ", " - << startIndex[2] << endl; - cout << domainDecomp->getRank() << ": BoxLength = " << _vecSubDomains.at(0).arrBoxLength.at(0) << "," + std::cout << domainDecomp->getRank() << ": bbMin = " << bbMin[0] << ", " << bbMin[1] << ", " << bbMin[2] << std::endl; + std::cout << domainDecomp->getRank() << ": bbMax = " << bbMax[0] << ", " << bbMax[1] << ", " << bbMax[2] << std::endl; + std::cout << domainDecomp->getRank() << ": bbLength = " << bbLength[0] << ", " << bbLength[1] << ", " << bbLength[2] + << std::endl; + std::cout << domainDecomp->getRank() << ": numBlocks = " << numBlocks[0] << ", " << numBlocks[1] << ", " << numBlocks[2] + << std::endl; + std::cout << domainDecomp->getRank() << ": startIndex = " << startIndex[0] << ", " << startIndex[1] << ", " + << startIndex[2] << std::endl; + std::cout << domainDecomp->getRank() << ": BoxLength = " << _vecSubDomains.at(0).arrBoxLength.at(0) << "," " " << _vecSubDomains.at(0).arrBoxLength.at(1) << "," - " " << _vecSubDomains.at(0).arrBoxLength.at(2) << endl; - cout << domainDecomp->getRank() << ": bbLength/BoxLength = " + " " << _vecSubDomains.at(0).arrBoxLength.at(2) << std::endl; + std::cout << domainDecomp->getRank() << ": bbLength/BoxLength = " << bbLength[0] / _vecSubDomains.at(0).arrBoxLength.at(0) << "," " " << bbLength[1] / _vecSubDomains.at(0).arrBoxLength.at(1) << "," " " - << bbLength[2] / _vecSubDomains.at(0).arrBoxLength.at(2) << endl; + << bbLength[2] / _vecSubDomains.at(0).arrBoxLength.at(2) << std::endl; #endif std::array bl = _vecSubDomains.at(0).arrBoxLength; @@ -520,18 +519,18 @@ ReplicaGenerator::readPhaseSpace(ParticleContainer* particleContainer, Domain* d domainDecomp->collCommFinalize(); mardyn_assert(numParticlesGlobal == _numParticlesTotal - numAddedParticlesFreespaceGlobal); - global_log->info() << "Number of particles calculated by number of blocks : " << setw(24) << _numParticlesTotal - << endl; - global_log->info() << "Number of particles located in freespace (not added): " << setw(24) - << numAddedParticlesFreespaceGlobal << endl; - global_log->info() << "Number of particles added to particle container : " << setw(24) << numParticlesGlobal - << endl; + global_log->info() << "Number of particles calculated by number of blocks : " << std::setw(24) << _numParticlesTotal + << std::endl; + global_log->info() << "Number of particles located in freespace (not added): " << std::setw(24) + << numAddedParticlesFreespaceGlobal << std::endl; + global_log->info() << "Number of particles added to particle container : " << std::setw(24) << numParticlesGlobal + << std::endl; if(domainDecomp->getRank() == 0 && numParticlesGlobal != _numParticlesTotal - numAddedParticlesFreespaceGlobal) { global_log->info() << "Number of particles: " << numParticlesGlobal << " (added)" " != " << (_numParticlesTotal - numAddedParticlesFreespaceGlobal) << " (expected). Program exit ..." - << endl; + << std::endl; Simulation::exit(-1); } diff --git a/src/io/ReplicaGenerator.h b/src/io/ReplicaGenerator.h index bfee0f2681..c1994f7a78 100755 --- a/src/io/ReplicaGenerator.h +++ b/src/io/ReplicaGenerator.h @@ -10,7 +10,6 @@ #include #include -using namespace std; enum SystemTypes : uint8_t { ST_UNKNOWN = 0, diff --git a/src/io/ResultWriter.cpp b/src/io/ResultWriter.cpp index abf522f28f..17e97e8c9b 100644 --- a/src/io/ResultWriter.cpp +++ b/src/io/ResultWriter.cpp @@ -6,26 +6,25 @@ #include "utils/Logger.h" #include -using Log::global_log; void ResultWriter::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "[ResultWriter] Write frequency: " << _writeFrequency << endl; + global_log->info() << "[ResultWriter] Write frequency: " << _writeFrequency << std::endl; _outputPrefix = "mardyn"; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "[ResultWriter] Output prefix: " << _outputPrefix << endl; + global_log->info() << "[ResultWriter] Output prefix: " << _outputPrefix << std::endl; size_t acc_steps = 1000; xmlconfig.getNodeValue("accumulation_steps", acc_steps); _U_pot_acc = new Accumulator(acc_steps); _p_acc = new Accumulator(acc_steps); - global_log->info() << "[ResultWriter] Accumulation steps: " << acc_steps << endl; + global_log->info() << "[ResultWriter] Accumulation steps: " << acc_steps << std::endl; _writePrecision = 5; xmlconfig.getNodeValue("writeprecision", _writePrecision); - global_log->info() << "[ResultWriter] Write precision: " << _writePrecision << endl; + global_log->info() << "[ResultWriter] Write precision: " << _writePrecision << std::endl; } void ResultWriter::init(ParticleContainer * /*particleContainer*/, @@ -35,10 +34,10 @@ void ResultWriter::init(ParticleContainer * /*particleContainer*/, const auto now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); tm unused{}; const auto nowStr = std::put_time(localtime_r(&now, &unused), "%c"); - string resultfile(_outputPrefix+".res"); + std::string resultfile(_outputPrefix+".res"); _resultStream.open(resultfile.c_str(), std::ios::out); - _resultStream << "# ls1 MarDyn simulation started at " << nowStr << endl; - _resultStream << "# Averages are the accumulated values over " << _U_pot_acc->getWindowLength() << " time steps."<< endl; + _resultStream << "# ls1 MarDyn simulation started at " << nowStr << std::endl; + _resultStream << "# Averages are the accumulated values over " << _U_pot_acc->getWindowLength() << " time steps."<< std::endl; _resultStream << std::setw(10) << "# step" << std::setw(_writePrecision+15) << "time" << std::setw(_writePrecision+15) << "U_pot" << std::setw(_writePrecision+15) << "U_pot_avg" @@ -48,7 +47,7 @@ void ResultWriter::init(ParticleContainer * /*particleContainer*/, << std::setw(_writePrecision+15) << "beta_rot" << std::setw(_writePrecision+15) << "c_v" << std::setw(_writePrecision+15) << "N" - << endl; + << std::endl; } } @@ -72,7 +71,7 @@ void ResultWriter::endStep(ParticleContainer *particleContainer, DomainDecompBas << std::setw(_writePrecision+15) << std::scientific << std::setprecision(_writePrecision) << domain->getGlobalBetaRot() << std::setw(_writePrecision+15) << std::scientific << std::setprecision(_writePrecision) << cv << std::setw(_writePrecision+15) << std::scientific << std::setprecision(_writePrecision) << globalNumMolecules - << endl; + << std::endl; } } @@ -83,7 +82,7 @@ void ResultWriter::finish(ParticleContainer * /*particleContainer*/, const auto now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); tm unused{}; const auto nowStr = std::put_time(localtime_r(&now, &unused), "%c"); - _resultStream << "# ls1 mardyn simulation finished at " << nowStr << endl; + _resultStream << "# ls1 mardyn simulation finished at " << nowStr << std::endl; _resultStream.close(); } } diff --git a/src/io/SysMonOutput.cpp b/src/io/SysMonOutput.cpp index 0cbac87cd9..0a93a0bc23 100644 --- a/src/io/SysMonOutput.cpp +++ b/src/io/SysMonOutput.cpp @@ -7,8 +7,6 @@ #include "utils/xmlfileUnits.h" using Log::global_log; -using namespace std; - SysMonOutput::SysMonOutput() : _writeFrequency(1) {} @@ -16,15 +14,15 @@ SysMonOutput::SysMonOutput() : _writeFrequency(1) {} void SysMonOutput::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << endl; + global_log->info() << "Write frequency: " << _writeFrequency << std::endl; SysMon* sysmon = SysMon::getSysMon(); XMLfile::Query query = xmlconfig.query("expression"); //string oldpath = xmlconfig.getcurrentnodepath(); for(XMLfile::Query::const_iterator exprIter = query.begin(); exprIter; exprIter++ ) { xmlconfig.changecurrentnode(exprIter); - string expr(xmlconfig.getNodeValue_string(".")); - string label(xmlconfig.getNodeValue_string(string("@label"))); + std::string expr(xmlconfig.getNodeValue_string(".")); + std::string label(xmlconfig.getNodeValue_string(std::string("@label"))); if(label.empty()) { sysmon->addExpression(expr); @@ -51,8 +49,8 @@ void SysMonOutput::endStep(ParticleContainer * /*particleContainer*/, DomainDeco if((simstep % _writeFrequency) == 0) { SysMon* sysmon = SysMon::getSysMon(); sysmon->updateExpressionValues(); - ostringstream oss; - oss << "System Monitor (simulation step " << simstep << ")" << endl; + std::ostringstream oss; + oss << "System Monitor (simulation step " << simstep << ")" << std::endl; global_log->info() << sysmon->InfoString(oss.str(),"\t"); } } diff --git a/src/io/TaskTimingProfiler.cpp b/src/io/TaskTimingProfiler.cpp index 3075cf815a..790469a977 100644 --- a/src/io/TaskTimingProfiler.cpp +++ b/src/io/TaskTimingProfiler.cpp @@ -75,31 +75,31 @@ void TaskTimingProfiler::dump(std::string filename) { std::cout << "done!" << std::endl; #ifdef QUICKSCHED - global_log->info() << "Task ids:" << endl + global_log->info() << "Task ids:" << std::endl << std::setw(42) << "" << "P2PPreprocessSingleCell = " - << bhfmm::FastMultipoleMethod::taskType::P2PPreprocessSingleCell << endl + << bhfmm::FastMultipoleMethod::taskType::P2PPreprocessSingleCell << std::endl << std::setw(42) << "" << "P2Pc08StepBlock = " - << bhfmm::FastMultipoleMethod::taskType::P2Pc08StepBlock << endl + << bhfmm::FastMultipoleMethod::taskType::P2Pc08StepBlock << std::endl << std::setw(42) << "" << "P2PPostprocessSingleCell = " - << bhfmm::FastMultipoleMethod::taskType::P2PPostprocessSingleCell << endl + << bhfmm::FastMultipoleMethod::taskType::P2PPostprocessSingleCell << std::endl << std::setw(42) << "" << "P2MCompleteCell = " - << bhfmm::FastMultipoleMethod::taskType::P2MCompleteCell << endl + << bhfmm::FastMultipoleMethod::taskType::P2MCompleteCell << std::endl << std::setw(42) << "" << "M2MCompleteCell = " - << bhfmm::FastMultipoleMethod::taskType::M2MCompleteCell << endl + << bhfmm::FastMultipoleMethod::taskType::M2MCompleteCell << std::endl << std::setw(42) << "" << "M2LInitializeCell = " - << bhfmm::FastMultipoleMethod::taskType::M2LInitializeCell << endl + << bhfmm::FastMultipoleMethod::taskType::M2LInitializeCell << std::endl << std::setw(42) << "" << "M2LInitializeSource = " - << bhfmm::FastMultipoleMethod::taskType::M2LInitializeSource << endl + << bhfmm::FastMultipoleMethod::taskType::M2LInitializeSource << std::endl << std::setw(42) << "" << "M2LTranslation = " - << bhfmm::FastMultipoleMethod::taskType::M2LTranslation << endl + << bhfmm::FastMultipoleMethod::taskType::M2LTranslation << std::endl << std::setw(42) << "" << "M2LPair2Way = " - << bhfmm::FastMultipoleMethod::taskType::M2LPair2Way << endl + << bhfmm::FastMultipoleMethod::taskType::M2LPair2Way << std::endl << std::setw(42) << "" << "M2LFinalizeCell = " - << bhfmm::FastMultipoleMethod::taskType::M2LFinalizeCell << endl + << bhfmm::FastMultipoleMethod::taskType::M2LFinalizeCell << std::endl << std::setw(42) << "" << "L2LCompleteCell = " - << bhfmm::FastMultipoleMethod::taskType::L2LCompleteCell << endl + << bhfmm::FastMultipoleMethod::taskType::L2LCompleteCell << std::endl << std::setw(42) << "" << "L2PCompleteCell = " - << bhfmm::FastMultipoleMethod::taskType::L2PCompleteCell << endl; + << bhfmm::FastMultipoleMethod::taskType::L2PCompleteCell << std::endl; #endif /* QUICKSCHED */ } diff --git a/src/io/TcTS.cpp b/src/io/TcTS.cpp index 995c126309..544ebf7c49 100644 --- a/src/io/TcTS.cpp +++ b/src/io/TcTS.cpp @@ -12,8 +12,6 @@ #include "utils/Logger.h" #include "utils/Random.h" -using namespace std; -using Log::global_log; #define PRECISION 5 #define VARFRACTION 0.125 @@ -26,13 +24,13 @@ void MkTcTSGenerator::readXML(XMLfileUnits& xmlconfig) { //has to be between 0 and 1 l1_offset = 0.3; xmlconfig.getNodeValue("layer1/l1_ratio", l1_ratio); - global_log->info() << "Layer 1, ratio: " << l1_ratio << endl; + global_log->info() << "Layer 1, ratio: " << l1_ratio << std::endl; xmlconfig.getNodeValue("layer1/l1_offset", l1_offset); xmlconfig.getNodeValue("layer1/density", rho1); - global_log->info() << "Layer 1, density: " << rho1 << endl; + global_log->info() << "Layer 1, density: " << rho1 << std::endl; rho2 = rho1; xmlconfig.getNodeValue("layer2/density", rho2); - global_log->info() << "Layer 2, density: " << rho2 << endl; + global_log->info() << "Layer 2, density: " << rho2 << std::endl; } void MkTcTSGenerator::readPhaseSpaceHeader(Domain* domain, double /*timestep*/) { @@ -41,7 +39,7 @@ void MkTcTSGenerator::readPhaseSpaceHeader(Domain* domain, double /*timestep*/) unsigned long MkTcTSGenerator::readPhaseSpace(ParticleContainer* particleContainer, Domain* domain, DomainDecompBase*) { // Mixing coefficients - vector& dmixcoeff = domain->getmixcoeff(); + std::vector& dmixcoeff = domain->getmixcoeff(); dmixcoeff.clear(); unsigned int numcomponents = _simulation.getEnsemble()->getComponents()->size(); @@ -80,7 +78,7 @@ MkTcTSGenerator::readPhaseSpace(ParticleContainer* particleContainer, Domain* do fl_units[2][i] = static_cast(ceil(bxbz_id / fl_units[0][i])); for(int d = 0; d < 3; d++) fl_unit[d][i] = ((d == 1) ? curr_ratio : 1.0) * box[d] / static_cast(fl_units[d][i]); global_log->debug() << "Elementary cell " << i << ": " << fl_unit[0][i] << " x " << fl_unit[1][i] << " x " - << fl_unit[2][i] << endl; + << fl_unit[2][i] << std::endl; } Random* rnd = new Random(); @@ -142,7 +140,7 @@ MkTcTSGenerator::readPhaseSpace(ParticleContainer* particleContainer, Domain* do } global_log->debug() << "Filling " << N[l] << " of 3*" << fl_units[0][l] << "*" << fl_units[1][l] << "*" << fl_units[2][l] - << " = " << slots[l] << " slots (ideally " << N_id[l] << ")" << endl; + << " = " << slots[l] << " slots (ideally " << N_id[l] << ")" << std::endl; } double loffset[3][2]; diff --git a/src/io/TimerProfiler.cpp b/src/io/TimerProfiler.cpp index 6b1eb470e9..2c10c046e8 100644 --- a/src/io/TimerProfiler.cpp +++ b/src/io/TimerProfiler.cpp @@ -14,10 +14,9 @@ #include "utils/mardyn_assert.h" #include "utils/xmlfileUnits.h" -using namespace std; using Log::global_log; -const string TimerProfiler::_baseTimerName = "_baseTimer"; +const std::string TimerProfiler::_baseTimerName = "_baseTimer"; TimerProfiler::TimerProfiler(): _numElapsedIterations(0), _displayMode(Displaymode::ALL) { _timers[_baseTimerName] = _Timer(_baseTimerName); @@ -27,7 +26,7 @@ TimerProfiler::TimerProfiler(): _numElapsedIterations(0), _displayMode(Displaymo void TimerProfiler::readXML(XMLfileUnits& xmlconfig) { std::string displayMode; if(xmlconfig.getNodeValue("displaymode", displayMode)) { - global_log->info() << "Timer display mode: " << displayMode << endl; + global_log->info() << "Timer display mode: " << displayMode << std::endl; if(displayMode == "all") { setDisplayMode(Displaymode::ALL); } else if (displayMode == "active") { @@ -37,13 +36,13 @@ void TimerProfiler::readXML(XMLfileUnits& xmlconfig) { } else if (displayMode == "none") { setDisplayMode(Displaymode::NONE); } else { - global_log->error() << "Unknown display mode: " << displayMode << endl; + global_log->error() << "Unknown display mode: " << displayMode << std::endl; } } } -Timer* TimerProfiler::getTimer(string timerName){ +Timer* TimerProfiler::getTimer(std::string timerName){ auto timerProfiler = _timers.find(timerName); if(timerProfiler != _timers.end()) { return (timerProfiler->second)._timer.get(); @@ -51,8 +50,8 @@ Timer* TimerProfiler::getTimer(string timerName){ return nullptr; } -void TimerProfiler::registerTimer(string timerName, vector parentTimerNames, Timer *timer, bool activate){ - global_log->debug() << "Registering timer: " << timerName << " [parents: " << string_utils::join(parentTimerNames, string(", ")) << "]" << endl; +void TimerProfiler::registerTimer(std::string timerName, std::vector parentTimerNames, Timer *timer, bool activate){ + global_log->debug() << "Registering timer: " << timerName << " [parents: " << string_utils::join(parentTimerNames, std::string(", ")) << "]" << std::endl; if (!activate && timer){ timer->deactivateTimer(); @@ -68,22 +67,22 @@ void TimerProfiler::registerTimer(string timerName, vector parentTimerNa } } -void TimerProfiler::activateTimer(string timerName){ +void TimerProfiler::activateTimer(std::string timerName){ if (!_timers.count(timerName)) return ; _timers[timerName]._timer->activateTimer(); } -void TimerProfiler::deactivateTimer(string timerName){ +void TimerProfiler::deactivateTimer(std::string timerName){ if (!_timers.count(timerName)) return ; _timers[timerName]._timer->deactivateTimer(); } -void TimerProfiler::setSyncTimer(string timerName, bool sync){ +void TimerProfiler::setSyncTimer(std::string timerName, bool sync){ if (!_timers.count(timerName)) return ; _timers[timerName]._timer->set_sync(sync); } -void TimerProfiler::print(string timerName, string outputPrefix){ +void TimerProfiler::print(std::string timerName, std::string outputPrefix){ if ( ! _checkTimer(timerName, false)) { _debugMessage(timerName); return; @@ -92,11 +91,11 @@ void TimerProfiler::print(string timerName, string outputPrefix){ (getDisplayMode() == Displaymode::ACTIVE && getTimer(timerName)->isActive()) || (getDisplayMode() == Displaymode::NON_ZERO && getTimer(timerName)->get_etime() > 0) ) { - global_log->info() << outputPrefix << getOutputString(timerName) << getTime(timerName) << " sec" << endl; + global_log->info() << outputPrefix << getOutputString(timerName) << getTime(timerName) << " sec" << std::endl; } } -void TimerProfiler::printTimers(string timerName, string outputPrefix){ +void TimerProfiler::printTimers(std::string timerName, std::string outputPrefix){ if (!_timers.count(timerName)) return ; if (_checkTimer(timerName)){ print(timerName, outputPrefix); @@ -107,7 +106,7 @@ void TimerProfiler::printTimers(string timerName, string outputPrefix){ } } -void TimerProfiler::start(string timerName){ +void TimerProfiler::start(std::string timerName){ #ifdef _OPENMP #pragma omp critical #endif @@ -120,7 +119,7 @@ void TimerProfiler::start(string timerName){ } } -void TimerProfiler::stop(string timerName){ +void TimerProfiler::stop(std::string timerName){ #ifdef _OPENMP #pragma omp critical #endif @@ -133,7 +132,7 @@ void TimerProfiler::stop(string timerName){ } } -void TimerProfiler::reset(string timerName){ +void TimerProfiler::reset(std::string timerName){ if (_checkTimer(timerName)){ getTimer(timerName)->reset(); } @@ -142,7 +141,7 @@ void TimerProfiler::reset(string timerName){ } } -void TimerProfiler::resetTimers(string startingTimerName){ +void TimerProfiler::resetTimers(std::string startingTimerName){ if (startingTimerName.compare(_baseTimerName)) { _numElapsedIterations = 0; } @@ -154,11 +153,11 @@ void TimerProfiler::resetTimers(string startingTimerName){ } } -void TimerProfiler::readInitialTimersFromFile(string fileName){ +void TimerProfiler::readInitialTimersFromFile(std::string fileName){ //temporary until read from .xml file is implemented //timer classes for grouping timers -> easier printing and resetting - vector timerClasses = { + std::vector timerClasses = { "COMMUNICATION_PARTNER", "SIMULATION", "UNIFORM_PSEUDO_PARTICLE_CONTAINER", @@ -175,69 +174,69 @@ void TimerProfiler::readInitialTimersFromFile(string fileName){ * 3) UNIFORM_PSEUDO_PARTICLE_CONTAINER_GATHER_EVAL_M -> not used at all... * 4) UNIFORM_PSEUDO_PARTICLE_CONTAINER_GATHER_EVAL_LM -> not used at all... **************************************************************/ - vector, bool>> timerAttrs = { - make_tuple("VECTORIZATION_TUNER_TUNER", vector{"TUNERS"}, true), - make_tuple("AQUEOUS_NA_CL_GENERATOR_INPUT", vector{"GENERATORS"}, true), - make_tuple("CRYSTAL_LATTICE_GENERATOR_INPUT", vector{"GENERATORS"}, true), - make_tuple("CUBIC_GRID_GENERATOR_INPUT", vector{"GENERATORS"}, true), - make_tuple("DROPLET_GENERATOR_INPUT", vector{"GENERATORS"}, true), - make_tuple("MS2RST_GENERATOR_INPUT", vector{"GENERATORS"}, true), - make_tuple("REYLEIGH_TAYLOR_GENERATOR_INPUT", vector{"GENERATORS"}, true), - make_tuple("REPLICA_GENERATOR_VLE_INPUT", vector{"GENERATORS"}, true), - make_tuple("L2P_CELL_PROCESSOR_L2P", vector{"CELL_PROCESSORS"}, true), - make_tuple("P2M_CELL_PROCESSOR_P2M", vector{"CELL_PROCESSORS"}, true), - make_tuple("VECTORIZED_CHARGE_P2P_CELL_PROCESSOR_VCP2P", vector{"CELL_PROCESSORS"}, true), - make_tuple("VECTORIZED_LJP2P_CELL_PROCESSOR_VLJP2P", vector{"CELL_PROCESSORS"}, true), - make_tuple("BINARY_READER_INPUT", vector{"IO"}, true), - make_tuple("INPUT_OLDSTYLE_INPUT", vector{"IO"}, true), - make_tuple("MPI_IO_READER_INPUT", vector{"IO"}, true), - make_tuple("MPI_CHECKPOINT_WRITER_INPUT", vector{"IO"}, true), - make_tuple("SIMULATION_LOOP", vector{"SIMULATION"}, true), - make_tuple("SIMULATION_DECOMPOSITION", vector{"SIMULATION_LOOP"}, true), - make_tuple("SIMULATION_COMPUTATION", vector{"SIMULATION_LOOP"}, true), + std::vector, bool>> timerAttrs = { + std::make_tuple("VECTORIZATION_TUNER_TUNER", std::vector{"TUNERS"}, true), + std::make_tuple("AQUEOUS_NA_CL_GENERATOR_INPUT", std::vector{"GENERATORS"}, true), + std::make_tuple("CRYSTAL_LATTICE_GENERATOR_INPUT", std::vector{"GENERATORS"}, true), + std::make_tuple("CUBIC_GRID_GENERATOR_INPUT", std::vector{"GENERATORS"}, true), + std::make_tuple("DROPLET_GENERATOR_INPUT", std::vector{"GENERATORS"}, true), + std::make_tuple("MS2RST_GENERATOR_INPUT", std::vector{"GENERATORS"}, true), + std::make_tuple("REYLEIGH_TAYLOR_GENERATOR_INPUT", std::vector{"GENERATORS"}, true), + std::make_tuple("REPLICA_GENERATOR_VLE_INPUT", std::vector{"GENERATORS"}, true), + std::make_tuple("L2P_CELL_PROCESSOR_L2P", std::vector{"CELL_PROCESSORS"}, true), + std::make_tuple("P2M_CELL_PROCESSOR_P2M", std::vector{"CELL_PROCESSORS"}, true), + std::make_tuple("VECTORIZED_CHARGE_P2P_CELL_PROCESSOR_VCP2P", std::vector{"CELL_PROCESSORS"}, true), + std::make_tuple("VECTORIZED_LJP2P_CELL_PROCESSOR_VLJP2P", std::vector{"CELL_PROCESSORS"}, true), + std::make_tuple("BINARY_READER_INPUT", std::vector{"IO"}, true), + std::make_tuple("INPUT_OLDSTYLE_INPUT", std::vector{"IO"}, true), + std::make_tuple("MPI_IO_READER_INPUT", std::vector{"IO"}, true), + std::make_tuple("MPI_CHECKPOINT_WRITER_INPUT", std::vector{"IO"}, true), + std::make_tuple("SIMULATION_LOOP", std::vector{"SIMULATION"}, true), + std::make_tuple("SIMULATION_DECOMPOSITION", std::vector{"SIMULATION_LOOP"}, true), + std::make_tuple("SIMULATION_COMPUTATION", std::vector{"SIMULATION_LOOP"}, true), #ifdef QUICKSCHED - make_tuple("QUICKSCHED", vector{"SIMULATION_LOOP"}, true), + std::make_tuple("QUICKSCHED", std::vector{"SIMULATION_LOOP"}, true), #endif - make_tuple("SIMULATION_PER_STEP_IO", vector{"SIMULATION_LOOP"}, true), - make_tuple("SIMULATION_IO", vector{"SIMULATION"}, true), - make_tuple("SIMULATION_UPDATE_CONTAINER", vector{"SIMULATION_DECOMPOSITION"}, true), - make_tuple("SIMULATION_MPI_OMP_COMMUNICATION", vector{"SIMULATION_DECOMPOSITION"}, true), - make_tuple("SIMULATION_UPDATE_CACHES", vector{"SIMULATION_DECOMPOSITION"}, true), - make_tuple("SIMULATION_FORCE_CALCULATION", vector{"SIMULATION_COMPUTATION"}, true), - make_tuple("COMMUNICATION_PARTNER_INIT_SEND", vector{"COMMUNICATION_PARTNER", "SIMULATION_MPI_OMP_COMMUNICATION"}, true), - make_tuple("COMMUNICATION_PARTNER_TEST_RECV", vector{"COMMUNICATION_PARTNER", "SIMULATION_MPI_OMP_COMMUNICATION"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_PROCESS_CELLS", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_ALL_REDUCE", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GATHER_WELL_SEP_LO_GLOBAL", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_PROPAGATE_CELL_LO_GLOBAL", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_COMBINE_MP_CELL_GLOBAL", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_COMBINE_MP_CELL_LOKAL", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GATHER_WELL_SEP_LO_LOKAL", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_PROPAGATE_CELL_LO_LOKAL", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_PROCESS_FAR_FIELD", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_COMMUNICATION_HALOS", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_HALO_GATHER", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_BUSY_WAITING", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_FMM_COMPLETE", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GLOBAL_M2M_CALCULATION", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GLOBAL_M2M_INIT", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GLOBAL_M2M_FINALIZE", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GLOBAL_M2M_TRAVERSAL", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GATHER_EVAL_M", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GATHER_EVAL_LM", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_ALL_REDUCE_ME", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), - make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_STOP_LEVEL", vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true) + std::make_tuple("SIMULATION_PER_STEP_IO", std::vector{"SIMULATION_LOOP"}, true), + std::make_tuple("SIMULATION_IO", std::vector{"SIMULATION"}, true), + std::make_tuple("SIMULATION_UPDATE_CONTAINER", std::vector{"SIMULATION_DECOMPOSITION"}, true), + std::make_tuple("SIMULATION_MPI_OMP_COMMUNICATION", std::vector{"SIMULATION_DECOMPOSITION"}, true), + std::make_tuple("SIMULATION_UPDATE_CACHES", std::vector{"SIMULATION_DECOMPOSITION"}, true), + std::make_tuple("SIMULATION_FORCE_CALCULATION", std::vector{"SIMULATION_COMPUTATION"}, true), + std::make_tuple("COMMUNICATION_PARTNER_INIT_SEND", std::vector{"COMMUNICATION_PARTNER", "SIMULATION_MPI_OMP_COMMUNICATION"}, true), + std::make_tuple("COMMUNICATION_PARTNER_TEST_RECV", std::vector{"COMMUNICATION_PARTNER", "SIMULATION_MPI_OMP_COMMUNICATION"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_PROCESS_CELLS", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_ALL_REDUCE", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GATHER_WELL_SEP_LO_GLOBAL", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_PROPAGATE_CELL_LO_GLOBAL", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_COMBINE_MP_CELL_GLOBAL", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_COMBINE_MP_CELL_LOKAL", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GATHER_WELL_SEP_LO_LOKAL", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_PROPAGATE_CELL_LO_LOKAL", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_PROCESS_FAR_FIELD", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_COMMUNICATION_HALOS", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_HALO_GATHER", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_BUSY_WAITING", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_FMM_COMPLETE", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GLOBAL_M2M_CALCULATION", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GLOBAL_M2M_INIT", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GLOBAL_M2M_FINALIZE", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GLOBAL_M2M_TRAVERSAL", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GATHER_EVAL_M", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_GATHER_EVAL_LM", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_ALL_REDUCE_ME", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true), + std::make_tuple("UNIFORM_PSEUDO_PARTICLE_CONTAINER_STOP_LEVEL", std::vector{"UNIFORM_PSEUDO_PARTICLE_CONTAINER"}, true) }; for (auto timerClass : timerClasses){ - registerTimer(timerClass, vector()); + registerTimer(timerClass, std::vector()); } for (auto timerAttr : timerAttrs){ - registerTimer(get<0>(timerAttr), get<1>(timerAttr), new Timer(), get<2>(timerAttr)); + registerTimer(std::get<0>(timerAttr), std::get<1>(timerAttr), new Timer(), std::get<2>(timerAttr)); } } -void TimerProfiler::setOutputString(string timerName, string outputString){ +void TimerProfiler::setOutputString(std::string timerName, std::string outputString){ if (!_timers.count(timerName)) return ; if (outputString[outputString.length() - 1] != ' ') { outputString += " "; @@ -245,16 +244,16 @@ void TimerProfiler::setOutputString(string timerName, string outputString){ _timers[timerName]._outputString = outputString; } -string TimerProfiler::getOutputString(string timerName){ - if (!_timers.count(timerName)) return string(""); - string output = _timers[timerName]._outputString; +std::string TimerProfiler::getOutputString(std::string timerName){ + if (!_timers.count(timerName)) return std::string(""); + std::string output = _timers[timerName]._outputString; if (output.compare("") == 0){ output = "Timer "+timerName+" took: "; } return output; } -double TimerProfiler::getTime(string timerName){ +double TimerProfiler::getTime(std::string timerName){ auto timer = getTimer(timerName); if(timer != nullptr) { return timer->get_etime(); @@ -264,15 +263,15 @@ double TimerProfiler::getTime(string timerName){ /* private Methods */ -bool TimerProfiler::_checkTimer(string timerName, bool checkActive){ +bool TimerProfiler::_checkTimer(std::string timerName, bool checkActive){ return _timers.count(timerName) && _timers[timerName]._timer && (!checkActive || _timers[timerName]._timer->isActive()); } -void TimerProfiler::_debugMessage(string timerName){ +void TimerProfiler::_debugMessage(std::string timerName){ if(_timers.count(timerName)){ global_log->debug()<<"Timer "<debug()<<"Timer "<debug()<<"Timer "<info() << "Write frequency: " << _writeFrequency << endl; + global_log->info() << "Write frequency: " << _writeFrequency << std::endl; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "Output prefix: " << _outputPrefix << endl; + global_log->info() << "Output prefix: " << _outputPrefix << std::endl; XMLfile::Query query = xmlconfig.query("timers/timer"); std::string oldpath = xmlconfig.getcurrentnodepath(); @@ -43,12 +43,12 @@ void TimerWriter::init(ParticleContainer* /*particleContainer*/, DomainDecompBas auto rank = domainDecomp->getRank(); std::stringstream filename; - const auto time_tNow = std::chrono::system_clock::to_time_t(chrono::system_clock::now()); + const auto time_tNow = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); const auto maxRank = domainDecomp->getNumProcs(); const auto numDigitsMaxRank = std::to_string(maxRank).length(); tm unused{}; - filename << _outputPrefix << "-rank" << setfill('0') << setw(numDigitsMaxRank) << rank << "_" + filename << _outputPrefix << "-rank" << std::setfill('0') << std::setw(numDigitsMaxRank) << rank << "_" << std::put_time(localtime_r(&time_tNow, &unused), "%Y-%m-%d_%H-%M-%S") << ".dat"; _fileStream.open(filename.str(), std::ofstream::out); diff --git a/src/io/VISWriter.cpp b/src/io/VISWriter.cpp index ce9a029985..b5ecdf2af3 100644 --- a/src/io/VISWriter.cpp +++ b/src/io/VISWriter.cpp @@ -15,10 +15,8 @@ #include #endif -using Log::global_log; -using namespace std; -VISWriter::VISWriter(unsigned long writeFrequency, string outputPrefix) { +VISWriter::VISWriter(unsigned long writeFrequency, std::string outputPrefix) { _outputPrefix = outputPrefix; _writeFrequency = writeFrequency; _wroteVIS = false; @@ -36,24 +34,24 @@ VISWriter::~VISWriter(){} void VISWriter::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "Write frequency: " << _writeFrequency << endl; + global_log->info() << "Write frequency: " << _writeFrequency << std::endl; _outputPrefix = "mardyn"; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "Output prefix: " << _outputPrefix << endl; + global_log->info() << "Output prefix: " << _outputPrefix << std::endl; int appendTimestamp = 0; xmlconfig.getNodeValue("appendTimestamp", appendTimestamp); if(appendTimestamp > 0) { _appendTimestamp = true; } - global_log->info() << "Append timestamp: " << _appendTimestamp << endl; + global_log->info() << "Append timestamp: " << _appendTimestamp << std::endl; } void VISWriter::init(ParticleContainer * /*particleContainer*/, DomainDecompBase * /*domainDecomp*/, Domain * /*domain*/) { - string filename = _outputPrefix + ".vis"; - ofstream fileout(filename.c_str(), ios::out); + std::string filename = _outputPrefix + ".vis"; + std::ofstream fileout(filename.c_str(), std::ios::out); fileout.close(); } @@ -61,7 +59,7 @@ void VISWriter::endStep(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain * /*domain*/, unsigned long simstep) { if (simstep % _writeFrequency == 0) { - stringstream filenamestream, outputstream; + std::stringstream filenamestream, outputstream; filenamestream << _outputPrefix; if(_appendTimestamp) { @@ -82,13 +80,13 @@ void VISWriter::endStep(ParticleContainer *particleContainer, _wroteVIS = true; } else - outputstream << "#" << endl; + outputstream << "#" << std::endl; #ifdef ENABLE_MPI } #endif // originally VIS files had a fixed width of 8 (and no t), here I use 12 (with 2 for t) - //ostrm << "t x y z q0 q1 q2 q3" << endl; + //ostrm << "t x y z q0 q1 q2 q3" << std::endl; for (auto pos = particleContainer->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); pos.isValid(); ++pos) { bool halo = false; for (unsigned short d = 0; d < 3; d++) { @@ -98,12 +96,12 @@ void VISWriter::endStep(ParticleContainer *particleContainer, } } if (!halo) { - outputstream << setiosflags(ios::fixed) << setw(8) << pos->getID() << setw(2) - << pos->componentid() << setprecision(3); - for (unsigned short d = 0; d < 3; d++) outputstream << setw(11) << pos->r(d); - outputstream << setprecision(3) << setw(7) << pos->q().qw() << setw(7) << pos->q().qx() - << setw(7) << pos->q().qy()<< setw(7) << pos->q().qz() - << setw(9) << right << 0 << "\n"; + outputstream << setiosflags(std::ios::fixed) << std::setw(8) << pos->getID() << std::setw(2) + << pos->componentid() << std::setprecision(3); + for (unsigned short d = 0; d < 3; d++) outputstream << std::setw(11) << pos->r(d); + outputstream << std::setprecision(3) << std::setw(7) << pos->q().qw() << std::setw(7) << pos->q().qx() + << std::setw(7) << pos->q().qy()<< std::setw(7) << pos->q().qz() + << std::setw(9) << std::right << 0 << "\n"; } } long outputsize = outputstream.str().size(); @@ -135,7 +133,7 @@ void VISWriter::endStep(ParticleContainer *particleContainer, MPI_File_write(fh, output.data(), outputsize, MPI_CHAR, &status); MPI_File_close(&fh); #else - ofstream fileout(filename.data(), ios::out|ios::app); + std::ofstream fileout(filename.data(), std::ios::out|std::ios::app); fileout << output.data(); fileout.close(); #endif diff --git a/src/io/XyzWriter.cpp b/src/io/XyzWriter.cpp index aad6966597..bcce312c39 100644 --- a/src/io/XyzWriter.cpp +++ b/src/io/XyzWriter.cpp @@ -12,9 +12,6 @@ #include "Simulation.h" -using Log::global_log; -using namespace std; - void XyzWriter::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 1; xmlconfig.getNodeValue("writefrequency", _writeFrequency); @@ -37,8 +34,8 @@ void XyzWriter::init(ParticleContainer * /*particleContainer*/, DomainDecompBase void XyzWriter::endStep(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain * /*domain*/, unsigned long simstep) { if( simstep % _writeFrequency == 0) { - vector* components = _simulation.getEnsemble()->getComponents(); - stringstream filenamestream; + std::vector* components = _simulation.getEnsemble()->getComponents(); + std::stringstream filenamestream; filenamestream << _outputPrefix; if(_incremental) { @@ -54,7 +51,7 @@ void XyzWriter::endStep(ParticleContainer *particleContainer, DomainDecompBase * int ownRank = domainDecomp->getRank(); if( ownRank == 0 ) { - ofstream xyzfilestream( filenamestream.str(). c_str() ); + std::ofstream xyzfilestream( filenamestream.str(). c_str() ); unsigned number = 0; for (unsigned i=0; i< components->size(); i++){ number += (*components)[i].getNumMolecules()*((*components)[i].numLJcenters() + (*components)[i].numDipoles() + (*components)[i].numCharges() + (*components)[i].numQuadrupoles()); @@ -66,7 +63,7 @@ void XyzWriter::endStep(ParticleContainer *particleContainer, DomainDecompBase * for( int process = 0; process < domainDecomp->getNumProcs(); process++ ){ domainDecomp->barrier(); if( ownRank == process ){ - ofstream xyzfilestream( filenamestream.str().c_str(), ios::app ); + std::ofstream xyzfilestream( filenamestream.str().c_str(), std::ios::app ); for(ParticleIterator tempMol = particleContainer->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); tempMol.isValid(); ++tempMol){ for (unsigned i=0; i< tempMol->numLJcenters(); i++){ if( tempMol->componentid() == 0) { xyzfilestream << "Ar ";} diff --git a/src/io/tests/Adios2IOTest.cpp b/src/io/tests/Adios2IOTest.cpp index db1054e030..907196a933 100644 --- a/src/io/tests/Adios2IOTest.cpp +++ b/src/io/tests/Adios2IOTest.cpp @@ -133,10 +133,10 @@ void Adios2IOTest::testWriteCheckpoint() { std::shared_ptr domaindecomp; #ifdef ENABLE_MPI MPI_CHECK( MPI_Comm_rank(MPI_COMM_WORLD, &ownrank) ); - global_log->info() << "[Adios2IOTest] Creating standard domain decomposition ... " << endl; + global_log->info() << "[Adios2IOTest] Creating standard domain decomposition ... " << std::endl; domaindecomp = std::make_shared(); #else - global_log->info() << "[Adios2IOTest] Creating alibi domain decomposition ... " << endl; + global_log->info() << "[Adios2IOTest] Creating alibi domain decomposition ... " << std::endl; domaindecomp = std::make_shared(); #endif diff --git a/src/io/tests/CheckpointRestartTest.cpp b/src/io/tests/CheckpointRestartTest.cpp index d7a8ff0e68..b393be2b81 100644 --- a/src/io/tests/CheckpointRestartTest.cpp +++ b/src/io/tests/CheckpointRestartTest.cpp @@ -14,8 +14,6 @@ #include "io/tests/CheckpointRestartTest.h" -using namespace std; - #if !defined(ENABLE_REDUCED_MEMORY_MODE) TEST_SUITE_REGISTRATION(CheckpointRestartTest); diff --git a/src/io/tests/RDFTest.cpp b/src/io/tests/RDFTest.cpp index 9d5e9bbb22..428e805241 100644 --- a/src/io/tests/RDFTest.cpp +++ b/src/io/tests/RDFTest.cpp @@ -22,7 +22,6 @@ #include -using namespace std; #if !defined(ENABLE_REDUCED_MEMORY_MODE) && !defined(MARDYN_AUTOPAS) TEST_SUITE_REGISTRATION(RDFTest); @@ -62,7 +61,7 @@ void RDFTest::testRDFCountSequential12(ParticleContainer* moleculeContainer) { ParticlePairs2PotForceAdapter handler(*_domain); double cutoff = moleculeContainer->getCutoff(); - vector* components = global_simulation->getEnsemble()->getComponents(); + std::vector* components = global_simulation->getEnsemble()->getComponents(); ASSERT_EQUAL((size_t) 1, components->size()); moleculeContainer->update(); @@ -101,7 +100,7 @@ void RDFTest::testRDFCountSequential12(ParticleContainer* moleculeContainer) { for (int i = 0; i < 100; i++) { // std::cout << " i=" << i << " global = " <getCutoff(); - vector* components = global_simulation->getEnsemble()->getComponents(); + std::vector* components = global_simulation->getEnsemble()->getComponents(); ASSERT_EQUAL((size_t) 1, components->size()); _domainDecomposition->balanceAndExchange(1.0, true, moleculeContainer, _domain); diff --git a/src/io/vtk/VTKGridWriter.cpp b/src/io/vtk/VTKGridWriter.cpp index ed793d07a2..cf758b6c9c 100644 --- a/src/io/vtk/VTKGridWriter.cpp +++ b/src/io/vtk/VTKGridWriter.cpp @@ -16,7 +16,6 @@ #include "utils/Logger.h" #include "parallel/DomainDecompBase.h" -using namespace Log; VTKGridWriter::VTKGridWriter() : _numCells(0), _numVertices(0) { diff --git a/src/io/vtk/VTKGridWriterImplementation.cpp b/src/io/vtk/VTKGridWriterImplementation.cpp index 77649e88f3..15f977fc37 100644 --- a/src/io/vtk/VTKGridWriterImplementation.cpp +++ b/src/io/vtk/VTKGridWriterImplementation.cpp @@ -13,7 +13,6 @@ #include -using namespace Log; VTKGridWriterImplementation::VTKGridWriterImplementation(int rank, const std::vector* processorSpeeds) : _vtkFile(NULL), _parallelVTKFile(NULL), _numCellsPlotted(0), diff --git a/src/io/vtk/VTKMoleculeWriter.cpp b/src/io/vtk/VTKMoleculeWriter.cpp index f8f5159e15..cfc26123f9 100644 --- a/src/io/vtk/VTKMoleculeWriter.cpp +++ b/src/io/vtk/VTKMoleculeWriter.cpp @@ -15,8 +15,6 @@ #include #include -using namespace std; -using namespace Log; #ifdef ENABLE_MPI #include diff --git a/src/io/vtk/VTKMoleculeWriterImplementation.cpp b/src/io/vtk/VTKMoleculeWriterImplementation.cpp index ab58fccd51..585d25db82 100644 --- a/src/io/vtk/VTKMoleculeWriterImplementation.cpp +++ b/src/io/vtk/VTKMoleculeWriterImplementation.cpp @@ -12,7 +12,6 @@ #include -using namespace Log; VTKMoleculeWriterImplementation::VTKMoleculeWriterImplementation(int rank, bool plotCenters) : _vtkFile(NULL), _parallelVTKFile(NULL), _numMoleculesPlotted(0), _rank(rank), _plotCenters(plotCenters) { diff --git a/src/io/vtk/tests/VTKMoleculeWriterTest.cpp b/src/io/vtk/tests/VTKMoleculeWriterTest.cpp index ae4f834958..74b4d35ffd 100644 --- a/src/io/vtk/tests/VTKMoleculeWriterTest.cpp +++ b/src/io/vtk/tests/VTKMoleculeWriterTest.cpp @@ -23,7 +23,6 @@ #include -using namespace Log; TEST_SUITE_REGISTRATION(VTKMoleculeWriterTest); diff --git a/src/io/vtk/vtk-unstructured.cpp b/src/io/vtk/vtk-unstructured.cpp index fba3464b54..cb6a545fa0 100644 --- a/src/io/vtk/vtk-unstructured.cpp +++ b/src/io/vtk/vtk-unstructured.cpp @@ -45,13 +45,13 @@ DataArrayList_t:: DataArrayList_t () -: ::xsd::cxx::tree::list< ::xml_schema::decimal, char, ::xsd::cxx::tree::schema_type::decimal > (this) +: ::xsd::cxx::tree::std::list< ::xml_schema::decimal, char, ::xsd::cxx::tree::schema_type::decimal > (this) { } DataArrayList_t:: DataArrayList_t (size_type n, const ::xml_schema::decimal& x) -: ::xsd::cxx::tree::list< ::xml_schema::decimal, char, ::xsd::cxx::tree::schema_type::decimal > (n, x, this) +: ::xsd::cxx::tree::std::list< ::xml_schema::decimal, char, ::xsd::cxx::tree::schema_type::decimal > (n, x, this) { } @@ -60,7 +60,7 @@ DataArrayList_t (const DataArrayList_t& o, ::xml_schema::flags f, ::xml_schema::container* c) : ::xml_schema::simple_type (o, f, c), - ::xsd::cxx::tree::list< ::xml_schema::decimal, char, ::xsd::cxx::tree::schema_type::decimal > (o, f, this) + ::xsd::cxx::tree::std::list< ::xml_schema::decimal, char, ::xsd::cxx::tree::schema_type::decimal > (o, f, this) { } @@ -477,7 +477,7 @@ DataArrayList_t (const ::xercesc::DOMElement& e, ::xml_schema::flags f, ::xml_schema::container* c) : ::xml_schema::simple_type (e, f, c), - ::xsd::cxx::tree::list< ::xml_schema::decimal, char, ::xsd::cxx::tree::schema_type::decimal > (e, f, this) + ::xsd::cxx::tree::std::list< ::xml_schema::decimal, char, ::xsd::cxx::tree::schema_type::decimal > (e, f, this) { } @@ -486,7 +486,7 @@ DataArrayList_t (const ::xercesc::DOMAttr& a, ::xml_schema::flags f, ::xml_schema::container* c) : ::xml_schema::simple_type (a, f, c), - ::xsd::cxx::tree::list< ::xml_schema::decimal, char, ::xsd::cxx::tree::schema_type::decimal > (a, f, this) + ::xsd::cxx::tree::std::list< ::xml_schema::decimal, char, ::xsd::cxx::tree::schema_type::decimal > (a, f, this) { } @@ -496,7 +496,7 @@ DataArrayList_t (const ::std::string& s, ::xml_schema::flags f, ::xml_schema::container* c) : ::xml_schema::simple_type (s, e, f, c), - ::xsd::cxx::tree::list< ::xml_schema::decimal, char, ::xsd::cxx::tree::schema_type::decimal > (s, e, f, this) + ::xsd::cxx::tree::std::list< ::xml_schema::decimal, char, ::xsd::cxx::tree::schema_type::decimal > (s, e, f, this) { } @@ -1426,20 +1426,20 @@ Cells:: void operator<< (::xercesc::DOMElement& e, const DataArrayList_t& i) { - e << static_cast< const ::xsd::cxx::tree::list< ::xml_schema::decimal, char, ::xsd::cxx::tree::schema_type::decimal >& > (i); + e << static_cast< const ::xsd::cxx::tree::std::list< ::xml_schema::decimal, char, ::xsd::cxx::tree::schema_type::decimal >& > (i); } void operator<< (::xercesc::DOMAttr& a, const DataArrayList_t& i) { - a << static_cast< const ::xsd::cxx::tree::list< ::xml_schema::decimal, char, ::xsd::cxx::tree::schema_type::decimal >& > (i); + a << static_cast< const ::xsd::cxx::tree::std::list< ::xml_schema::decimal, char, ::xsd::cxx::tree::schema_type::decimal >& > (i); } void operator<< (::xml_schema::list_stream& l, const DataArrayList_t& i) { - l << static_cast< const ::xsd::cxx::tree::list< ::xml_schema::decimal, char, ::xsd::cxx::tree::schema_type::decimal >& > (i); + l << static_cast< const ::xsd::cxx::tree::std::list< ::xml_schema::decimal, char, ::xsd::cxx::tree::schema_type::decimal >& > (i); } void diff --git a/src/io/vtk/vtk-unstructured.h b/src/io/vtk/vtk-unstructured.h index 429a65a972..86cf21b823 100644 --- a/src/io/vtk/vtk-unstructured.h +++ b/src/io/vtk/vtk-unstructured.h @@ -100,7 +100,7 @@ class Cells; * std::vector). */ class DataArrayList_t: public ::xml_schema::simple_type, - public ::xsd::cxx::tree::list< ::xml_schema::decimal, char, ::xsd::cxx::tree::schema_type::decimal > + public ::xsd::cxx::tree::std::list< ::xml_schema::decimal, char, ::xsd::cxx::tree::schema_type::decimal > { public: /** @@ -131,7 +131,7 @@ class DataArrayList_t: public ::xml_schema::simple_type, */ template < typename I > DataArrayList_t (const I& begin, const I& end) - : ::xsd::cxx::tree::list< ::xml_schema::decimal, char, ::xsd::cxx::tree::schema_type::decimal > (begin, end, this) + : ::xsd::cxx::tree::std::list< ::xml_schema::decimal, char, ::xsd::cxx::tree::schema_type::decimal > (begin, end, this) { } diff --git a/src/longRange/Homogeneous.cpp b/src/longRange/Homogeneous.cpp index 95d52659e8..1f9a74a9ac 100644 --- a/src/longRange/Homogeneous.cpp +++ b/src/longRange/Homogeneous.cpp @@ -7,9 +7,7 @@ //#include "LongRangeCorrection.h" #include "utils/Logger.h" -using Log::global_log; -using namespace std; Homogeneous::Homogeneous(double cutoffRadius, double cutoffRadiusLJ, Domain* domain, Simulation* simulation) { _cutoff = cutoffRadius; @@ -20,7 +18,7 @@ Homogeneous::Homogeneous(double cutoffRadius, double cutoffRadiusLJ, Domain* dom void Homogeneous::init() { _comp2params = _domain->getComp2Params(); - global_log->info() << "Long range correction for homogeneous systems is used " << endl; + global_log->info() << "Long range correction for homogeneous systems is used " << std::endl; double UpotCorrLJ = 0.; double VirialCorrLJ = 0.; double MySelbstTerm = 0.; @@ -80,7 +78,7 @@ void Homogeneous::init() { double zj = cj.ljcenter(sj).rz(); double tau2 = sqrt(xj * xj + yj * yj + zj * zj); if (tau1 + tau2 >= _cutoffLJ) { - global_log->error() << "Error calculating cutoff corrections, rc too small" << endl; + global_log->error() << "Error calculating cutoff corrections, rc too small" << std::endl; Simulation::exit(1); } double eps24; @@ -134,7 +132,7 @@ void Homogeneous::calculateLongRange() { double VirialCorr = VirialCorrLJ + 3. * MySelbstTerm; global_log->debug() << "Far field terms: U_pot_correction = " << UpotCorr << " virial_correction = " << VirialCorr - << endl; + << std::endl; _domain->setUpotCorr(UpotCorr); _domain->setVirialCorr(VirialCorr); } diff --git a/src/longRange/NoLRC.h b/src/longRange/NoLRC.h index bad1e0a408..8d69b650f0 100644 --- a/src/longRange/NoLRC.h +++ b/src/longRange/NoLRC.h @@ -5,7 +5,6 @@ #include "LongRangeCorrection.h" #include "utils/Logger.h" -using Log::global_log; class Simulation; class Domain; diff --git a/src/longRange/Planar.cpp b/src/longRange/Planar.cpp index acc41eb7d9..5580fb6f62 100644 --- a/src/longRange/Planar.cpp +++ b/src/longRange/Planar.cpp @@ -15,13 +15,11 @@ #include "utils/xmlfileUnits.h" #include "utils/FileUtils.h" -using namespace std; -using Log::global_log; Planar::Planar(double /*cutoffT*/, double cutoffLJ, Domain* domain, DomainDecompBase* domainDecomposition, ParticleContainer* particleContainer, unsigned slabs, Simulation* simulation) { - global_log->info() << "Long Range Correction for planar interfaces is used" << endl; + global_log->info() << "Long Range Correction for planar interfaces is used" << std::endl; _nStartWritingProfiles = 1; _nWriteFreqProfiles = 10; _nStopWritingProfiles = 100; @@ -42,7 +40,7 @@ void Planar::init() //_smooth=true; // Deactivate this for transient simulations! _smooth=false; //true; <-- only applicable to static density profiles - vector& components = *_simulation.getEnsemble()->getComponents(); + std::vector& components = *_simulation.getEnsemble()->getComponents(); numComp=components.size(); resizeExactly(numLJ, numComp); resizeExactly(numDipole, numComp); @@ -126,7 +124,7 @@ void Planar::init() muSquare[dpcount]=my2;//dipolej.absMy()*dipolej.absMy(); dpcount++; #ifndef NDEBUG - cout << dpcount << "\tmu: " << muSquare[dpcount-1] << endl; + std::cout << dpcount << "\tmu: " << muSquare[dpcount-1] << std::endl; #endif } } @@ -148,9 +146,9 @@ void Planar::init() if (nullptr != _subject) { this->update(_subject); _subject->registerObserver(this); - global_log->info() << "Long Range Correction: Subject registered" << endl; + global_log->info() << "Long Range Correction: Subject registered" << std::endl; } else { - global_log->error() << "Long Range Correction: Initialization of plugin DistControl is needed before! Program exit..." << endl; + global_log->error() << "Long Range Correction: Initialization of plugin DistControl is needed before! Program exit..." << std::endl; Simulation::exit(-1); } } @@ -158,7 +156,7 @@ void Planar::init() void Planar::readXML(XMLfileUnits& xmlconfig) { - global_log->info() << "[Long Range Correction] Reading xml config" << endl; + global_log->info() << "[Long Range Correction] Reading xml config" << std::endl; xmlconfig.getNodeValue("slabs", _slabs); xmlconfig.getNodeValue("smooth", _smooth); @@ -183,11 +181,11 @@ void Planar::readXML(XMLfileUnits& xmlconfig) _region.refPos[1] = _region.actPos[1] = _domain->getGlobalLength(1); } - global_log->info() << "Long Range Correction: using " << _slabs << " slabs for profiles to calculate LRC." << endl; - global_log->info() << "Long Range Correction: sampling profiles every " << frequency << "th simstep." << endl; - global_log->info() << "Long Range Correction: profiles are smoothed (averaged over time): " << std::boolalpha << _smooth << endl; - global_log->info() << "Long Range Correction: force corrections are applied to particles within yRef = " << _region.refPos[0] << " (refID: " << _region.refPosID[0] << ") and " << _region.refPos[1] << " (refID: " << _region.refPosID[1] << ")" << endl; - global_log->info() << "Long Range Correction: pot. energy and virial corrections are applied within whole domain" << endl; + global_log->info() << "Long Range Correction: using " << _slabs << " slabs for profiles to calculate LRC." << std::endl; + global_log->info() << "Long Range Correction: sampling profiles every " << frequency << "th simstep." << std::endl; + global_log->info() << "Long Range Correction: profiles are smoothed (averaged over time): " << std::boolalpha << _smooth << std::endl; + global_log->info() << "Long Range Correction: force corrections are applied to particles within yRef = " << _region.refPos[0] << " (refID: " << _region.refPosID[0] << ") and " << _region.refPos[1] << " (refID: " << _region.refPosID[1] << ")" << std::endl; + global_log->info() << "Long Range Correction: pot. energy and virial corrections are applied within whole domain" << std::endl; // write control bool bRet1 = xmlconfig.getNodeValue("writecontrol/start", _nStartWritingProfiles); @@ -195,24 +193,24 @@ void Planar::readXML(XMLfileUnits& xmlconfig) bool bRet3 = xmlconfig.getNodeValue("writecontrol/stop", _nStopWritingProfiles); if(_nWriteFreqProfiles < 1) { - global_log->error() << "Long Range Correction: Write frequency < 1! Programm exit ..." << endl; + global_log->error() << "Long Range Correction: Write frequency < 1! Programm exit ..." << std::endl; Simulation::exit(-1); } if(_nStopWritingProfiles <= _nStartWritingProfiles) { - global_log->error() << "Long Range Correction: Writing profiles 'stop' <= 'start'! Programm exit ..." << endl; + global_log->error() << "Long Range Correction: Writing profiles 'stop' <= 'start'! Programm exit ..." << std::endl; Simulation::exit(-1); } bool bInputIsValid = (bRet1 && bRet2 && bRet3); if(true == bInputIsValid) { - global_log->info() << "Long Range Correction->writecontrol: Start writing profiles at simstep: " << _nStartWritingProfiles << endl; - global_log->info() << "Long Range Correction->writecontrol: Writing profiles with frequency: " << _nWriteFreqProfiles << endl; - global_log->info() << "Long Range Correction->writecontrol: Stop writing profiles at simstep: " << _nStopWritingProfiles << endl; + global_log->info() << "Long Range Correction->writecontrol: Start writing profiles at simstep: " << _nStartWritingProfiles << std::endl; + global_log->info() << "Long Range Correction->writecontrol: Writing profiles with frequency: " << _nWriteFreqProfiles << std::endl; + global_log->info() << "Long Range Correction->writecontrol: Stop writing profiles at simstep: " << _nStopWritingProfiles << std::endl; } else { - global_log->error() << "Long Range Correction: Write control parameters not valid! Programm exit ..." << endl; + global_log->error() << "Long Range Correction: Write control parameters not valid! Programm exit ..." << std::endl; Simulation::exit(-1); } } @@ -1134,7 +1132,7 @@ void Planar::writeProfiles(DomainDecompBase* domainDecomp, Domain* domain, unsig outputstream << " F_LRC[" << si << "]"; outputstream << " u_LRC[" << si << "]"; } - outputstream << endl; + outputstream << std::endl; // data for(uint32_t pi=0; pi<_slabs; ++pi) @@ -1156,7 +1154,7 @@ void Planar::writeProfiles(DomainDecompBase* domainDecomp, Domain* domain, unsig // open file for writing // scalar - ofstream fileout(filenamestream.str().c_str(), ios::out); + std::ofstream fileout(filenamestream.str().c_str(), std::ios::out); fileout << outputstream.str(); fileout.close(); } diff --git a/src/molecules/AutoPasSimpleMolecule.cpp b/src/molecules/AutoPasSimpleMolecule.cpp index fdde402ed9..40560452be 100644 --- a/src/molecules/AutoPasSimpleMolecule.cpp +++ b/src/molecules/AutoPasSimpleMolecule.cpp @@ -45,7 +45,7 @@ void AutoPasSimpleMolecule::upd_postF(double dt_halve, double& summv2, double& s _v[d] += dtInv2m * _f[d]; v2 += _v[d] * _v[d]; } - mardyn_assert(!isnan(v2)); // catches NaN + mardyn_assert(!std::isnan(v2)); // catches NaN summv2 += mass * v2; } diff --git a/src/molecules/Comp2Param.cpp b/src/molecules/Comp2Param.cpp index c322a2c221..ca1379fa99 100644 --- a/src/molecules/Comp2Param.cpp +++ b/src/molecules/Comp2Param.cpp @@ -4,18 +4,16 @@ #include "utils/Logger.h" -using Log::global_log; -using namespace std; void Comp2Param::initialize( - const vector& components, const vector& mixcoeff, + const std::vector& components, const std::vector& mixcoeff, double epsRF, double rc, double rcLJ) { m_numcomp = components.size(); m_ssparatbl.redim(m_numcomp, m_numcomp); // interaction between LJ centers - vector::const_iterator mixpos = mixcoeff.begin(); + std::vector::const_iterator mixpos = mixcoeff.begin(); for (unsigned int compi = 0; compi < m_numcomp; ++compi) { ParaStrm& pstrmii = m_ssparatbl(compi, compi); unsigned int nci = components[compi].numLJcenters(); @@ -47,7 +45,7 @@ void Comp2Param::initialize( double eta = *mixpos; ++mixpos; #ifndef NDEBUG - global_log->info() << "cid+1(compi)=" << compi+1 << " <--> cid+1(compj)=" << compj+1 << ": xi=" << xi << ", eta=" << eta << endl; + global_log->info() << "cid+1(compi)=" << compi+1 << " <--> cid+1(compj)=" << compj+1 << ": xi=" << xi << ", eta=" << eta << std::endl; #endif double shift6combined, sigperrc2, sigperrc6; for (unsigned int centeri = 0; centeri < nci; ++centeri) { @@ -68,7 +66,7 @@ void Comp2Param::initialize( pstrmij << sigma2; pstrmij << shift6combined; #ifndef NDEBUG - global_log->debug() << "Component " << compi << ": eps24=" << epsilon24 << " sig2=" << sigma2 << " shift6=" << shift6combined << endl; + global_log->debug() << "Component " << compi << ": eps24=" << epsilon24 << " sig2=" << sigma2 << " shift6=" << shift6combined << std::endl; #endif } } diff --git a/src/molecules/Component.cpp b/src/molecules/Component.cpp index 6ddc431b3e..1f9ec5f663 100644 --- a/src/molecules/Component.cpp +++ b/src/molecules/Component.cpp @@ -7,8 +7,6 @@ #include "utils/Logger.h" #include "Simulation.h" -using namespace std; -using Log::global_log; Component::Component(unsigned int id) { _id = id; @@ -23,21 +21,21 @@ Component::Component(unsigned int id) { _E_rot=0.; _isStockmayer = false; - _ljcenters = vector (); - _charges = vector (); - _quadrupoles = vector (); - _dipoles = vector (); + _ljcenters = std::vector (); + _charges = std::vector (); + _quadrupoles = std::vector (); + _dipoles = std::vector (); } void Component::readXML(XMLfileUnits& xmlconfig) { - global_log->info() << "Reading in component" << endl; + global_log->info() << "Reading in component" << std::endl; unsigned int cid = 0; xmlconfig.getNodeValue( "@id", cid ); - global_log->info() << "Component ID:" << cid << endl; + global_log->info() << "Component ID:" << cid << std::endl; setID(cid - 1); - string name; + std::string name; xmlconfig.getNodeValue( "@name", name ); - global_log->info() << "Component name:" << name << endl; + global_log->info() << "Component name:" << name << std::endl; setName(name); XMLfile::Query query = xmlconfig.query( "site" ); @@ -47,7 +45,7 @@ void Component::readXML(XMLfileUnits& xmlconfig) { std::string siteType; xmlconfig.getNodeValue("@type", siteType); - global_log->info() << "Adding site of type " << siteType << endl; + global_log->info() << "Adding site of type " << siteType << std::endl; if (siteType == "LJ126") { LJcenter ljSite; @@ -71,17 +69,17 @@ void Component::readXML(XMLfileUnits& xmlconfig) { global_log->info() << "Rotation enabled with [Ixx Iyy Izz] = [" << _Ipa[0] << " " << _Ipa[1] << " " << _Ipa[2] << "]. Dipole direction vector of the Stockmayer fluid should be [0 0 1]." - << endl; + << std::endl; } else if (siteType == "Quadrupole") { Quadrupole quadrupoleSite; quadrupoleSite.readXML(xmlconfig); addQuadrupole(quadrupoleSite); } else if (siteType == "Tersoff") { - global_log->error() << "Tersoff no longer supported:" << siteType << endl; + global_log->error() << "Tersoff no longer supported:" << siteType << std::endl; Simulation::exit(-1); } else { - global_log->error() << "Unknown site type:" << siteType << endl; + global_log->error() << "Unknown site type:" << siteType << std::endl; Simulation::exit(-1); } // go back to initial level, to be consistent, even if no site information is found. @@ -221,30 +219,30 @@ void Component::write(std::ostream& ostrm) const { << 0 << "\n"; // the 0 indicates a zero amount of tersoff sites. for (auto pos = _ljcenters.cbegin(); pos != _ljcenters.end(); ++pos) { pos->write(ostrm); - ostrm << endl; + ostrm << std::endl; } for (auto pos = _charges.cbegin(); pos != _charges.end(); ++pos) { pos->write(ostrm); - ostrm << endl; + ostrm << std::endl; } for (auto pos = _dipoles.cbegin(); pos != _dipoles.end(); ++pos) { pos->write(ostrm); - ostrm << endl; + ostrm << std::endl; } for (auto pos = _quadrupoles.cbegin(); pos != _quadrupoles.end(); ++pos) { pos->write(ostrm); - ostrm << endl; + ostrm << std::endl; } - ostrm << _Ipa[0] << " " << _Ipa[1] << " " << _Ipa[2] << endl; + ostrm << _Ipa[0] << " " << _Ipa[1] << " " << _Ipa[2] << std::endl; } void Component::writeVIM(std::ostream& ostrm) { for (auto pos = _ljcenters.cbegin(); pos != _ljcenters.end(); ++pos) { - ostrm << "~ " << this->_id + 1 << " LJ " << setw(7) << pos->rx() << ' ' - << setw(7) << pos->ry() << ' ' << setw(7) << pos->rz() << ' ' - << setw(6) << pos->sigma() << ' ' << setw(2) << (1 + (this->_id % 9)) << "\n"; + ostrm << "~ " << this->_id + 1 << " LJ " << std::setw(7) << pos->rx() << ' ' + << std::setw(7) << pos->ry() << ' ' << std::setw(7) << pos->rz() << ' ' + << std::setw(6) << pos->sigma() << ' ' << std::setw(2) << (1 + (this->_id % 9)) << "\n"; } - ostrm << flush; + ostrm << std::flush; } std::ostream& operator<<(std::ostream& stream, const Component& component) { diff --git a/src/molecules/FullMolecule.cpp b/src/molecules/FullMolecule.cpp index a7472867e7..0e7758a130 100644 --- a/src/molecules/FullMolecule.cpp +++ b/src/molecules/FullMolecule.cpp @@ -7,9 +7,6 @@ #include "utils/Logger.h" -using namespace std; -using Log::global_log; - FullMolecule::FullMolecule(unsigned long id, Component *component, double rx, double ry, double rz, @@ -375,7 +372,7 @@ void FullMolecule::upd_postF(double dt_halve, double& summv2, double& sumIw2) { v2 += _v[d] * _v[d]; _L[d] += dt_halve * _M[d]; } - mardyn_assert(!isnan(v2)); // catches NaN + mardyn_assert(!std::isnan(v2)); // catches NaN summv2 += _m * v2; std::array w = _q.rotateinv(D_arr()); // L = D = Iw @@ -384,7 +381,7 @@ void FullMolecule::upd_postF(double dt_halve, double& summv2, double& sumIw2) { w[d] *= _invI[d]; Iw2 += _I[d] * w[d] * w[d]; } - mardyn_assert(!isnan(Iw2)); // catches NaN + mardyn_assert(!std::isnan(Iw2)); // catches NaN sumIw2 += Iw2; } @@ -439,7 +436,7 @@ std::string FullMolecule::getWriteFormat(){ return std::string("ICRVQD"); } -void FullMolecule::write(ostream& ostrm) const { +void FullMolecule::write(std::ostream& ostrm) const { ostrm << _id << "\t" << (_component->ID() + 1) << "\t" << _r[0] << " " << _r[1] << " " << _r[2] << "\t" << _v[0] << " " << _v[1] << " " << _v[2] << "\t" @@ -531,12 +528,12 @@ void FullMolecule::calcFM_site(const std::array& dsite, const std::ar * catches NaN assignments */ for (int d = 0; d < 3; d++) { - if (isnan(dsite[d])) { - global_log->error() << "Severe dsite[" << d << "] error for site of m" << _id << endl; + if (std::isnan(dsite[d])) { + global_log->error() << "Severe dsite[" << d << "] error for site of m" << _id << std::endl; mardyn_assert(false); } - if (isnan(Fsite[d])) { - global_log->error() << "Severe Fsite[" << d << "] error for site of m" << _id << endl; + if (std::isnan(Fsite[d])) { + global_log->error() << "Severe Fsite[" << d << "] error for site of m" << _id << std::endl; mardyn_assert(false); } } @@ -621,9 +618,9 @@ void FullMolecule::calcFM() { temp_Vi[0] *= 0.5; temp_Vi[1] *= 0.5; temp_Vi[2] *= 0.5; - mardyn_assert(!isnan(temp_Vi[0])); - mardyn_assert(!isnan(temp_Vi[1])); - mardyn_assert(!isnan(temp_Vi[2])); + mardyn_assert(!std::isnan(temp_Vi[0])); + mardyn_assert(!std::isnan(temp_Vi[1])); + mardyn_assert(!std::isnan(temp_Vi[2])); Viadd(temp_Vi); Madd(temp_M); } @@ -646,13 +643,13 @@ void FullMolecule::check(unsigned long id) { mardyn_assert(isfinite(_F[d])); mardyn_assert(isfinite(_M[d])); mardyn_assert(isfinite(_I[d])); - // mardyn_assert(!isnan(_Vi[d])); + // mardyn_assert(!std::isnan(_Vi[d])); mardyn_assert(isfinite(_invI[d])); } _q.check(); if (!isfinite(_Vi[0]) || !isfinite(_Vi[1]) || !isfinite(_Vi[2])) { cout << "\talert: molecule id " << id << " (internal cid " << this->_component->ID() << ") has virial _Vi = (" - << _Vi[0] << ", " << _Vi[1] << ", " << _Vi[2] << ")" << endl; + << _Vi[0] << ", " << _Vi[1] << ", " << _Vi[2] << ")" << std::endl; _Vi[0] = 0.0; _Vi[1] = 0.0; _Vi[2] = 0.0; diff --git a/src/molecules/MoleculeInterface.cpp b/src/molecules/MoleculeInterface.cpp index bc150b6b65..aab8a9b6a6 100644 --- a/src/molecules/MoleculeInterface.cpp +++ b/src/molecules/MoleculeInterface.cpp @@ -14,9 +14,6 @@ #include "utils/Logger.h" #include "Simulation.h" -using namespace std; -using Log::global_log; - bool MoleculeInterface::isLessThan(const MoleculeInterface& m2) const { if (r(2) < m2.r(2)) @@ -34,7 +31,7 @@ bool MoleculeInterface::isLessThan(const MoleculeInterface& m2) const { else if (r(0) > m2.r(0)) return false; else { - global_log->error() << "LinkedCells::isFirstParticle: both Particles have the same position" << endl; + global_log->error() << "LinkedCells::isFirstParticle: both Particles have the same position" << std::endl; Simulation::exit(1); } } diff --git a/src/molecules/mixingrules/LorentzBerthelot.cpp b/src/molecules/mixingrules/LorentzBerthelot.cpp index 594eaa8bda..ca1e079f4b 100644 --- a/src/molecules/mixingrules/LorentzBerthelot.cpp +++ b/src/molecules/mixingrules/LorentzBerthelot.cpp @@ -3,7 +3,6 @@ #include "utils/Logger.h" #include "utils/xmlfileUnits.h" -using namespace std; using Log::global_log; void LorentzBerthelotMixingRule::readXML(XMLfileUnits& xmlconfig) { @@ -11,5 +10,5 @@ void LorentzBerthelotMixingRule::readXML(XMLfileUnits& xmlconfig) { xmlconfig.getNodeValue("eta", _eta); xmlconfig.getNodeValue("xi", _xi); - global_log->info() << "Mixing coefficients: (eta, xi) = (" << _eta << ", " << _xi << ")" << endl; + global_log->info() << "Mixing coefficients: (eta, xi) = (" << _eta << ", " << _xi << ")" << std::endl; } diff --git a/src/molecules/mixingrules/MixingRuleBase.cpp b/src/molecules/mixingrules/MixingRuleBase.cpp index cbe82ea51a..2f158e2c40 100644 --- a/src/molecules/mixingrules/MixingRuleBase.cpp +++ b/src/molecules/mixingrules/MixingRuleBase.cpp @@ -3,13 +3,12 @@ #include "utils/Logger.h" #include "utils/xmlfileUnits.h" -using namespace std; using Log::global_log; void MixingRuleBase::readXML(XMLfileUnits& xmlconfig) { xmlconfig.getNodeValue("@cid1", _cid1); xmlconfig.getNodeValue("@cid2", _cid2); - global_log->info() << "Component id1: " << _cid1 << endl; - global_log->info() << "Component id2: " << _cid2 << endl; + global_log->info() << "Component id1: " << _cid1 << std::endl; + global_log->info() << "Component id2: " << _cid2 << std::endl; } diff --git a/src/parallel/CollectiveCommunicationNonBlocking.h b/src/parallel/CollectiveCommunicationNonBlocking.h index cdb998b9f2..08e201d47b 100644 --- a/src/parallel/CollectiveCommunicationNonBlocking.h +++ b/src/parallel/CollectiveCommunicationNonBlocking.h @@ -15,7 +15,6 @@ #if MPI_VERSION >= 3 -using Log::global_log; /** * CollectiveCommunicationNonBlocking provides an interface to access multiple CollectiveCommunicationSingleNonBlocking objects. * This allows the use of multiple different collective calls, which is needed for the different ensembles. diff --git a/src/parallel/CommunicationPartner.cpp b/src/parallel/CommunicationPartner.cpp index 015d0c8d9f..d4a5814d73 100644 --- a/src/parallel/CommunicationPartner.cpp +++ b/src/parallel/CommunicationPartner.cpp @@ -266,8 +266,7 @@ bool CommunicationPartner::iprobeCount(const MPI_Comm& comm, const MPI_Datatype& return _countReceived; } bool CommunicationPartner::testRecv(ParticleContainer* moleculeContainer, bool removeRecvDuplicates, bool force) { - using Log::global_log; - if (_countReceived and not _msgReceived) { + if (_countReceived and not _msgReceived) { int flag = 1; if (_countTested > 10) { // some MPI (Intel, IBM) implementations can produce deadlocks using MPI_Test without any MPI_Wait @@ -403,8 +402,7 @@ void CommunicationPartner::initRecv(int numParticles, const MPI_Comm& comm, cons } void CommunicationPartner::deadlockDiagnosticSendRecv() { - using Log::global_log; - + deadlockDiagnosticSend(); if (not _countReceived and _isReceiving) { @@ -439,8 +437,8 @@ void CommunicationPartner::collectMoleculesInRegion(ParticleContainer* moleculeC bool doHaloPositionCheck) { using std::vector; global_simulation->timers()->start("COMMUNICATION_PARTNER_INIT_SEND"); - vector> threadData; - vector prefixArray; + std::vector> threadData; + std::vector prefixArray; // compute how many molecules are already in of this type: - adjust for Forces unsigned long numMolsAlreadyIn = 0; diff --git a/src/parallel/DomainDecompBase.cpp b/src/parallel/DomainDecompBase.cpp index 67e2841d67..c01d638e5f 100644 --- a/src/parallel/DomainDecompBase.cpp +++ b/src/parallel/DomainDecompBase.cpp @@ -477,7 +477,7 @@ void DomainDecompBase::writeMoleculesToMPIFileBinary(const std::string& filename } uint64_t buffer_size = 32768; std::string __dummy(buffer_size, '\0'); // __dummy for preallocation of internal buffer with buffer_size. - std::ostringstream write_buffer(__dummy, ios_base::binary); + std::ostringstream write_buffer(__dummy, std::ios_base::binary); __dummy.clear(); __dummy.shrink_to_fit(); //char* write_buffer = new char[buffer_size]; diff --git a/src/parallel/DomainDecompBase.h b/src/parallel/DomainDecompBase.h index acee357515..c839f6edde 100644 --- a/src/parallel/DomainDecompBase.h +++ b/src/parallel/DomainDecompBase.h @@ -16,6 +16,8 @@ #include "molecules/MoleculeForwardDeclaration.h" #include "utils/Logger.h" // is this used? +using Log::global_log; + class Component; class Domain; class ParticleContainer; @@ -194,8 +196,7 @@ class DomainDecompBase: public MemoryProfilable { void updateSendLeavingWithCopies(bool sendTogether){ - using Log::global_log; - // Count all processes that need to send separately + // Count all processes that need to send separately collCommInit(1); collCommAppendInt(!sendTogether); collCommAllreduceSum(); diff --git a/src/parallel/DomainDecompMPIBase.cpp b/src/parallel/DomainDecompMPIBase.cpp index a15c27643c..ff23ace639 100644 --- a/src/parallel/DomainDecompMPIBase.cpp +++ b/src/parallel/DomainDecompMPIBase.cpp @@ -23,8 +23,6 @@ #include "parallel/CollectiveCommunication.h" #include "parallel/CollectiveCommunicationNonBlocking.h" -using Log::global_log; -using std::endl; DomainDecompMPIBase::DomainDecompMPIBase() : _comm(MPI_COMM_WORLD) { @@ -57,7 +55,7 @@ DomainDecompMPIBase::~DomainDecompMPIBase() { void DomainDecompMPIBase::readXML(XMLfileUnits& xmlconfig) { // store current path - string oldPath(xmlconfig.getcurrentnodepath()); + std::string oldPath(xmlconfig.getcurrentnodepath()); #ifndef MARDYN_AUTOPAS std::string neighbourCommunicationScheme = "indirect"; @@ -82,9 +80,9 @@ void DomainDecompMPIBase::readXML(XMLfileUnits& xmlconfig) { traversal.begin(), ::tolower); // currently only checks, if traversal is valid - should check, if zonal method/traversal is valid - if(traversal.find("hs") != string::npos || traversal.find("mp") != string::npos || traversal.find("nt") != string::npos ) { + if(traversal.find("hs") != std::string::npos || traversal.find("mp") != std::string::npos || traversal.find("nt") != std::string::npos ) { zonalMethod = traversal; - } else if(traversal.find("es") != string::npos){ + } else if(traversal.find("es") != std::string::npos){ zonalMethod = "es"; } else{ @@ -114,17 +112,17 @@ void DomainDecompMPIBase::readXML(XMLfileUnits& xmlconfig) { bool overlappingCollectives = false; xmlconfig.getNodeValue("overlappingCollectives", overlappingCollectives); if(overlappingCollectives) { - global_log->info() << "DomainDecompMPIBase: Using Overlapping Collectives" << endl; + global_log->info() << "DomainDecompMPIBase: Using Overlapping Collectives" << std::endl; #if MPI_VERSION >= 3 _collCommunication = std::unique_ptr(new CollectiveCommunicationNonBlocking()); #else - global_log->warning() << "DomainDecompMPIBase: Can not use overlapping collectives, as the MPI version is less than MPI 3." << endl; + global_log->warning() << "DomainDecompMPIBase: Can not use overlapping collectives, as the MPI version is less than MPI 3." << std::endl; #endif xmlconfig.getNodeValue("overlappingStartAtStep", _overlappingStartAtStep); global_log->info() << "DomainDecompMPIBase: Overlapping Collectives start at step " << _overlappingStartAtStep - << endl; + << std::endl; } else { - global_log->info() << "DomainDecompMPIBase: NOT Using Overlapping Collectives" << endl; + global_log->info() << "DomainDecompMPIBase: NOT Using Overlapping Collectives" << std::endl; } } @@ -216,10 +214,10 @@ void DomainDecompMPIBase::assertDisjunctivity(ParticleContainer* moleculeContain tids.push_back(m->getID()); } MPI_CHECK(MPI_Send(tids.data(), num_molecules, MPI_UNSIGNED_LONG, 0, 2674 + _rank, _comm)); - global_log->info() << "Data consistency checked: for results see rank 0." << endl; + global_log->info() << "Data consistency checked: for results see rank 0." << std::endl; } else { /** @todo FIXME: This implementation does not scale. */ - map check; + std::map check; for (auto m = moleculeContainer->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); m.isValid(); ++m) { if(check.find(m->getID()) != check.end()){ @@ -240,19 +238,19 @@ void DomainDecompMPIBase::assertDisjunctivity(ParticleContainer* moleculeContain for (int j = 0; j < num_recv; j++) { if (check.find(recv[j]) != check.end()) { global_log->error() << "Ranks " << check[recv[j]] << " and " << i << " both propagate ID " - << recv[j] << endl; + << recv[j] << std::endl; isOk = false; } else check[recv[j]] = i; } } if (not isOk) { - global_log->error() << "Aborting because of duplicated partices." << endl; + global_log->error() << "Aborting because of duplicated partices." << std::endl; MPI_Abort(_comm, 1); } global_log->info() << "Data consistency checked: No duplicate IDs detected among " << check.size() - << " entries." << endl; + << " entries." << std::endl; } } @@ -304,19 +302,19 @@ size_t DomainDecompMPIBase::getTotalSize() { void DomainDecompMPIBase::printDecomp(const std::string &filename, Domain *domain, ParticleContainer *particleContainer) { if (_rank == 0) { - ofstream povcfgstrm(filename); + std::ofstream povcfgstrm(filename); povcfgstrm << "size " << domain->getGlobalLength(0) << " " << domain->getGlobalLength(1) << " " - << domain->getGlobalLength(2) << endl; - povcfgstrm << "rank boxMin_x boxMin_y boxMin_z boxMax_x boxMax_y boxMax_z Configuration" << endl; + << domain->getGlobalLength(2) << std::endl; + povcfgstrm << "rank boxMin_x boxMin_y boxMin_z boxMax_x boxMax_y boxMax_z Configuration" << std::endl; povcfgstrm.close(); } - stringstream localCellInfo; + std::stringstream localCellInfo; localCellInfo << _rank << " " << getBoundingBoxMin(0, domain) << " " << getBoundingBoxMin(1, domain) << " " << getBoundingBoxMin(2, domain) << " " << getBoundingBoxMax(0, domain) << " " << getBoundingBoxMax(1, domain) << " " << getBoundingBoxMax(2, domain) << " " << particleContainer->getConfigurationAsString() << "\n"; - string localCellInfoStr = localCellInfo.str(); + std::string localCellInfoStr = localCellInfo.str(); #ifdef ENABLE_MPI MPI_File fh; @@ -336,7 +334,7 @@ void DomainDecompMPIBase::printDecomp(const std::string &filename, Domain *domai MPI_File_write_at(fh, static_cast(offset), localCellInfoStr.c_str(), static_cast(localCellInfoStr.size()), MPI_CHAR, MPI_STATUS_IGNORE); MPI_File_close(&fh); #else - ofstream povcfgstrm(filename.c_str(), ios::app); + std::ofstream povcfgstrm(filename.c_str(), std::ios::app); povcfgstrm << localCellInfoStr; povcfgstrm.close(); #endif diff --git a/src/parallel/DomainDecomposition.cpp b/src/parallel/DomainDecomposition.cpp index 5b6c7d5ffa..e99e8af93c 100644 --- a/src/parallel/DomainDecomposition.cpp +++ b/src/parallel/DomainDecomposition.cpp @@ -9,8 +9,6 @@ #include "parallel/HaloRegion.h" #include "ParticleData.h" -using Log::global_log; -using namespace std; DomainDecomposition::DomainDecomposition() : DomainDecompMPIBase(), _gridSize{0}, _coords{0} { initMPIGridDims(); @@ -34,10 +32,10 @@ void DomainDecomposition::initMPIGridDims() { MPI_CHECK(MPI_Dims_create( _numProcs, DIMgeom, (int *) &_gridSize )); MPI_CHECK(MPI_Cart_create(MPI_COMM_WORLD, DIMgeom, _gridSize, period, reorder, &_comm)); - global_log->info() << "MPI grid dimensions: " << _gridSize[0] << ", " << _gridSize[1] << ", " << _gridSize[2] << endl; + global_log->info() << "MPI grid dimensions: " << _gridSize[0] << ", " << _gridSize[1] << ", " << _gridSize[2] << std::endl; MPI_CHECK(MPI_Comm_rank(_comm, &_rank)); MPI_CHECK(MPI_Cart_coords(_comm, _rank, DIMgeom, _coords)); - global_log->info() << "MPI coordinate of current process: " << _coords[0] << ", " << _coords[1] << ", " << _coords[2] << endl; + global_log->info() << "MPI coordinate of current process: " << _coords[0] << ", " << _coords[1] << ", " << _coords[2] << std::endl; } DomainDecomposition::~DomainDecomposition() { diff --git a/src/parallel/GeneralDomainDecomposition.cpp b/src/parallel/GeneralDomainDecomposition.cpp index a18c344699..53806fafb4 100644 --- a/src/parallel/GeneralDomainDecomposition.cpp +++ b/src/parallel/GeneralDomainDecomposition.cpp @@ -129,7 +129,7 @@ void GeneralDomainDecomposition::balanceAndExchange(double lastTraversalTime, bo } void GeneralDomainDecomposition::migrateParticles(Domain* domain, ParticleContainer* particleContainer, - array newMin, array newMax) { + std::array newMin, std::array newMax) { std::array oldBoxMin{particleContainer->getBoundingBoxMin(0), particleContainer->getBoundingBoxMin(1), particleContainer->getBoundingBoxMin(2)}; std::array oldBoxMax{particleContainer->getBoundingBoxMax(0), particleContainer->getBoundingBoxMax(1), @@ -252,25 +252,25 @@ void GeneralDomainDecomposition::readXML(XMLfileUnits& xmlconfig) { #endif xmlconfig.getNodeValue("updateFrequency", _rebuildFrequency); - global_log->info() << "GeneralDomainDecomposition update frequency: " << _rebuildFrequency << endl; + global_log->info() << "GeneralDomainDecomposition update frequency: " << _rebuildFrequency << std::endl; xmlconfig.getNodeValue("initialPhaseTime", _initPhase); - global_log->info() << "GeneralDomainDecomposition time for initial rebalancing phase: " << _initPhase << endl; + global_log->info() << "GeneralDomainDecomposition time for initial rebalancing phase: " << _initPhase << std::endl; xmlconfig.getNodeValue("initialPhaseFrequency", _initFrequency); global_log->info() << "GeneralDomainDecomposition frequency for initial rebalancing phase: " << _initFrequency - << endl; + << std::endl; std::string gridSizeString; if (xmlconfig.getNodeValue("gridSize", gridSizeString)) { - global_log->info() << "GeneralDomainDecomposition grid size: " << gridSizeString << endl; + global_log->info() << "GeneralDomainDecomposition grid size: " << gridSizeString << std::endl; if (gridSizeString.find(',') != std::string::npos) { auto strings = string_utils::split(gridSizeString, ','); if (strings.size() != 3) { global_log->error() << "GeneralDomainDecomposition's gridSize should have three entries if a list is given, but has " - << strings.size() << "!" << endl; + << strings.size() << "!" << std::endl; Simulation::exit(8134); } _gridSize = {std::stod(strings[0]), std::stod(strings[1]), std::stod(strings[2])}; @@ -282,7 +282,7 @@ void GeneralDomainDecomposition::readXML(XMLfileUnits& xmlconfig) { if (gridSize < _interactionLength) { global_log->error() << "GeneralDomainDecomposition's gridSize (" << gridSize << ") is smaller than the interactionLength (" << _interactionLength - << "). This is forbidden, as it leads to errors! " << endl; + << "). This is forbidden, as it leads to errors! " << std::endl; Simulation::exit(8136); } } diff --git a/src/parallel/KDDecomposition.cpp b/src/parallel/KDDecomposition.cpp index e8fad5dc3b..89ab5ede17 100644 --- a/src/parallel/KDDecomposition.cpp +++ b/src/parallel/KDDecomposition.cpp @@ -28,8 +28,6 @@ #include "KDNode.h" #include "ParticleData.h" -using namespace std; -using Log::global_log; KDDecomposition::KDDecomposition(double cutoffRadius, int numParticleTypes, int updateFrequency, int fullSearchThreshold) @@ -67,8 +65,8 @@ void KDDecomposition::init(Domain* domain){ if (!_decompTree->isResolvable()) { auto minCellCountPerProc = std::pow(KDDStaticValues::minNumCellsPerDimension, 3); global_log->error() << "KDDecomposition not possible. Each process needs at least " << minCellCountPerProc - << " cells." << endl; - global_log->error() << "The number of Cells is only sufficient for " << _decompTree->getNumMaxProcs() << " Procs!" << endl; + << " cells." << std::endl; + global_log->error() << "The number of Cells is only sufficient for " << _decompTree->getNumMaxProcs() << " Procs!" << std::endl; Simulation::exit(-1); } _decompTree->buildKDTree(); @@ -77,10 +75,10 @@ void KDDecomposition::init(Domain* domain){ // initialize the mpi data type for particles once in the beginning KDNode::initMPIDataType(); - global_log->info() << "Created KDDecomposition with updateFrequency=" << _frequency << ", fullSearchThreshold=" << _fullSearchThreshold << endl; + global_log->info() << "Created KDDecomposition with updateFrequency=" << _frequency << ", fullSearchThreshold=" << _fullSearchThreshold << std::endl; #ifdef DEBUG_DECOMP - global_log->info() << "Initial Decomposition: " << endl; + global_log->info() << "Initial Decomposition: " << std::endl; if (_rank == 0) { _decompTree->printTree("", std::cout); } @@ -88,7 +86,7 @@ void KDDecomposition::init(Domain* domain){ } KDDecomposition::~KDDecomposition() { -// _decompTree->serialize(string("kddecomp.dat")); +// _decompTree->serialize(std::string("kddecomp.dat")); if (_rank == 0) { _decompTree->plotNode("kddecomp.vtu", &_processorSpeeds); } @@ -102,19 +100,19 @@ void KDDecomposition::readXML(XMLfileUnits& xmlconfig) { /* TODO: Maybe add decomposition dimensions, default auto. */ xmlconfig.getNodeValue("minNumCellsPerDimension", KDDStaticValues::minNumCellsPerDimension); global_log->info() << "KDDecomposition minNumCellsPerDimension: " << KDDStaticValues::minNumCellsPerDimension - << endl; + << std::endl; if(KDDStaticValues::minNumCellsPerDimension==0u){ global_log->error() << "KDDecomposition minNumCellsPerDimension has to be bigger than zero!" << std::endl; Simulation::exit(43); } xmlconfig.getNodeValue("updateFrequency", _frequency); - global_log->info() << "KDDecomposition update frequency: " << _frequency << endl; + global_log->info() << "KDDecomposition update frequency: " << _frequency << std::endl; xmlconfig.getNodeValue("fullSearchThreshold", _fullSearchThreshold); - global_log->info() << "KDDecomposition full search threshold: " << _fullSearchThreshold << endl; + global_log->info() << "KDDecomposition full search threshold: " << _fullSearchThreshold << std::endl; xmlconfig.getNodeValue("heterogeneousSystems", _heterogeneousSystems); global_log->info() << "KDDecomposition for heterogeneous computing systems (old version, not compatible with new " "VecTuner version)?: " - << (_heterogeneousSystems ? "yes" : "no") << endl; + << (_heterogeneousSystems ? "yes" : "no") << std::endl; { std::string deviationReductionOperation; @@ -131,39 +129,39 @@ void KDDecomposition::readXML(XMLfileUnits& xmlconfig) { } } global_log->info() << "KDDecomposition uses " << deviationReductionOperation - << " to reduce the deviation within the decompose step." << endl; + << " to reduce the deviation within the decompose step." << std::endl; } bool useVecTuner = false; xmlconfig.getNodeValue("useVectorizationTuner", useVecTuner); - global_log->info() << "KDDecomposition using vectorization tuner: " << (useVecTuner?"yes":"no") << endl; + global_log->info() << "KDDecomposition using vectorization tuner: " << (useVecTuner?"yes":"no") << std::endl; if (useVecTuner){ delete _loadCalc; _loadCalc = new TunerLoad(); } xmlconfig.getNodeValue("clusterHetSys", _clusteredHeterogeneouseSystems); - global_log->info() << "KDDecomposition for clustered heterogeneous systems?: " << (_clusteredHeterogeneouseSystems?"yes":"no") << endl; + global_log->info() << "KDDecomposition for clustered heterogeneous systems?: " << (_clusteredHeterogeneouseSystems?"yes":"no") << std::endl; //TODO remove this check if the heterogenous Decomposition is updated to the vectorization tuner. if(_heterogeneousSystems){ - global_log->warning() << "The old version of the heterogeneous KDDecomposition shouldn't be used with the vectorization tuner!" << endl; + global_log->warning() << "The old version of the heterogeneous KDDecomposition shouldn't be used with the vectorization tuner!" << std::endl; } xmlconfig.getNodeValue("splitBiggestDimension", _splitBiggest); - global_log->info() << "KDDecomposition splits along biggest domain?: " << (_splitBiggest?"yes":"no") << endl; + global_log->info() << "KDDecomposition splits along biggest domain?: " << (_splitBiggest?"yes":"no") << std::endl; xmlconfig.getNodeValue("forceRatio", _forceRatio); - global_log->info() << "KDDecomposition forces load/performance ratio?: " << (_forceRatio?"yes":"no") << endl; + global_log->info() << "KDDecomposition forces load/performance ratio?: " << (_forceRatio?"yes":"no") << std::endl; xmlconfig.getNodeValue("rebalanceLimit", _rebalanceLimit); if(_rebalanceLimit > 0) { - global_log->info() << "KDDecomposition automatic rebalancing: enabled" << endl; - global_log->info() << "KDDecomposition rebalance limit: " << _rebalanceLimit << endl; + global_log->info() << "KDDecomposition automatic rebalancing: enabled" << std::endl; + global_log->info() << "KDDecomposition rebalance limit: " << _rebalanceLimit << std::endl; } else { - global_log->info() << "KDDecomposition automatic rebalancing: disabled" << endl; + global_log->info() << "KDDecomposition automatic rebalancing: disabled" << std::endl; } xmlconfig.getNodeValue("splitThreshold", _splitThreshold); if(!_splitBiggest){ - global_log->info() << "KDDecomposition threshold for splitting not only the biggest Domain: " << _splitThreshold << endl; + global_log->info() << "KDDecomposition threshold for splitting not only the biggest Domain: " << _splitThreshold << std::endl; } /* @@ -171,33 +169,33 @@ void KDDecomposition::readXML(XMLfileUnits& xmlconfig) { */ for(int i = 0; i < _numParticleTypes; ++i){ xmlconfig.getNodeValue("particleCount" + std::to_string(i+1), _vecTunParticleNums.at(i)); - global_log->info() << "Maximum particle count in the vectorization tuner of type " << i+1 << ": " << _vecTunParticleNums.at(i) << endl; + global_log->info() << "Maximum particle count in the vectorization tuner of type " << i+1 << ": " << _vecTunParticleNums.at(i) << std::endl; } xmlconfig.getNodeValue("generateNewFiles", _generateNewFiles); - global_log->info() << "Generate new vectorization tuner files: " << (_generateNewFiles?"yes":"no") << endl; + global_log->info() << "Generate new vectorization tuner files: " << (_generateNewFiles?"yes":"no") << std::endl; xmlconfig.getNodeValue("useExistingFiles", _useExistingFiles); - global_log->info() << "Use existing vectorization tuner files (if available)?: " << (_useExistingFiles?"yes":"no") << endl; + global_log->info() << "Use existing vectorization tuner files (if available)?: " << (_useExistingFiles?"yes":"no") << std::endl; xmlconfig.getNodeValue("vecTunerAllowMPIReduce", _vecTunerAllowMPIReduce); - global_log->info() << "Allow an MPI Reduce for the vectorization tuner?: " << (_vecTunerAllowMPIReduce?"yes":"no") << endl; + global_log->info() << "Allow an MPI Reduce for the vectorization tuner?: " << (_vecTunerAllowMPIReduce?"yes":"no") << std::endl; xmlconfig.getNodeValue("doMeasureLoadCalc", _doMeasureLoadCalc); - global_log->info() << "Use measureLoadCalc? (requires compilation with armadillo): " << (_doMeasureLoadCalc?"yes":"no") << endl; + global_log->info() << "Use measureLoadCalc? (requires compilation with armadillo): " << (_doMeasureLoadCalc?"yes":"no") << std::endl; xmlconfig.getNodeValue("measureLoadInterpolationStartsAt", _measureLoadInterpolationStartsAt); global_log->info() << "measureLoad: Interpolation is performed for cells with at least " - << _measureLoadInterpolationStartsAt << " particles." << endl; + << _measureLoadInterpolationStartsAt << " particles." << std::endl; xmlconfig.getNodeValue("measureLoadIncreasingTimeValues", _measureLoadIncreasingTimeValues); global_log->info() << "measureLoad: Ensure that cells with more particles take longer ? " - << (_measureLoadIncreasingTimeValues ? "yes" : "no") << endl; + << (_measureLoadIncreasingTimeValues ? "yes" : "no") << std::endl; DomainDecompMPIBase::readXML(xmlconfig); - string oldPath(xmlconfig.getcurrentnodepath()); + std::string oldPath(xmlconfig.getcurrentnodepath()); xmlconfig.changecurrentnode("../datastructure"); xmlconfig.getNodeValue("cellsInCutoffRadius", _cellsInCutoffRadius); - global_log->info() << "KDDecomposition using cellsInCutoffRadius: " << _cellsInCutoffRadius << endl; + global_log->info() << "KDDecomposition using cellsInCutoffRadius: " << _cellsInCutoffRadius << std::endl; // reset path xmlconfig.changecurrentnode(oldPath); @@ -248,7 +246,7 @@ bool KDDecomposition::checkNeedRebalance(double lastTraversalTime) const { MPI_CHECK(MPI_Allreduce(localTraversalTimes, globalTraversalTimes, 2, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD)); globalTraversalTimes[0] *= -1.0; double timerCoeff = globalTraversalTimes[1] / globalTraversalTimes[0]; - global_log->info() << "KDDecomposition timerCoeff: " << timerCoeff << endl; + global_log->info() << "KDDecomposition timerCoeff: " << timerCoeff << std::endl; if (timerCoeff > _rebalanceLimit) { needsRebalance = true; } @@ -303,7 +301,7 @@ void KDDecomposition::balanceAndExchange(double lastTraversalTime, bool forceReb true /*doHaloPositionCheck*/, removeRecvDuplicates); } } else { - global_log->info() << "KDDecomposition: rebalancing..." << endl; + global_log->info() << "KDDecomposition: rebalancing..." << std::endl; if (_steps != 1) { DomainDecompMPIBase::exchangeMoleculesMPI(moleculeContainer, domain, LEAVING_ONLY, true /*doHaloPositionCheck*/, removeRecvDuplicates); @@ -317,8 +315,8 @@ void KDDecomposition::balanceAndExchange(double lastTraversalTime, bool forceReb constructNewTree(newDecompRoot, newOwnLeaf, moleculeContainer); bool migrationSuccessful = migrateParticles(*newDecompRoot, *newOwnLeaf, moleculeContainer, domain); if (not migrationSuccessful) { - global_log->error() << "A problem occurred during particle migration between old decomposition and new decomposition of the KDDecomposition." << endl; - global_log->error() << "Aborting. Please save your input files and last available checkpoint and contact TUM SCCS." << endl; + global_log->error() << "A problem occurred during particle migration between old decomposition and new decomposition of the KDDecomposition." << std::endl; + global_log->error() << "Aborting. Please save your input files and last available checkpoint and contact TUM SCCS." << std::endl; Simulation::exit(1); } delete _decompTree; @@ -356,21 +354,21 @@ bool KDDecomposition::migrateParticles(const KDNode& newRoot, const KDNode& newO // 4. issue Isend calls // 5. get all - vector recvPartners; + std::vector recvPartners; recvPartners.clear(); int numProcsRecv; - vector migrateToSelf; + std::vector migrateToSelf; bool willMigrateToSelf = false; // issue Recv calls { // process-leaving particles have been handled, so we only need actual area - vector ranks; - vector indices; + std::vector ranks; + std::vector indices; _decompTree->getOwningProcs(newOwnLeaf._lowCorner, newOwnLeaf._highCorner, ranks, indices); - vector numMolsToRecv; + std::vector numMolsToRecv; auto indexIt = indices.begin(); numProcsRecv = ranks.size(); // value may change from ranks.size(), see "numProcsSend--" below recvPartners.reserve(numProcsRecv); @@ -408,14 +406,14 @@ bool KDDecomposition::migrateParticles(const KDNode& newRoot, const KDNode& newO } } - vector sendPartners; + std::vector sendPartners; sendPartners.clear(); int numProcsSend; // issue Send calls { // process-leaving particles have been handled, so we only need actual area - vector ranks; - vector indices; + std::vector ranks; + std::vector indices; newRoot.getOwningProcs(_ownArea->_lowCorner, _ownArea->_highCorner, ranks, indices); auto indexIt = indices.begin(); @@ -582,7 +580,7 @@ void KDDecomposition::constructNewTree(KDNode *& newRoot, KDNode *& newOwnLeaf, result = decompose(newRoot, newOwnLeaf, MPI_COMM_WORLD); } if (result) { - global_log->warning() << "Domain too small to achieve a perfect load balancing" << endl; + global_log->warning() << "Domain too small to achieve a perfect load balancing" << std::endl; } completeTreeInfo(newRoot, newOwnLeaf); @@ -591,11 +589,11 @@ void KDDecomposition::constructNewTree(KDNode *& newRoot, KDNode *& newOwnLeaf, _neighbourCommunicationScheme->setCoverWholeDomain(d, newOwnLeaf->_coversWholeDomain[d]); } - global_log->info() << "KDDecomposition: rebalancing finished" << endl; + global_log->info() << "KDDecomposition: rebalancing finished" << std::endl; #ifndef NDEBUG if (_rank == 0) { - stringstream fname; + std::stringstream fname; fname << "kddecomp_" << _steps - 1 << ".vtu"; newRoot->plotNode(fname.str(), &_processorSpeeds); } @@ -709,9 +707,9 @@ double KDDecomposition::getBoundingBoxMax(int dimension, Domain* domain) { void KDDecomposition::completeTreeInfo(KDNode*& root, KDNode*& ownArea) { int numElementsToRecv = root->_numProcs * 2 - 1; - vector ptrToAllNodes; - vector child1; - vector child2; + std::vector ptrToAllNodes; + std::vector child1; + std::vector child2; ptrToAllNodes.resize(numElementsToRecv); child1.resize(numElementsToRecv); child2.resize(numElementsToRecv); @@ -773,15 +771,15 @@ void KDDecomposition::completeTreeInfo(KDNode*& root, KDNode*& ownArea) { #ifdef DEBUG_DECOMP void printChildrenInfo(std::ofstream& filestream, KDNode* node, double minDev) { for (int i = 0; i < node->_level; i++) { filestream << " ";} - filestream << " * " << "load=" << node->_load << " optLoad=" << node->_optimalLoadPerProcess << " expDev=" << node->_deviationLowerBound << " minDev=" << minDev << endl; + filestream << " * " << "load=" << node->_load << " optLoad=" << node->_optimalLoadPerProcess << " expDev=" << node->_deviationLowerBound << " minDev=" << minDev << std::endl; for (int i = 0; i < node->_level; i++) { filestream << " ";} filestream << " [" << node->_child1->_lowCorner[0] << "," << node->_child1->_lowCorner[1] << "," << node->_child1->_lowCorner[2] << "]" << "[" << node->_child1->_highCorner[0] << "," << node->_child1->_highCorner[1] << "," << node->_child1->_highCorner[2] << "]" - << " load=" << node->_child1->_load << " #procs=" << node->_child1->_numProcs << " avgLoad=" << node->_child1->calculateAvgLoadPerProc() << endl; + << " load=" << node->_child1->_load << " #procs=" << node->_child1->_numProcs << " avgLoad=" << node->_child1->calculateAvgLoadPerProc() << std::endl; for (int i = 0; i < node->_level; i++) { filestream << " ";} filestream << " [" << node->_child2->_lowCorner[0] << "," << node->_child2->_lowCorner[1] << "," << node->_child2->_lowCorner[2] << "]" << "[" << node->_child2->_highCorner[0] << "," << node->_child2->_highCorner[1] << "," << node->_child2->_highCorner[2] << "]" - << " load=" << node->_child2->_load << " #procs=" << node->_child2->_numProcs << " avgLoad=" << node->_child2->calculateAvgLoadPerProc() << endl; + << " load=" << node->_child2->_load << " #procs=" << node->_child2->_numProcs << " avgLoad=" << node->_child2->calculateAvgLoadPerProc() << std::endl; } #endif @@ -823,13 +821,13 @@ bool KDDecomposition::decompose(KDNode* fatherNode, KDNode*& ownArea, MPI_Comm c #ifdef DEBUG_DECOMP std::stringstream fname; fname << "Div_proc_" << _rank << "_step_" << _steps << ".txt"; - std::ofstream filestream(fname.str().c_str(), ios::app); + std::ofstream filestream(fname.str().c_str(), std::ios::app); filestream.precision(8); for (int i = 0; i < fatherNode->_level; i++) { filestream << " ";} filestream << "Division at rank=" << _rank << " for [" << fatherNode->_lowCorner[0] << ","<< fatherNode->_lowCorner[1] << "," << fatherNode->_lowCorner[2] << "] [" << fatherNode->_highCorner[0] << ","<< fatherNode->_highCorner[1] << "," << fatherNode->_highCorner[2] << "] " << - "level=" << fatherNode->_level << " #divisions=" << possibleSubdivisions.size() << endl; + "level=" << fatherNode->_level << " #divisions=" << possibleSubdivisions.size() << std::endl; #endif while (iter != possibleSubdivisions.end() && (iterations < maxIterations) && (*iter)->_deviationLowerBound < minimalDeviation) { @@ -839,7 +837,7 @@ bool KDDecomposition::decompose(KDNode* fatherNode, KDNode*& ownArea, MPI_Comm c #endif // compute the next subdivision depending on the current rank (either first or second subdivision) - vector origRanks; + std::vector origRanks; int newNumProcs; if (_rank < (*iter)->_child2->_owningProc) { // assign the current rank to either the first (child1)... origRanks.resize((*iter)->_child1->_numProcs); @@ -891,7 +889,7 @@ bool KDDecomposition::decompose(KDNode* fatherNode, KDNode*& ownArea, MPI_Comm c } #ifdef DEBUG_DECOMP for (int i = 0; i < fatherNode->_level; i++) { filestream << " ";} - filestream << " deviation=" << (*iter)->_deviation << " (ch1:" << deviationChildren[0] << "ch2:" << deviationChildren[1] << endl; + filestream << " deviation=" << (*iter)->_deviation << " (ch1:" << deviationChildren[0] << "ch2:" << deviationChildren[1] << std::endl; #endif if ((*iter)->_deviation < minimalDeviation) { delete bestSubdivision;// (deleting of nullptr is ok and does not produce errors, since delete checks for nullptr) @@ -928,8 +926,8 @@ bool KDDecomposition::decompose(KDNode* fatherNode, KDNode*& ownArea, MPI_Comm c bool KDDecomposition::calculateAllPossibleSubdivisions(KDNode* node, std::list& subdividedNodes, MPI_Comm commGroup) { bool domainTooSmall = false; - vector > costsLeft(3); - vector > costsRight(3); + std::vector > costsLeft(3); + std::vector > costsRight(3); calculateCostsPar(node, costsLeft, costsRight, commGroup); global_log->debug() << "calculateAllPossibleSubdivisions: " << std::endl; double leftRightLoadRatio = 1.; // divide load 50/50 -> this can be changed later on if the topology of the system should be taken into account. @@ -948,11 +946,11 @@ bool KDDecomposition::calculateAllPossibleSubdivisions(KDNode* node, std::list_owningProc), node->_numProcs - 1); + leftRightLoadRatioIndex = std::min((int) (iter - 1 - _accumulatedProcessorSpeeds.begin() - node->_owningProc), node->_numProcs - 1); } else { - leftRightLoadRatioIndex = min((int) (iter - _accumulatedProcessorSpeeds.begin() - node->_owningProc), node->_numProcs - 1); + leftRightLoadRatioIndex = std::min((int) (iter - _accumulatedProcessorSpeeds.begin() - node->_owningProc), node->_numProcs - 1); } - leftRightLoadRatioIndex = max(1, leftRightLoadRatioIndex); + leftRightLoadRatioIndex = std::max(1, leftRightLoadRatioIndex); leftRightLoadRatio = (_accumulatedProcessorSpeeds[node->_owningProc + leftRightLoadRatioIndex] - _accumulatedProcessorSpeeds[node->_owningProc]) / (_accumulatedProcessorSpeeds[node->_owningProc + node->_numProcs] - _accumulatedProcessorSpeeds[node->_owningProc + leftRightLoadRatioIndex]); @@ -1006,13 +1004,13 @@ bool KDDecomposition::calculateAllPossibleSubdivisions(KDNode* node, std::listdebug() << "splitLoad: startindex " << index << " of " << costsLeft[dim].size() <_highCorner[dim] - node->_lowCorner[dim] - 1) / 2); - endIndex = min(endIndex, startIndex + 1); + startIndex = std::max(startIndex, (node->_highCorner[dim] - node->_lowCorner[dim] - 1) / 2); + endIndex = std::min(endIndex, startIndex + 1); } } @@ -1038,16 +1036,16 @@ bool KDDecomposition::calculateAllPossibleSubdivisions(KDNode* node, std::list rho * (G - L) = L => L = rho / (1 + rho) * G if (fabs(*(iter - 1) - searchLoad) < fabs(*iter - searchLoad)) { // iter-1 always exists, since _accumulatedProcessorSpeeds[0] = 0 - optNumProcsLeft = min((int)(iter - 1 - _accumulatedProcessorSpeeds.begin() - node->_owningProc), node->_numProcs - 1); + optNumProcsLeft = std::min((int)(iter - 1 - _accumulatedProcessorSpeeds.begin() - node->_owningProc), node->_numProcs - 1); } else { - optNumProcsLeft = min((int)(iter - _accumulatedProcessorSpeeds.begin() - node->_owningProc), node->_numProcs - 1); + optNumProcsLeft = std::min((int)(iter - _accumulatedProcessorSpeeds.begin() - node->_owningProc), node->_numProcs - 1); } } else{ - optNumProcsLeft = min(round(costsLeft[dim][i] / optCostPerProc), (double) (node->_numProcs - 1)); + optNumProcsLeft = std::min(round(costsLeft[dim][i] / optCostPerProc), (double) (node->_numProcs - 1)); } - int numProcsLeft = max(1, optNumProcsLeft); + int numProcsLeft = std::max(1, optNumProcsLeft); auto* clone = new KDNode(*node); if (clone->_level == 0) { @@ -1088,7 +1086,7 @@ bool KDDecomposition::calculateAllPossibleSubdivisions(KDNode* node, std::list_child1->_numProcs <= 0 || clone->_child1->_numProcs >= node->_numProcs) || (clone->_child2->_numProcs <= 0 || clone->_child2->_numProcs >= node->_numProcs) ){ //continue; - global_log->error_always_output() << "ERROR in calculateAllPossibleSubdivisions(), part of the domain was not assigned to a proc" << endl; + global_log->error_always_output() << "ERROR in calculateAllPossibleSubdivisions(), part of the domain was not assigned to a proc" << std::endl; Simulation::exit(1); } mardyn_assert( clone->_child1->isResolvable() && clone->_child2->isResolvable() ); @@ -1118,8 +1116,8 @@ bool KDDecomposition::calculateAllPossibleSubdivisions(KDNode* node, std::list >& costsLeft, vector >& costsRight, MPI_Comm commGroup) { - vector > cellCosts; +void KDDecomposition::calculateCostsPar(KDNode* area, std::vector >& costsLeft, std::vector >& costsRight, MPI_Comm commGroup) { + std::vector > cellCosts; cellCosts.resize(3); int newRank; @@ -1148,8 +1146,8 @@ void KDDecomposition::calculateCostsPar(KDNode* area, vector >& c // if this process doesn't has to do anything in this dimension, continue if (startIndex > dimStopIndex[dim] || stopIndex < dimStartIndex[dim]) continue; - int loopstart = max(0, startIndex - dimStartIndex[dim]); - int loopend = min(area->_highCorner[dim] - area->_lowCorner[dim], (area->_highCorner[dim] - area->_lowCorner[dim]) + stopIndex - dimStopIndex[dim]); + int loopstart = std::max(0, startIndex - dimStartIndex[dim]); + int loopend = std::min(area->_highCorner[dim] - area->_lowCorner[dim], (area->_highCorner[dim] - area->_lowCorner[dim]) + stopIndex - dimStopIndex[dim]); bool sendCostValue = false; bool recvCostValue = false; @@ -1185,9 +1183,9 @@ void KDDecomposition::calculateCostsPar(KDNode* area, vector >& c int numParts2 = _numParticleTypes == 1 ? 0 : _numParticlesPerCell[_globalNumCells + getGlobalIndex(dim, dim1, dim2, i_dim, i_dim1, i_dim2, area)]; - //_maxPars = max(_maxPars, numParts); - _maxPars = max(_maxPars, numParts1); - _maxPars2 = max(_maxPars2, numParts2); + //_maxPars = std::max(_maxPars, numParts); + _maxPars = std::max(_maxPars, numParts1); + _maxPars2 = std::max(_maxPars2, numParts2); // ####################### // ## Cell Costs ## // ####################### @@ -1279,7 +1277,7 @@ void KDDecomposition::calculateCostsPar(KDNode* area, vector >& c } } for (int dim = 0; dim < 3; dim++) { - vector cellCostsSum; + std::vector cellCostsSum; cellCostsSum.resize(area->_highCorner[dim] - area->_lowCorner[dim] + 1, 0.0); int size2 = cellCostsSum.size(); @@ -1330,7 +1328,7 @@ int KDDecomposition::ownMod(int number, int modulo) const { } // TODO: this method could or should be moved to KDNode. -void KDDecomposition::getOwningProcs(int low[KDDIM], int high[KDDIM], KDNode* decompTree, KDNode* testNode, vector* procIDs, vector* neighbHaloAreas) const { +void KDDecomposition::getOwningProcs(int low[KDDIM], int high[KDDIM], KDNode* decompTree, KDNode* testNode, std::vector* procIDs, std::vector* neighbHaloAreas) const { // For areas overlapping the domain given by decompTree, the overlapping part is // mapped to the corresponding area on the other side of the domain (periodic boundary) // The boolean variable overlap stores for each coordinate direction whether the area overlaps. @@ -1482,8 +1480,8 @@ std::vector KDDecomposition::getNeighboursFromHaloRegion(D getCellIntCoordsFromRegionPeriodic(regToSendLo, regToSendHi, rmin, rmax, domain); - vector ranks; - vector ranges; + std::vector ranks; + std::vector ranges; _decompTree->getOwningProcs(regToSendLo, regToSendHi, ranks, ranges); int numNeighbours = ranks.size(); auto indexIt = ranges.begin(); @@ -1541,9 +1539,9 @@ std::vector KDDecomposition::getNeighboursFromHaloRegion(D return communicationPartners; } -void KDDecomposition::collectMoleculesInRegion(ParticleContainer* moleculeContainer, const double startRegion[3], const double endRegion[3], vector& mols) const { - vector> threadData; - vector prefixArray; +void KDDecomposition::collectMoleculesInRegion(ParticleContainer* moleculeContainer, const double startRegion[3], const double endRegion[3], std::vector& mols) const { + std::vector> threadData; + std::vector prefixArray; #if defined (_OPENMP) #pragma omp parallel shared(mols, threadData) @@ -1614,7 +1612,7 @@ bool KDDecomposition::heteroDecompose(KDNode* fatherNode, KDNode*& ownArea, MPI_ double minimalDeviation = std::numeric_limits::max(); // compute the next subdivision depending on the current rank (either first or second subdivision) - vector origRanks; + std::vector origRanks; int newNumProcs; if (_rank < bestSubdivision->_child2->_owningProc) { @@ -1704,8 +1702,8 @@ int KDDecomposition::calculatePartitionRank(){ bool KDDecomposition::calculateHeteroSubdivision(KDNode* node, KDNode*& optimalNode, MPI_Comm commGroup) { bool domainTooSmall = false; - vector > costsLeft(3); - vector > costsRight(3); + std::vector > costsLeft(3); + std::vector > costsRight(3); { MPI_Group group1, group2; //one group for each partition std::vector ranks1 {}; @@ -1726,7 +1724,7 @@ bool KDDecomposition::calculateHeteroSubdivision(KDNode* node, KDNode*& optimalN MPI_CHECK( MPI_Comm_create(commGroup, newGroup2, &newComm2) ); int currNumProcs = node->_numProcs; - vector> dummyCosts {3}; + std::vector> dummyCosts {3}; //calculate the load for one of the sides of each splitting plane if(rank < _partitionRank){ node->_numProcs = _partitionRank; @@ -1845,7 +1843,7 @@ bool KDDecomposition::calculateHeteroSubdivision(KDNode* node, KDNode*& optimalN if ((optimalNode->_child1->_numProcs <= 0 || optimalNode->_child1->_numProcs >= node->_numProcs) || (optimalNode->_child2->_numProcs <= 0 || optimalNode->_child2->_numProcs >= node->_numProcs) ){ //continue; - global_log->error_always_output() << "ERROR in calculateHeteroSubdivision(), part of the domain was not assigned to a proc" << endl; + global_log->error_always_output() << "ERROR in calculateHeteroSubdivision(), part of the domain was not assigned to a proc" << std::endl; Simulation::exit(1); } mardyn_assert( optimalNode->_child1->isResolvable() && optimalNode->_child2->isResolvable() ); diff --git a/src/parallel/KDNode.cpp b/src/parallel/KDNode.cpp index 58457ff952..ef7afb0a62 100644 --- a/src/parallel/KDNode.cpp +++ b/src/parallel/KDNode.cpp @@ -13,7 +13,6 @@ #include /* for min and max ?*/ -using namespace Log; KDNode* KDNode::findAreaForProcess(int rank) { if (_numProcs == 1) { diff --git a/src/parallel/LoadCalc.cpp b/src/parallel/LoadCalc.cpp index 1b64f41190..006e59cfbd 100644 --- a/src/parallel/LoadCalc.cpp +++ b/src/parallel/LoadCalc.cpp @@ -213,7 +213,7 @@ arma::vec nnls_coordinate_wise(const arma::mat &A, const arma::vec &b, int max_i int i = 0; double tmp; - while (i < max_iter && max(abs(x - x0)) > tol) { + while (i < max_iter && std::max(abs(x - x0)) > tol) { x0 = x; for (unsigned int k = 0; k < A.n_cols; k++) { tmp = x[k] - mu[k] / H.at(k, k); diff --git a/src/parallel/NonBlockingMPIHandlerBase.cpp b/src/parallel/NonBlockingMPIHandlerBase.cpp index 657e33d14b..56d05f2b4d 100644 --- a/src/parallel/NonBlockingMPIHandlerBase.cpp +++ b/src/parallel/NonBlockingMPIHandlerBase.cpp @@ -13,7 +13,6 @@ #include "plugins/PluginBase.h" #include "utils/Logger.h" -using Log::global_log; NonBlockingMPIHandlerBase::NonBlockingMPIHandlerBase(DomainDecompMPIBase* domainDecomposition, ParticleContainer* moleculeContainer, Domain* domain, diff --git a/src/parallel/NonBlockingMPIMultiStepHandler.cpp b/src/parallel/NonBlockingMPIMultiStepHandler.cpp index e674ff4644..21f87ef4a7 100644 --- a/src/parallel/NonBlockingMPIMultiStepHandler.cpp +++ b/src/parallel/NonBlockingMPIMultiStepHandler.cpp @@ -13,8 +13,6 @@ #include "particleContainer/adapter/CellProcessor.h" #include "utils/Logger.h" -using Log::global_log; -using namespace std; NonBlockingMPIMultiStepHandler::NonBlockingMPIMultiStepHandler(DomainDecompMPIBase* domainDecomposition, ParticleContainer* moleculeContainer, Domain* domain, diff --git a/src/parallel/ResilienceComm.cpp b/src/parallel/ResilienceComm.cpp index 53ed78f4a1..2d008a1e8c 100644 --- a/src/parallel/ResilienceComm.cpp +++ b/src/parallel/ResilienceComm.cpp @@ -12,7 +12,6 @@ #include #include "utils/Logger.h" -using Log::global_log; //pretty much default ResilienceComm::ResilienceComm(int numProcs, int rank) diff --git a/src/parallel/tests/CollectiveCommunicationTest.cpp b/src/parallel/tests/CollectiveCommunicationTest.cpp index 65c42f093c..9ad7550415 100644 --- a/src/parallel/tests/CollectiveCommunicationTest.cpp +++ b/src/parallel/tests/CollectiveCommunicationTest.cpp @@ -16,7 +16,6 @@ TEST_SUITE_REGISTRATION(CollectiveCommunicationTest); -using namespace std; CollectiveCommunicationTest::CollectiveCommunicationTest() : _rank(0) { diff --git a/src/parallel/tests/CommunicationBufferTest.cpp b/src/parallel/tests/CommunicationBufferTest.cpp index f131e476fc..7d255ebd14 100644 --- a/src/parallel/tests/CommunicationBufferTest.cpp +++ b/src/parallel/tests/CommunicationBufferTest.cpp @@ -16,7 +16,6 @@ #include "ensemble/CanonicalEnsemble.h" #include -using namespace std; TEST_SUITE_REGISTRATION(CommunicationBufferTest); diff --git a/src/parallel/tests/KDDecompositionTest.cpp b/src/parallel/tests/KDDecompositionTest.cpp index e2caf93646..af0f67dcba 100644 --- a/src/parallel/tests/KDDecompositionTest.cpp +++ b/src/parallel/tests/KDDecompositionTest.cpp @@ -21,7 +21,6 @@ TEST_SUITE_REGISTRATION(KDDecompositionTest); -using namespace std; KDDecompositionTest::KDDecompositionTest() : _rank(0) { @@ -401,15 +400,15 @@ void KDDecompositionTest::testRebalancingDeadlocks() { fNew << "new_" << i << ".vtu"; newDecompRoot->plotNode(fNew.str()); - cout << "current coeffs: " << std::endl; - cout << setprecision(17); + std::cout << "current coeffs: " << std::endl; + std::cout << std::setprecision(17); for (double _currentCoeff : _currentCoeffs) { - cout << _currentCoeff << std::endl; + std::cout << _currentCoeff << std::endl; } - cout << std::endl; - cout << "old coeffs: " << std::endl; + std::cout << std::endl; + std::cout << "old coeffs: " << std::endl; for (double _oldCoeff : _oldCoeffs) { - cout << _oldCoeff << std::endl; + std::cout << _oldCoeff << std::endl; } } @@ -548,18 +547,18 @@ void KDDecompositionTest::clearNumParticlesPerCell(std::vector &v, void KDDecompositionTest::Write_VTK_Structured_Points(unsigned *A, int N[3], std::string& filename) const { std::ofstream ofs(filename, std::ios::out); - ofs << "# vtk DataFile Version 3.0" << endl; - ofs << "Laplace" << endl; - ofs << "ASCII" << endl; - ofs << "DATASET STRUCTURED_POINTS" << endl; - ofs << "DIMENSIONS " << N[0] << " " << N[1] << " " << N[2] << endl; - ofs << "ORIGIN 0 0 0"<< endl; - ofs << "SPACING 1 1 1" << endl; - ofs << "POINT_DATA " << N[0]*N[1]*N[2] << endl; - ofs << "SCALARS nMols int 1" << endl; - ofs << "LOOKUP_TABLE default" << endl; + ofs << "# vtk DataFile Version 3.0" << std::endl; + ofs << "Laplace" << std::endl; + ofs << "ASCII" << std::endl; + ofs << "DATASET STRUCTURED_POINTS" << std::endl; + ofs << "DIMENSIONS " << N[0] << " " << N[1] << " " << N[2] << std::endl; + ofs << "ORIGIN 0 0 0"<< std::endl; + ofs << "SPACING 1 1 1" << std::endl; + ofs << "POINT_DATA " << N[0]*N[1]*N[2] << std::endl; + ofs << "SCALARS nMols int 1" << std::endl; + ofs << "LOOKUP_TABLE default" << std::endl; for (int i = 0; i < N[0] * N[1] * N[2]; i++) { - ofs << A[i] << endl; + ofs << A[i] << std::endl; } ofs.close(); } diff --git a/src/parallel/tests/NeighborAcquirerTest.cpp b/src/parallel/tests/NeighborAcquirerTest.cpp index e6c1898341..7912d38261 100644 --- a/src/parallel/tests/NeighborAcquirerTest.cpp +++ b/src/parallel/tests/NeighborAcquirerTest.cpp @@ -9,7 +9,6 @@ #include "NeighborAcquirerTest.h" #include "parallel/NeighborAcquirer.h" -using namespace std; TEST_SUITE_REGISTRATION(NeighborAcquirerTest); diff --git a/src/particleContainer/AutoPasContainer.cpp b/src/particleContainer/AutoPasContainer.cpp index ddc2804865..368846af9f 100644 --- a/src/particleContainer/AutoPasContainer.cpp +++ b/src/particleContainer/AutoPasContainer.cpp @@ -143,20 +143,20 @@ AutoPasContainer::AutoPasContainer(double cutoff) : _cutoff(cutoff), _particlePr #ifdef ENABLE_MPI std::stringstream logFileName, outputSuffix; - auto timeNow = chrono::system_clock::now(); + auto timeNow = std::chrono::system_clock::now(); auto time_tNow = std::chrono::system_clock::to_time_t(timeNow); auto maxRank = global_simulation->domainDecomposition().getNumProcs(); auto numDigitsMaxRank = std::to_string(maxRank).length(); auto myRank = global_simulation->domainDecomposition().getRank(); - logFileName << "AutoPas_Rank" << setfill('0') << setw(numDigitsMaxRank) << myRank << "_" + logFileName << "AutoPas_Rank" << std::setfill('0') << std::setw(numDigitsMaxRank) << myRank << "_" << std::put_time(std::localtime(&time_tNow), "%Y-%m-%d_%H-%M-%S") << ".log"; _logFile.open(logFileName.str()); _autopasContainer = decltype(_autopasContainer)(_logFile); - outputSuffix << "Rank" << setfill('0') << setw(numDigitsMaxRank) << myRank << "_"; + outputSuffix << "Rank" << std::setfill('0') << std::setw(numDigitsMaxRank) << myRank << "_"; _autopasContainer.setOutputSuffix(outputSuffix.str()); #endif } @@ -192,7 +192,7 @@ auto parseAutoPasOption(XMLfileUnits &xmlconfig, const std::string &xmlString, } void AutoPasContainer::readXML(XMLfileUnits &xmlconfig) { - string oldPath(xmlconfig.getcurrentnodepath()); + std::string oldPath(xmlconfig.getcurrentnodepath()); // if any option is not specified in the XML use the autopas defaults // get option values from xml @@ -312,49 +312,49 @@ bool AutoPasContainer::rebuild(double *bBoxMin, double *bBoxMax) { // print full configuration to the command line int valueOffset = 28; - global_log->info() << "AutoPas configuration:" << endl - << setw(valueOffset) << left << "Data Layout " + global_log->info() << "AutoPas configuration:" << std::endl + << std::setw(valueOffset) << left << "Data Layout " << ": " << autopas::utils::ArrayUtils::to_string(_autopasContainer.getAllowedDataLayouts()) - << endl - << setw(valueOffset) << left << "Container " + << std::endl + << std::setw(valueOffset) << left << "Container " << ": " << autopas::utils::ArrayUtils::to_string(_autopasContainer.getAllowedContainers()) - << endl - << setw(valueOffset) << left << "Cell size Factor " - << ": " << _autopasContainer.getAllowedCellSizeFactors() << endl - << setw(valueOffset) << left << "Traversals " + << std::endl + << std::setw(valueOffset) << left << "Cell size Factor " + << ": " << _autopasContainer.getAllowedCellSizeFactors() << std::endl + << std::setw(valueOffset) << left << "Traversals " << ": " << autopas::utils::ArrayUtils::to_string(_autopasContainer.getAllowedTraversals()) - << endl - << setw(valueOffset) << left << "Newton3" + << std::endl + << std::setw(valueOffset) << left << "Newton3" << ": " << autopas::utils::ArrayUtils::to_string(_autopasContainer.getAllowedNewton3Options()) - << endl - << setw(valueOffset) << left << "Tuning strategy " - << ": " << _autopasContainer.getTuningStrategyOption() << endl - << setw(valueOffset) << left << "Selector strategy " - << ": " << _autopasContainer.getSelectorStrategy() << endl - << setw(valueOffset) << left << "Tuning frequency" - << ": " << _autopasContainer.getTuningInterval() << endl - << setw(valueOffset) << left << "Number of samples " - << ": " << _autopasContainer.getNumSamples() << endl - << setw(valueOffset) << left << "Tuning Acquisition Function" - << ": " << _autopasContainer.getAcquisitionFunction() << endl - << setw(valueOffset) << left << "Number of evidence " - << ": " << _autopasContainer.getMaxEvidence() << endl - << setw(valueOffset) << left << "Verlet Cluster size " - << ": " << _autopasContainer.getVerletClusterSize() << endl - << setw(valueOffset) << left << "Rebuild frequency " - << ": " << _autopasContainer.getVerletRebuildFrequency() << endl - << setw(valueOffset) << left << "Verlet Skin " - << ": " << _autopasContainer.getVerletSkin() << endl - << setw(valueOffset) << left << "Optimum Range " - << ": " << _autopasContainer.getRelativeOptimumRange() << endl - << setw(valueOffset) << left << "Tuning Phases without test " - << ": " << _autopasContainer.getMaxTuningPhasesWithoutTest() << endl - << setw(valueOffset) << left << "Blacklist Range " - << ": " << _autopasContainer.getRelativeBlacklistRange() << endl - << setw(valueOffset) << left << "Evidence for prediction " - << ": " << _autopasContainer.getEvidenceFirstPrediction() << endl - << setw(valueOffset) << left << "Extrapolation method " - << ": " << _autopasContainer.getExtrapolationMethodOption() << endl; + << std::endl + << std::setw(valueOffset) << left << "Tuning strategy " + << ": " << _autopasContainer.getTuningStrategyOption() << std::endl + << std::setw(valueOffset) << left << "Selector strategy " + << ": " << _autopasContainer.getSelectorStrategy() << std::endl + << std::setw(valueOffset) << left << "Tuning frequency" + << ": " << _autopasContainer.getTuningInterval() << std::endl + << std::setw(valueOffset) << left << "Number of samples " + << ": " << _autopasContainer.getNumSamples() << std::endl + << std::setw(valueOffset) << left << "Tuning Acquisition Function" + << ": " << _autopasContainer.getAcquisitionFunction() << std::endl + << std::setw(valueOffset) << left << "Number of evidence " + << ": " << _autopasContainer.getMaxEvidence() << std::endl + << std::setw(valueOffset) << left << "Verlet Cluster size " + << ": " << _autopasContainer.getVerletClusterSize() << std::endl + << std::setw(valueOffset) << left << "Rebuild frequency " + << ": " << _autopasContainer.getVerletRebuildFrequency() << std::endl + << std::setw(valueOffset) << left << "Verlet Skin " + << ": " << _autopasContainer.getVerletSkin() << std::endl + << std::setw(valueOffset) << left << "Optimum Range " + << ": " << _autopasContainer.getRelativeOptimumRange() << std::endl + << std::setw(valueOffset) << left << "Tuning Phases without test " + << ": " << _autopasContainer.getMaxTuningPhasesWithoutTest() << std::endl + << std::setw(valueOffset) << left << "Blacklist Range " + << ": " << _autopasContainer.getRelativeBlacklistRange() << std::endl + << std::setw(valueOffset) << left << "Evidence for prediction " + << ": " << _autopasContainer.getEvidenceFirstPrediction() << std::endl + << std::setw(valueOffset) << left << "Extrapolation method " + << ": " << _autopasContainer.getExtrapolationMethodOption() << std::endl; /// @todo return sendHaloAndLeavingTogether, (always false) for simplicity. return false; diff --git a/src/particleContainer/FullParticleCell.cpp b/src/particleContainer/FullParticleCell.cpp index 2fecf86932..4a9f37c1de 100644 --- a/src/particleContainer/FullParticleCell.cpp +++ b/src/particleContainer/FullParticleCell.cpp @@ -14,7 +14,6 @@ #include "utils/mardyn_assert.h" #include -using namespace std; FullParticleCell::FullParticleCell() : _molecules(), _cellDataSoA(0, 0, 0, 0, 0) { diff --git a/src/particleContainer/LinkedCellTraversals/C08BasedTraversals.h b/src/particleContainer/LinkedCellTraversals/C08BasedTraversals.h index 5fd3fcc8d4..6cf2138705 100644 --- a/src/particleContainer/LinkedCellTraversals/C08BasedTraversals.h +++ b/src/particleContainer/LinkedCellTraversals/C08BasedTraversals.h @@ -65,7 +65,7 @@ void C08BasedTraversals::processBaseCell(CellProcessor& cellProces const int num_pairs = _cellPairOffsets8Pack.size(); for(int j = 0; j < num_pairs; ++j) { - pair current_pair = _cellPairOffsets8Pack[j]; + std::pair current_pair = _cellPairOffsets8Pack[j]; unsigned offset1 = current_pair.first; unsigned cellIndex1 = baseIndex + offset1; @@ -119,21 +119,21 @@ void C08BasedTraversals::computeOffsets() { int i = 0; // if incrementing along X, the following order will be more cache-efficient: - _cellPairOffsets8Pack[i++] = make_pair(o, o ); - _cellPairOffsets8Pack[i++] = make_pair(o, y ); - _cellPairOffsets8Pack[i++] = make_pair(y, z ); - _cellPairOffsets8Pack[i++] = make_pair(o, z ); - _cellPairOffsets8Pack[i++] = make_pair(o, yz ); - - _cellPairOffsets8Pack[i++] = make_pair(x, yz ); - _cellPairOffsets8Pack[i++] = make_pair(x, y ); - _cellPairOffsets8Pack[i++] = make_pair(x, z ); - _cellPairOffsets8Pack[i++] = make_pair(o, x ); - _cellPairOffsets8Pack[i++] = make_pair(o, xy ); - _cellPairOffsets8Pack[i++] = make_pair(xy, z ); - _cellPairOffsets8Pack[i++] = make_pair(y, xz ); - _cellPairOffsets8Pack[i++] = make_pair(o, xz ); - _cellPairOffsets8Pack[i++] = make_pair(o, xyz); + _cellPairOffsets8Pack[i++] = std::make_pair(o, o ); + _cellPairOffsets8Pack[i++] = std::make_pair(o, y ); + _cellPairOffsets8Pack[i++] = std::make_pair(y, z ); + _cellPairOffsets8Pack[i++] = std::make_pair(o, z ); + _cellPairOffsets8Pack[i++] = std::make_pair(o, yz ); + + _cellPairOffsets8Pack[i++] = std::make_pair(x, yz ); + _cellPairOffsets8Pack[i++] = std::make_pair(x, y ); + _cellPairOffsets8Pack[i++] = std::make_pair(x, z ); + _cellPairOffsets8Pack[i++] = std::make_pair(o, x ); + _cellPairOffsets8Pack[i++] = std::make_pair(o, xy ); + _cellPairOffsets8Pack[i++] = std::make_pair(xy, z ); + _cellPairOffsets8Pack[i++] = std::make_pair(y, xz ); + _cellPairOffsets8Pack[i++] = std::make_pair(o, xz ); + _cellPairOffsets8Pack[i++] = std::make_pair(o, xyz); i = 0; _cellOffsets8Pack[i++] = o; diff --git a/src/particleContainer/LinkedCellTraversals/C08CellPairTraversal.h b/src/particleContainer/LinkedCellTraversals/C08CellPairTraversal.h index 6d64fc24f3..06c1f7c5eb 100644 --- a/src/particleContainer/LinkedCellTraversals/C08CellPairTraversal.h +++ b/src/particleContainer/LinkedCellTraversals/C08CellPairTraversal.h @@ -47,8 +47,8 @@ void C08CellPairTraversal::traverseCellPairs( CellProcessor& cellProcessor) { using std::array; - const array strides = { 2, 2, 2 }; - array end; + const std::array strides = { 2, 2, 2 }; + std::array end; for (int d = 0; d < 3; ++d) { end[d] = this->_dims[d] - 1; } @@ -84,7 +84,7 @@ void C08CellPairTraversal::traverseCellPairsOuter( using std::array; { - unsigned long minsize = min(this->_dims[0], min(this->_dims[1], this->_dims[2])); + unsigned long minsize = std::min(this->_dims[0], std::min(this->_dims[1], this->_dims[2])); if (minsize <= 5) { // iterating in the inner region didn't do anything. Iterate normally. @@ -93,7 +93,7 @@ void C08CellPairTraversal::traverseCellPairsOuter( } } - const array strides2 = { 2, 2, 2 }; + const std::array strides2 = { 2, 2, 2 }; #if defined(_OPENMP) #pragma omp parallel @@ -101,26 +101,26 @@ void C08CellPairTraversal::traverseCellPairsOuter( { for (unsigned long col = 0; col < 8; ++col) { // halo & boundaries in z direction - const array< unsigned long, 3> begin = threeDimensionalMapping::oneToThreeD(col, strides2); + const std::array< unsigned long, 3> begin = threeDimensionalMapping::oneToThreeD(col, strides2); // values, which are modified by 2 are actually modified by the respective stride, which is always 2 - array startZ = { begin[0], begin[1], begin[2] }; // default - array endZ = { this->_dims[0] - 1, this->_dims[1] - 1, this->_dims[2] - 1 }; // default - array stridesZ = {strides2[0], strides2[1], this->_dims[2] - 3}; // mod z + std::array startZ = { begin[0], begin[1], begin[2] }; // default + std::array endZ = { this->_dims[0] - 1, this->_dims[1] - 1, this->_dims[2] - 1 }; // default + std::array stridesZ = {strides2[0], strides2[1], this->_dims[2] - 3}; // mod z traverseCellPairsBackend(cellProcessor, startZ, endZ, stridesZ); // halo & boundaries in y direction // boundaries in z direction are excluded! - array startY = { begin[0], begin[1], begin[2] + 2 }; // mod z - array endY = { this->_dims[0] - 1, this->_dims[1] - 1, this->_dims[2] - 3 }; // mod z - array stridesY = {strides2[0], this->_dims[1] - 3, strides2[2]}; // mod y + std::array startY = { begin[0], begin[1], begin[2] + 2 }; // mod z + std::array endY = { this->_dims[0] - 1, this->_dims[1] - 1, this->_dims[2] - 3 }; // mod z + std::array stridesY = {strides2[0], this->_dims[1] - 3, strides2[2]}; // mod y traverseCellPairsBackend(cellProcessor, startY, endY, stridesY); // halo & boundaries in x direction // boundaries in z and y direction are excluded! - array startX = { begin[0], begin[1] + 2, begin[2] + 2 }; // mod yz - array endX = { this->_dims[0] - 1, this->_dims[1] - 3, this->_dims[2] - 3 }; // mod yz - array stridesX = {this->_dims[0] - 3, strides2[1], strides2[2]}; // mod x + std::array startX = { begin[0], begin[1] + 2, begin[2] + 2 }; // mod yz + std::array endX = { this->_dims[0] - 1, this->_dims[1] - 3, this->_dims[2] - 3 }; // mod yz + std::array stridesX = {this->_dims[0] - 3, strides2[1], strides2[2]}; // mod x traverseCellPairsBackend(cellProcessor, startX, endX, stridesX); #if defined(_OPENMP) @@ -149,7 +149,7 @@ void C08CellPairTraversal::traverseCellPairsInner( } } unsigned long splitsize = maxcellsize - 5; - unsigned long minsize = min(this->_dims[0], min(this->_dims[1], this->_dims[2])); + unsigned long minsize = std::min(this->_dims[0], std::min(this->_dims[1], this->_dims[2])); mardyn_assert(minsize >= 4); // there should be at least 4 cells in each dimension, otherwise we did something stupid! @@ -157,8 +157,8 @@ void C08CellPairTraversal::traverseCellPairsInner( return; // we can not iterate over any inner cells, that do not depend on boundary or halo cells } - array lower; - array upper; + std::array lower; + std::array upper; for (unsigned long i = 0; i < 3; i++) { lower[i] = 2; upper[i] = this->_dims[i] - 3; @@ -171,10 +171,10 @@ void C08CellPairTraversal::traverseCellPairsInner( #pragma omp parallel #endif { - array strides = {2, 2, 2}; + std::array strides = {2, 2, 2}; for (unsigned long col = 0; col < 8; ++col) { - array startIndices = threeDimensionalMapping::oneToThreeD(col, strides); + std::array startIndices = threeDimensionalMapping::oneToThreeD(col, strides); for (int i = 0; i < 3; i++) { startIndices[i] = startIndices[i] + lower[i]; } diff --git a/src/particleContainer/LinkedCellTraversals/MidpointTraversal.h b/src/particleContainer/LinkedCellTraversals/MidpointTraversal.h index e9466a4dd7..7531c68371 100644 --- a/src/particleContainer/LinkedCellTraversals/MidpointTraversal.h +++ b/src/particleContainer/LinkedCellTraversals/MidpointTraversal.h @@ -143,17 +143,17 @@ void MidpointTraversal::computeOffsets3D() { // process only half of the faces to get no pair twice for(int i=0; i<3; ++i){ // faces int j = (i+3)%6; - _offsets3D[index++] = make_pair(_faces[i], _faces[j]); + _offsets3D[index++] = std::make_pair(_faces[i], _faces[j]); } // process only half of the edges to get no pair twice for(int i=0; i<6; ++i){ // edges int j = (i+6)%12; - _offsets3D[index++] = make_pair(_edges[i], _edges[j]); + _offsets3D[index++] = std::make_pair(_edges[i], _edges[j]); } // process only half of the corners to get no pair twice for(int i=0; i<4; ++i){ // corners int j = (i+4)%8; - _offsets3D[index++] = make_pair(_corners[i], _corners[j]); + _offsets3D[index++] = std::make_pair(_corners[i], _corners[j]); } mardyn_assert(index == 13); @@ -243,14 +243,14 @@ void MidpointTraversal::pairOriginWithForwardNeighbors(int& index) for(long y=-1; y<=1; ++y){ // 3 * 4 for(long x=-1; x<=1; ++x){ // 3 - _offsets3D[index++] = make_pair(origin, std::array{x, y, 1l}); + _offsets3D[index++] = std::make_pair(origin, std::array{x, y, 1l}); } // 1st - _offsets3D[index++] = make_pair(origin, std::array{1l, y, 0l}); + _offsets3D[index++] = std::make_pair(origin, std::array{1l, y, 0l}); } // 13th - _offsets3D[index++] = make_pair(origin, std::array{0l, 1l, 0l}); + _offsets3D[index++] = std::make_pair(origin, std::array{0l, 1l, 0l}); } diff --git a/src/particleContainer/LinkedCellTraversals/OriginalCellPairTraversal.h b/src/particleContainer/LinkedCellTraversals/OriginalCellPairTraversal.h index 5ddffb7388..12fb7b487c 100644 --- a/src/particleContainer/LinkedCellTraversals/OriginalCellPairTraversal.h +++ b/src/particleContainer/LinkedCellTraversals/OriginalCellPairTraversal.h @@ -74,7 +74,7 @@ void OriginalCellPairTraversal::rebuild(std::vector } } } else { - global_log->error() << "OriginalCellPairTraversalDat::rebuild was called with incompatible Traversal data!" << endl; + global_log->error() << "OriginalCellPairTraversalDat::rebuild was called with incompatible Traversal data!" << std::endl; Simulation::exit(-1); } } diff --git a/src/particleContainer/LinkedCellTraversals/QuickschedTraversal.h b/src/particleContainer/LinkedCellTraversals/QuickschedTraversal.h index c94dc2f589..31ca77168c 100644 --- a/src/particleContainer/LinkedCellTraversals/QuickschedTraversal.h +++ b/src/particleContainer/LinkedCellTraversals/QuickschedTraversal.h @@ -17,7 +17,6 @@ #include "quicksched.h" #endif -using Log::global_log; struct QuickschedTraversalData : CellPairTraversalData { std::array taskBlockSize; @@ -52,7 +51,7 @@ class QuickschedTraversal : public C08BasedTraversals { static void runner(int type, void *data); - array _taskBlocksize; + std::array _taskBlocksize; CellProcessor *_contextCellProcessor; struct qsched *_scheduler; @@ -88,7 +87,7 @@ void QuickschedTraversal::rebuild(std::vector &cells _taskBlocksize = qui_data->taskBlockSize; init(); } else { - global_log->error() << "QuickschedTraversal::rebuild was called with incompatible Traversal data!" << endl; + global_log->error() << "QuickschedTraversal::rebuild was called with incompatible Traversal data!" << std::endl; } #endif /* QUICKSCHED */ } @@ -100,9 +99,9 @@ void QuickschedTraversal::init() { qsched_task_t taskId; unsigned long cellIndex; // macro for easier access and to avoid aliasing -//#define m_cells (*((vector *)(this->_cells))) -// vector m_cells = *(dynamic_cast *>(this->_cells)); - vector m_cells = *((vector *)(this->_cells)); +//#define m_cells (*((std::vector *)(this->_cells))) +// std::vector m_cells = *(dynamic_cast *>(this->_cells)); + std::vector m_cells = *((std::vector *)(this->_cells)); switch (_taskTypeSelector) { case PackedAdjustable: { diff --git a/src/particleContainer/LinkedCellTraversals/SlicedCellPairTraversal.h b/src/particleContainer/LinkedCellTraversals/SlicedCellPairTraversal.h index 9d89b5586a..1d5e484710 100644 --- a/src/particleContainer/LinkedCellTraversals/SlicedCellPairTraversal.h +++ b/src/particleContainer/LinkedCellTraversals/SlicedCellPairTraversal.h @@ -82,8 +82,8 @@ template inline void SlicedCellPairTraversal::traverseCellPairs( CellProcessor& cellProcessor) { using std::array; - const array start = { 0, 0, 0 }; - array end; + const std::array start = { 0, 0, 0 }; + std::array end; for (int d = 0; d < 3; ++d) { end[d] = this->_dims[d] - 1; } @@ -108,37 +108,37 @@ inline void SlicedCellPairTraversal::traverseCellPairsOuter( // values, which are modified by 2 are actually modified by the respective stride, which is always 2 // lower part - array startZlo = { 0, 0, 0 }; - array endZlo = { this->_dims[0] - 1, this->_dims[1] - 1, 2 }; + std::array startZlo = { 0, 0, 0 }; + std::array endZlo = { this->_dims[0] - 1, this->_dims[1] - 1, 2 }; traverseCellPairsBackend(cellProcessor, startZlo, endZlo); // upper part - array startZhi = { 0, 0, this->_dims[2] - 3 }; - array endZhi = { this->_dims[0] - 1, this->_dims[1] - 1, this->_dims[2] - 1 }; + std::array startZhi = { 0, 0, this->_dims[2] - 3 }; + std::array endZhi = { this->_dims[0] - 1, this->_dims[1] - 1, this->_dims[2] - 1 }; traverseCellPairsBackend(cellProcessor, startZhi, endZhi); // halo & boundaries in y direction // boundaries in z direction are excluded! // lower part - array startYlo = { 0, 0, 2 }; - array endYlo = { this->_dims[0] - 1, 2, this->_dims[2] - 3 }; + std::array startYlo = { 0, 0, 2 }; + std::array endYlo = { this->_dims[0] - 1, 2, this->_dims[2] - 3 }; traverseCellPairsBackend(cellProcessor, startYlo, endYlo); // upper part - array startYhi = { 0, this->_dims[1] - 3, 2 }; - array endYhi = { this->_dims[0] - 1, this->_dims[1] - 1, this->_dims[2] - 3 }; + std::array startYhi = { 0, this->_dims[1] - 3, 2 }; + std::array endYhi = { this->_dims[0] - 1, this->_dims[1] - 1, this->_dims[2] - 3 }; traverseCellPairsBackend(cellProcessor, startYhi, endYhi); // halo & boundaries in x direction // boundaries in z and y direction are excluded! // lower part - array startXlo = { 0, 2, 2 }; - array endXlo = { 2, this->_dims[1] - 3, this->_dims[2] - 3 }; + std::array startXlo = { 0, 2, 2 }; + std::array endXlo = { 2, this->_dims[1] - 3, this->_dims[2] - 3 }; traverseCellPairsBackend(cellProcessor, startXlo, endXlo); // upper part - array startXhi = { this->_dims[0] - 3, 2, 2 }; - array endXhi = { this->_dims[0] - 1, this->_dims[1] - 3, this->_dims[2] - 3 }; + std::array startXhi = { this->_dims[0] - 3, 2, 2 }; + std::array endXhi = { this->_dims[0] - 1, this->_dims[1] - 3, this->_dims[2] - 3 }; traverseCellPairsBackend(cellProcessor, startXhi, endXhi); } @@ -166,8 +166,8 @@ inline void SlicedCellPairTraversal::traverseCellPairsInner( return; // we can not iterate over any inner cells, that do not depend on boundary or halo cells } - array lower; - array upper; + std::array lower; + std::array upper; for (unsigned long i = 0; i < 3; i++) { lower[i] = 2; upper[i] = this->_dims[i] - 3; @@ -194,7 +194,7 @@ inline void SlicedCellPairTraversal::traverseCellPairsBackend( mardyn_exit(1); } - array diff; + std::array diff; unsigned long num_cells = 1; for(int d = 0; d < 3; ++d) { @@ -209,8 +209,8 @@ inline void SlicedCellPairTraversal::traverseCellPairsBackend( #endif { Permutation perm = getPermutationForIncreasingSorting(diff); - array diff_permuted = permuteForward(perm, diff); - array start_permuted = permuteForward(perm, start); + std::array diff_permuted = permuteForward(perm, diff); + std::array start_permuted = permuteForward(perm, start); initLocks(); @@ -238,7 +238,7 @@ inline void SlicedCellPairTraversal::traverseCellPairsBackend( } // unroll - array newInd_permuted = threeDimensionalMapping::oneToThreeD(i,diff_permuted); + std::array newInd_permuted = threeDimensionalMapping::oneToThreeD(i,diff_permuted); // add inner-, middle- and outer-start for(int d = 0; d < 3; ++d) { @@ -246,7 +246,7 @@ inline void SlicedCellPairTraversal::traverseCellPairsBackend( } // permute newInd backwards - array newInd = permuteBackward(perm, newInd_permuted); + std::array newInd = permuteBackward(perm, newInd_permuted); // get actual index unsigned long cellIndex = threeDimensionalMapping::threeToOneD(newInd, this->_dims); @@ -320,8 +320,8 @@ template inline bool SlicedCellPairTraversal::isApplicable( const std::array& dims) { using std::array; - const array start = { 0, 0, 0 }; - array end; + const std::array start = { 0, 0, 0 }; + std::array end; for (int d = 0; d < 3; ++d) { end[d] = dims[d] - 1; } @@ -337,9 +337,9 @@ inline bool SlicedCellPairTraversal::isApplicable( using namespace Permute3Elements; using std::array; - array dims = {end[0] - start[0], end[1] - start[1], end[2] - start[2]}; + std::array dims = {end[0] - start[0], end[1] - start[1], end[2] - start[2]}; Permutation permutation = getPermutationForIncreasingSorting(dims); - array dimsPermuted = permuteForward(permutation, dims); + std::array dimsPermuted = permuteForward(permutation, dims); int num_threads = mardyn_get_max_threads(); diff --git a/src/particleContainer/LinkedCells.cpp b/src/particleContainer/LinkedCells.cpp index 14f8e77c92..5aed0b9881 100644 --- a/src/particleContainer/LinkedCells.cpp +++ b/src/particleContainer/LinkedCells.cpp @@ -28,8 +28,6 @@ #include "ResortCellProcessorSliced.h" -using namespace std; -using Log::global_log; //################################################ //############ PUBLIC METHODS #################### @@ -44,8 +42,8 @@ LinkedCells::LinkedCells(double bBoxMin[3], double bBoxMax[3], int numberOfCells = 1; _cutoffRadius = cutoffRadius; - global_log->debug() << "cutoff: " << cutoffRadius << endl; - global_log->debug() << "# cells in cutoff hardcoded to 1 " << endl; + global_log->debug() << "cutoff: " << cutoffRadius << std::endl; + global_log->debug() << "# cells in cutoff hardcoded to 1 " << std::endl; for (int d = 0; d < 3; d++) { /* first calculate the cell length for this dimension */ @@ -72,10 +70,10 @@ LinkedCells::LinkedCells(double bBoxMin[3], double bBoxMax[3], mardyn_assert(numberOfCells > 0); } global_log->debug() << "Cell size (" << _cellLength[0] << ", " - << _cellLength[1] << ", " << _cellLength[2] << ")" << endl; + << _cellLength[1] << ", " << _cellLength[2] << ")" << std::endl; global_log->info() << "Cells per dimension (incl. halo): " << _cellsPerDimension[0] << " x " << _cellsPerDimension[1] << " x " - << _cellsPerDimension[2] << endl; + << _cellsPerDimension[2] << std::endl; _cells.resize(numberOfCells); @@ -87,16 +85,16 @@ LinkedCells::LinkedCells(double bBoxMin[3], double bBoxMax[3], || _boxWidthInNumCells[2] < 2 * _haloWidthInNumCells[2]) { global_log->error_always_output() << "LinkedCells (constructor): bounding box too small for calculated cell length" - << endl; + << std::endl; global_log->error_always_output() << "_cellsPerDimension: " << _cellsPerDimension[0] << " / " << _cellsPerDimension[1] << " / " - << _cellsPerDimension[2] << endl; + << _cellsPerDimension[2] << std::endl; global_log->error_always_output() << "_haloWidthInNumCells: " << _haloWidthInNumCells[0] << " / " << _haloWidthInNumCells[1] - << " / " << _haloWidthInNumCells[2] << endl; + << " / " << _haloWidthInNumCells[2] << std::endl; global_log->error_always_output() << "_boxWidthInNumCells: " << _boxWidthInNumCells[0] << " / " << _boxWidthInNumCells[1] << " / " - << _boxWidthInNumCells[2] << endl; + << _boxWidthInNumCells[2] << std::endl; Simulation::exit(5); } @@ -133,7 +131,7 @@ void LinkedCells::readXML(XMLfileUnits& xmlconfig) { } bool LinkedCells::rebuild(double bBoxMin[3], double bBoxMax[3]) { - global_log->info() << "REBUILD OF LinkedCells" << endl; + global_log->info() << "REBUILD OF LinkedCells" << std::endl; for (int i = 0; i < 3; i++) { this->_boundingBoxMin[i] = bBoxMin[i]; @@ -147,7 +145,7 @@ bool LinkedCells::rebuild(double bBoxMin[3], double bBoxMax[3]) { int numberOfCells = 1; - global_log->info() << "Using " << _cellsInCutoff << " cells in cutoff." << endl; + global_log->info() << "Using " << _cellsInCutoff << " cells in cutoff." << std::endl; float rc = (_cutoffRadius / _cellsInCutoff); for (int dim = 0; dim < 3; dim++) { @@ -157,7 +155,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]) { - global_log->error_always_output() << "LinkedCells::rebuild: region too small" << endl; + global_log->error_always_output() << "LinkedCells::rebuild: region too small" << std::endl; Simulation::exit(1); } @@ -174,7 +172,7 @@ bool LinkedCells::rebuild(double bBoxMin[3], double bBoxMax[3]) { } global_log->info() << "Cells per dimension (incl. halo): " << _cellsPerDimension[0] << " x " - << _cellsPerDimension[1] << " x " << _cellsPerDimension[2] << endl; + << _cellsPerDimension[1] << " x " << _cellsPerDimension[2] << std::endl; _cells.resize(numberOfCells); @@ -301,9 +299,9 @@ void LinkedCells::update() { } void LinkedCells::update_via_copies() { - const vector::size_type numCells = _cells.size(); - vector forwardNeighbourOffsets; // now vector - vector backwardNeighbourOffsets; // now vector + const std::vector::size_type numCells = _cells.size(); + std::vector forwardNeighbourOffsets; // now vector + std::vector backwardNeighbourOffsets; // now vector calculateNeighbourIndices(forwardNeighbourOffsets, backwardNeighbourOffsets); // magic numbers: empirically determined to be somewhat efficient. @@ -315,14 +313,14 @@ void LinkedCells::update_via_copies() { #if defined(_OPENMP) #pragma omp for schedule(dynamic, chunk_size) #endif - for (vector::size_type cellIndex = 0; cellIndex < numCells; cellIndex++) { + for (std::vector::size_type cellIndex = 0; cellIndex < numCells; cellIndex++) { _cells[cellIndex].preUpdateLeavingMolecules(); } #if defined(_OPENMP) #pragma omp for schedule(dynamic, chunk_size) #endif - for (vector::size_type cellIndex = 0; cellIndex < numCells; cellIndex++) { + for (std::vector::size_type cellIndex = 0; cellIndex < numCells; cellIndex++) { ParticleCell& cell = _cells[cellIndex]; for (unsigned long j = 0; j < backwardNeighbourOffsets.size(); j++) { @@ -348,7 +346,7 @@ void LinkedCells::update_via_copies() { #if defined(_OPENMP) #pragma omp for schedule(dynamic, chunk_size) #endif - for (vector::size_type cellIndex = 0; cellIndex < _cells.size(); cellIndex++) { + for (std::vector::size_type cellIndex = 0; cellIndex < _cells.size(); cellIndex++) { _cells[cellIndex].postUpdateLeavingMolecules(); } } // end pragma omp parallel @@ -381,7 +379,7 @@ void LinkedCells::update_via_coloring() { const int num_pairs = cellPairOffsets.size(); for(int j = 0; j < num_pairs; ++j) { - pair current_pair = cellPairOffsets[j]; + std::pair current_pair = cellPairOffsets[j]; long int offset1 = current_pair.first; long int cellIndex1 = baseIndex + offset1; @@ -454,9 +452,9 @@ bool LinkedCells::addParticle(Molecule& particle, bool inBoxCheckedAlready, bool return wasInserted; } -void LinkedCells::addParticles(vector& particles, bool checkWhetherDuplicate) { - typedef vector::size_type mol_index_t; - typedef vector::size_type cell_index_t; +void LinkedCells::addParticles(std::vector& particles, bool checkWhetherDuplicate) { + typedef std::vector::size_type mol_index_t; + typedef std::vector::size_type cell_index_t; #ifndef NDEBUG int oldNumberOfParticles = getNumberOfParticles(); @@ -464,13 +462,13 @@ void LinkedCells::addParticles(vector& particles, bool checkWhetherDup const mol_index_t N = particles.size(); - map> newPartsPerCell; + std::map> newPartsPerCell; #if defined(_OPENMP) #pragma omp parallel #endif { - map> local_newPartsPerCell; + std::map> local_newPartsPerCell; #if defined(_OPENMP) #pragma omp for schedule(static) @@ -480,7 +478,7 @@ void LinkedCells::addParticles(vector& particles, bool checkWhetherDup #ifndef NDEBUG if(!particle.inBox(_haloBoundingBoxMin, _haloBoundingBoxMax)){ - global_log->error()<<"At particle with ID "<< particle.getID()<<" assertion failed..."<error()<<"At particle with ID "<< particle.getID()<<" assertion failed..."<& particles, bool checkWhetherDup { for (auto it = local_newPartsPerCell.begin(); it != local_newPartsPerCell.end(); ++it) { cell_index_t cellIndex = it->first; - vector & global_vector = newPartsPerCell[cellIndex]; - vector & local_vector = it->second; + std::vector & global_vector = newPartsPerCell[cellIndex]; + std::vector & local_vector = it->second; global_vector.insert(global_vector.end(), local_vector.begin(), local_vector.end()); } } @@ -519,7 +517,7 @@ void LinkedCells::addParticles(vector& particles, bool checkWhetherDup for(auto it = thread_begin; it != thread_end; ++it) { cell_index_t cellIndex = it->first; - const vector & global_vector = it->second; + const std::vector & global_vector = it->second; const size_t numMolsInCell = global_vector.size(); _cells[cellIndex].increaseMoleculeStorage(numMolsInCell); @@ -535,16 +533,16 @@ void LinkedCells::addParticles(vector& particles, bool checkWhetherDup #ifndef NDEBUG int numberOfAddedParticles = getNumberOfParticles() - oldNumberOfParticles; - global_log->debug()<<"In LinkedCells::addParticles :"<debug()<<"\t#Particles to be added = "<debug()<<"\t#Particles actually added = "<debug()<<"In LinkedCells::addParticles :"<debug()<<"\t#Particles to be added = "<debug()<<"\t#Particles actually added = "<error() << "Cell structure in LinkedCells (traverseNonInnermostCells) invalid, call update first" << endl; + global_log->error() << "Cell structure in LinkedCells (traverseNonInnermostCells) invalid, call update first" << std::endl; Simulation::exit(1); } @@ -553,7 +551,7 @@ void LinkedCells::traverseNonInnermostCells(CellProcessor& cellProcessor) { void LinkedCells::traversePartialInnermostCells(CellProcessor& cellProcessor, unsigned int stage, int stageCount) { if (not _cellsValid) { - global_log->error() << "Cell structure in LinkedCells (traversePartialInnermostCells) invalid, call update first" << endl; + global_log->error() << "Cell structure in LinkedCells (traversePartialInnermostCells) invalid, call update first" << std::endl; Simulation::exit(1); } @@ -564,7 +562,7 @@ void LinkedCells::traverseCells(CellProcessor& cellProcessor) { if (not _cellsValid) { global_log->error() << "Cell structure in LinkedCells (traversePairs) invalid, call update first" - << endl; + << std::endl; Simulation::exit(1); } @@ -589,7 +587,7 @@ unsigned long LinkedCells::getNumberOfParticles(ParticleIterator::Type t /* = Pa } void LinkedCells::clear() { - vector::iterator cellIter; + std::vector::iterator cellIter; for (cellIter = _cells.begin(); cellIter != _cells.end(); cellIter++) { cellIter->deallocateAllParticles(); } @@ -613,7 +611,7 @@ void LinkedCells::deleteOuterParticles() { /*if (_cellsValid == false) { global_log->error() << "Cell structure in LinkedCells (deleteOuterParticles) invalid, call update first" - << endl; + << std::endl; Simulation::exit(1); }*/ @@ -720,7 +718,7 @@ void LinkedCells::initializeCells() { } void LinkedCells::calculateNeighbourIndices(std::vector& forwardNeighbourOffsets, std::vector& backwardNeighbourOffsets) const { - global_log->debug() << "Setting up cell neighbour indice lists." << endl; + global_log->debug() << "Setting up cell neighbour indice lists." << std::endl; // 13 neighbors for _haloWidthInNumCells = 1 or 64 for =2 int maxNNeighbours = ( (2*_haloWidthInNumCells[0]+1) * (2*_haloWidthInNumCells[1]+1) * (2*_haloWidthInNumCells[2]+1) - 1) / 2; @@ -796,33 +794,33 @@ std::array, 14> LinkedCells::calculateCe // minimize number of cells simultaneously in memory: std::array, 14> cellPairOffsets; - cellPairOffsets[ 0] = make_pair(o, xyz); + cellPairOffsets[ 0] = std::make_pair(o, xyz); // evict xyz - cellPairOffsets[ 1] = make_pair(o, yz ); - cellPairOffsets[ 2] = make_pair(x, yz ); + cellPairOffsets[ 1] = std::make_pair(o, yz ); + cellPairOffsets[ 2] = std::make_pair(x, yz ); // evict yz - cellPairOffsets[ 3] = make_pair(o, x ); + cellPairOffsets[ 3] = std::make_pair(o, x ); - cellPairOffsets[ 4] = make_pair(o, xy ); - cellPairOffsets[ 5] = make_pair(xy, z ); + cellPairOffsets[ 4] = std::make_pair(o, xy ); + cellPairOffsets[ 5] = std::make_pair(xy, z ); // evict xy - cellPairOffsets[ 6] = make_pair(o, z ); - cellPairOffsets[ 7] = make_pair(x, z ); - cellPairOffsets[ 8] = make_pair(y, z ); + cellPairOffsets[ 6] = std::make_pair(o, z ); + cellPairOffsets[ 7] = std::make_pair(x, z ); + cellPairOffsets[ 8] = std::make_pair(y, z ); // evict z - cellPairOffsets[ 9] = make_pair(o, y ); - cellPairOffsets[10] = make_pair(x, y ); + cellPairOffsets[ 9] = std::make_pair(o, y ); + cellPairOffsets[10] = std::make_pair(x, y ); // evict x - cellPairOffsets[11] = make_pair(o, xz ); - cellPairOffsets[12] = make_pair(y, xz ); + cellPairOffsets[11] = std::make_pair(o, xz ); + cellPairOffsets[12] = std::make_pair(y, xz ); // evict xz - cellPairOffsets[13] = make_pair(o, o ); + cellPairOffsets[13] = std::make_pair(o, o ); return cellPairOffsets; } @@ -835,16 +833,16 @@ unsigned long int LinkedCells::getCellIndexOfMolecule(Molecule* molecule) const for (int dim = 0; dim < 3; dim++) { #ifndef NDEBUG if (molecule->r(dim) < _haloBoundingBoxMin[dim] || molecule->r(dim) >= _haloBoundingBoxMax[dim]) { - global_log->error() << "Molecule is outside of bounding box" << endl; - global_log->error() << "Molecule:\n" << *molecule << endl; - global_log->error() << "_haloBoundingBoxMin = (" << _haloBoundingBoxMin[0] << ", " << _haloBoundingBoxMin[1] << ", " << _haloBoundingBoxMin[2] << ")" << endl; - global_log->error() << "_haloBoundingBoxMax = (" << _haloBoundingBoxMax[0] << ", " << _haloBoundingBoxMax[1] << ", " << _haloBoundingBoxMax[2] << ")" << endl; + global_log->error() << "Molecule is outside of bounding box" << std::endl; + global_log->error() << "Molecule:\n" << *molecule << std::endl; + global_log->error() << "_haloBoundingBoxMin = (" << _haloBoundingBoxMin[0] << ", " << _haloBoundingBoxMin[1] << ", " << _haloBoundingBoxMin[2] << ")" << std::endl; + global_log->error() << "_haloBoundingBoxMax = (" << _haloBoundingBoxMax[0] << ", " << _haloBoundingBoxMax[1] << ", " << _haloBoundingBoxMax[2] << ")" << std::endl; Simulation::exit(1); } #endif //this version is sensitive to roundoffs, if we have molecules (initialized) precisely at position 0.0: //cellIndex[dim] = (int) floor((molecule->r(dim) - _haloBoundingBoxMin[dim]) / _cellLength[dim]); - cellIndex[dim] = min(max(((int) floor((molecule->r(dim) - _boundingBoxMin[dim]) / _cellLength[dim])) + _haloWidthInNumCells[dim],0),_cellsPerDimension[dim]-1); + cellIndex[dim] = std::min(std::max(((int) floor((molecule->r(dim) - _boundingBoxMin[dim]) / _cellLength[dim])) + _haloWidthInNumCells[dim],0),_cellsPerDimension[dim]-1); } int cellIndex1d = this->cellIndexOf3DIndex(cellIndex[0], cellIndex[1], cellIndex[2]); @@ -884,17 +882,17 @@ unsigned long int LinkedCells::getCellIndexOfPoint(const double point[3]) const #ifndef NDEBUG //this should never ever happen! if (localPoint[dim] < _haloBoundingBoxMin[dim] || localPoint[dim] >= _haloBoundingBoxMax[dim]) { - global_log->error() << "Point is outside of halo bounding box" << endl; - global_log->error() << "Point p = (" << localPoint[0] << ", " << localPoint[1] << ", " << localPoint[2] << ")" << endl; - global_log->error() << "_haloBoundingBoxMin = (" << _haloBoundingBoxMin[0] << ", " << _haloBoundingBoxMin[1] << ", " << _haloBoundingBoxMin[2] << ")" << endl; - global_log->error() << "_haloBoundingBoxMax = (" << _haloBoundingBoxMax[0] << ", " << _haloBoundingBoxMax[1] << ", " << _haloBoundingBoxMax[2] << ")" << endl; + global_log->error() << "Point is outside of halo bounding box" << std::endl; + global_log->error() << "Point p = (" << localPoint[0] << ", " << localPoint[1] << ", " << localPoint[2] << ")" << std::endl; + global_log->error() << "_haloBoundingBoxMin = (" << _haloBoundingBoxMin[0] << ", " << _haloBoundingBoxMin[1] << ", " << _haloBoundingBoxMin[2] << ")" << std::endl; + global_log->error() << "_haloBoundingBoxMax = (" << _haloBoundingBoxMax[0] << ", " << _haloBoundingBoxMax[1] << ", " << _haloBoundingBoxMax[2] << ")" << std::endl; Simulation::exit(1); } #endif //this version is sensitive to roundoffs, if we have molecules (initialized) precisely at position 0.0: //cellIndex[dim] = (int) floor(point[dim] - _haloBoundingBoxMin[dim]) * _cellLengthReciprocal[dim]); - cellIndex[dim] = min(max(((int) floor((localPoint[dim] - _boundingBoxMin[dim]) * _cellLengthReciprocal[dim])) + _haloWidthInNumCells[dim],0),_cellsPerDimension[dim]-1); + cellIndex[dim] = std::min(std::max(((int) floor((localPoint[dim] - _boundingBoxMin[dim]) * _cellLengthReciprocal[dim])) + _haloWidthInNumCells[dim],0),_cellsPerDimension[dim]-1); } int cellIndex1d = this->cellIndexOf3DIndex(cellIndex[0], cellIndex[1], cellIndex[2]); @@ -1010,7 +1008,7 @@ void LinkedCells::deleteMolecule(ParticleIterator &moleculeIter, const bool& reb if (cellid >= _cells.size()) { global_log->error_always_output() << "coordinates for atom deletion lie outside bounding box." - << endl; + << std::endl; Simulation::exit(1); } _cells[cellid].buildSoACaches(); @@ -1041,8 +1039,8 @@ double LinkedCells::getEnergy(ParticlePairsHandler* particlePairsHandler, Molecu u += cellProcessor->processSingleMolecule(&molWithSoA, currentCell); - vector forwardNeighbourOffsets; // now vector - vector backwardNeighbourOffsets; // now vector + std::vector forwardNeighbourOffsets; // now vector + std::vector backwardNeighbourOffsets; // now vector calculateNeighbourIndices(forwardNeighbourOffsets, backwardNeighbourOffsets); // forward neighbours @@ -1182,8 +1180,8 @@ std::vector LinkedCells::getParticleCellStatistics() { return statistics; } -string LinkedCells::getConfigurationAsString() { - stringstream ss; +std::string LinkedCells::getConfigurationAsString() { + std::stringstream ss; // TODO: propper string representation for ls1 traversal choices ss << "{Container: ls1_linkedCells , Traversal: " << _traversalTuner->getSelectedTraversal() << "}"; return ss.str(); diff --git a/src/particleContainer/ParticleCellBase.cpp b/src/particleContainer/ParticleCellBase.cpp index 6f37eac159..3cd67b55ca 100644 --- a/src/particleContainer/ParticleCellBase.cpp +++ b/src/particleContainer/ParticleCellBase.cpp @@ -70,7 +70,7 @@ bool PositionIsInBox3D(const T l[3], const T u[3], const T r[3]) { return in; } -unsigned long ParticleCellBase::initCubicGrid(const array &numMoleculesPerDimension, +unsigned long ParticleCellBase::initCubicGrid(const std::array &numMoleculesPerDimension, const std::array &simBoxLength, Random &RNG) { std::array spacing{}; diff --git a/src/particleContainer/ParticleContainer.cpp b/src/particleContainer/ParticleContainer.cpp index 8ff1f47e21..47e8ac5ad2 100644 --- a/src/particleContainer/ParticleContainer.cpp +++ b/src/particleContainer/ParticleContainer.cpp @@ -3,8 +3,6 @@ #include "molecules/Molecule.h" #include "utils/Logger.h" -using namespace std; -using Log::global_log; ParticleContainer::ParticleContainer(double bBoxMin[3], double bBoxMax[3]) { for (int i = 0; i < 3; i++) { @@ -14,7 +12,7 @@ ParticleContainer::ParticleContainer(double bBoxMin[3], double bBoxMax[3]) { } bool ParticleContainer::rebuild(double bBoxMin[3], double bBoxMax[3]) { - global_log->info() << "REBUILD OF PARTICLE CONTAINER" << endl; + global_log->info() << "REBUILD OF PARTICLE CONTAINER" << std::endl; for (int i = 0; i < 3; i++) { _boundingBoxMin[i] = bBoxMin[i]; _boundingBoxMax[i] = bBoxMax[i]; diff --git a/src/particleContainer/TraversalTuner.h b/src/particleContainer/TraversalTuner.h index 1bd65296a6..af59166ec1 100644 --- a/src/particleContainer/TraversalTuner.h +++ b/src/particleContainer/TraversalTuner.h @@ -17,7 +17,6 @@ #include "LinkedCellTraversals/NeutralTerritoryTraversal.h" #include "LinkedCellTraversals/SlicedCellPairTraversal.h" -using Log::global_log; template class TraversalTuner { @@ -103,20 +102,20 @@ TraversalTuner::TraversalTuner() : _cells(nullptr), _dims(), _opti auto *c08esData = new C08CellPairTraversalData; _traversals = { - make_pair(nullptr, origData), - make_pair(nullptr, c08Data), - make_pair(nullptr, c04Data), - make_pair(nullptr, slicedData), - make_pair(nullptr, hsData), - make_pair(nullptr, mpData), - make_pair(nullptr, ntData), - make_pair(nullptr, c08esData) + std::make_pair(nullptr, origData), + std::make_pair(nullptr, c08Data), + std::make_pair(nullptr, c04Data), + std::make_pair(nullptr, slicedData), + std::make_pair(nullptr, hsData), + std::make_pair(nullptr, mpData), + std::make_pair(nullptr, ntData), + std::make_pair(nullptr, c08esData) }; #ifdef QUICKSCHED struct QuickschedTraversalData *quiData = new QuickschedTraversalData; quiData->taskBlockSize = {{2, 2, 2}}; if (is_base_of::value) { - _traversals.push_back(make_pair(nullptr, quiData)); + _traversals.push_back(std::make_pair(nullptr, quiData)); } #endif } @@ -139,29 +138,29 @@ void TraversalTuner::findOptimalTraversal() { // log traversal if (dynamic_cast *>(_optimalTraversal)) - global_log->info() << "Using HalfShellTraversal." << endl; + global_log->info() << "Using HalfShellTraversal." << std::endl; else if (dynamic_cast *>(_optimalTraversal)) - global_log->info() << "Using OriginalCellPairTraversal." << endl; + global_log->info() << "Using OriginalCellPairTraversal." << std::endl; else if (dynamic_cast *>(_optimalTraversal)) - global_log->info() << "Using C08CellPairTraversal without eighthShell." << endl; + global_log->info() << "Using C08CellPairTraversal without eighthShell." << std::endl; else if (dynamic_cast *>(_optimalTraversal)) - global_log->info() << "Using C08CellPairTraversal with eighthShell." << endl; + global_log->info() << "Using C08CellPairTraversal with eighthShell." << std::endl; else if (dynamic_cast *>(_optimalTraversal)) - global_log->info() << "Using C04CellPairTraversal." << endl; + global_log->info() << "Using C04CellPairTraversal." << std::endl; else if (dynamic_cast *>(_optimalTraversal)) - global_log->info() << "Using MidpointTraversal." << endl; + global_log->info() << "Using MidpointTraversal." << std::endl; else if (dynamic_cast *>(_optimalTraversal)) - global_log->info() << "Using NeutralTerritoryTraversal." << endl; + global_log->info() << "Using NeutralTerritoryTraversal." << std::endl; else if (dynamic_cast *>(_optimalTraversal)) { - global_log->info() << "Using QuickschedTraversal." << endl; + global_log->info() << "Using QuickschedTraversal." << std::endl; #ifndef QUICKSCHED - global_log->error() << "MarDyn was compiled without Quicksched Support. Aborting!" << endl; + global_log->error() << "MarDyn was compiled without Quicksched Support. Aborting!" << std::endl; Simulation::exit(1); #endif } else if (dynamic_cast *>(_optimalTraversal)) - global_log->info() << "Using SlicedCellPairTraversal." << endl; + global_log->info() << "Using SlicedCellPairTraversal." << std::endl; else - global_log->warning() << "Using unknown traversal." << endl; + global_log->warning() << "Using unknown traversal." << std::endl; if (_cellsInCutoff > _optimalTraversal->maxCellsInCutoff()) { global_log->error() << "Traversal supports up to " << _optimalTraversal->maxCellsInCutoff() @@ -172,37 +171,37 @@ void TraversalTuner::findOptimalTraversal() { template void TraversalTuner::readXML(XMLfileUnits &xmlconfig) { - string oldPath(xmlconfig.getcurrentnodepath()); + std::string oldPath(xmlconfig.getcurrentnodepath()); // read traversal type default values - string traversalType; + std::string traversalType; xmlconfig.getNodeValue("traversalSelector", traversalType); transform(traversalType.begin(), traversalType.end(), traversalType.begin(), ::tolower); - if (traversalType.find("c08es") != string::npos) + if (traversalType.find("c08es") != std::string::npos) selectedTraversal = C08ES; - else if (traversalType.find("c08") != string::npos) + else if (traversalType.find("c08") != std::string::npos) selectedTraversal = C08; - else if (traversalType.find("c04") != string::npos) + else if (traversalType.find("c04") != std::string::npos) selectedTraversal = C04; - else if (traversalType.find("qui") != string::npos) + else if (traversalType.find("qui") != std::string::npos) selectedTraversal = QSCHED; - else if (traversalType.find("slice") != string::npos) + else if (traversalType.find("slice") != std::string::npos) selectedTraversal = SLICED; - else if (traversalType.find("ori") != string::npos) + else if (traversalType.find("ori") != std::string::npos) selectedTraversal = ORIGINAL; - else if (traversalType.find("hs") != string::npos) + else if (traversalType.find("hs") != std::string::npos) selectedTraversal = HS; - else if (traversalType.find("mp") != string::npos) + else if (traversalType.find("mp") != std::string::npos) selectedTraversal = MP; - else if (traversalType.find("nt") != string::npos) { + else if (traversalType.find("nt") != std::string::npos) { selectedTraversal = NT; } else { // selector already set in constructor, just print a warning here if (mardyn_get_max_threads() > 1) { - global_log->warning() << "No traversal type selected. Defaulting to c08 traversal." << endl; + global_log->warning() << "No traversal type selected. Defaulting to c08 traversal." << std::endl; } else { - global_log->warning() << "No traversal type selected. Defaulting to sliced traversal." << endl; + global_log->warning() << "No traversal type selected. Defaulting to sliced traversal." << std::endl; } } @@ -213,28 +212,28 @@ void TraversalTuner::readXML(XMLfileUnits &xmlconfig) { // xmlconfig.changecurrentnode(traversalIterator); // does not work resolve paths to traversals manually // use iterator only to resolve number of traversals (==iterations) - string basePath(xmlconfig.getcurrentnodepath()); + std::string basePath(xmlconfig.getcurrentnodepath()); int i = 1; XMLfile::Query qry = xmlconfig.query("traversalData"); for (XMLfile::Query::const_iterator traversalIterator = qry.begin(); traversalIterator; ++traversalIterator) { - string path(basePath + "/traversalData[" + to_string(i) + "]"); + std::string path(basePath + "/traversalData[" + std::to_string(i) + "]"); xmlconfig.changecurrentnode(path); traversalType = xmlconfig.getNodeValue_string("@type", "NOTHING FOUND"); transform(traversalType.begin(), traversalType.end(), traversalType.begin(), ::tolower); if (traversalType == "c08") { // nothing to do - } else if (traversalType.find("qui") != string::npos) { + } else if (traversalType.find("qui") != std::string::npos) { #ifdef QUICKSCHED if (not is_base_of::value) { global_log->warning() << "Attempting to use Quicksched with cell type that does not store task data!" - << endl; + << std::endl; } for (auto p : _traversals) { if (struct QuickschedTraversalData *quiData = dynamic_cast(p.second)) { // read task block size - string tag = "taskBlockSize/l"; + std::string tag = "taskBlockSize/l"; char dimension = 'x'; for (int j = 0; j < 3; ++j) { @@ -245,7 +244,7 @@ void TraversalTuner::readXML(XMLfileUnits &xmlconfig) { << (char) (dimension + j) << " direction is <2 and thereby invalid! (" << quiData->taskBlockSize[j] << ")" - << endl; + << std::endl; Simulation::exit(1); } } @@ -255,10 +254,10 @@ void TraversalTuner::readXML(XMLfileUnits &xmlconfig) { #else global_log->warning() << "Found quicksched traversal data in config " << "but mardyn was compiled without quicksched support! " - << "(make ENABLE_QUICKSCHED=1)" << endl; + << "(make ENABLE_QUICKSCHED=1)" << std::endl; #endif } else { - global_log->warning() << "Unknown traversal type: " << traversalType << endl; + global_log->warning() << "Unknown traversal type: " << traversalType << std::endl; } ++i; } @@ -307,7 +306,7 @@ void TraversalTuner::rebuild(std::vector &cells, con traversalPointerReference = new QuickschedTraversal(cells, dims, quiData->taskBlockSize); } break; default: - global_log->error() << "Unknown traversal data found in TraversalTuner._traversals!" << endl; + global_log->error() << "Unknown traversal data found in TraversalTuner._traversals!" << std::endl; Simulation::exit(1); } } diff --git a/src/particleContainer/adapter/FlopCounter.cpp b/src/particleContainer/adapter/FlopCounter.cpp index f00f4e2da7..fb2ff5ca23 100644 --- a/src/particleContainer/adapter/FlopCounter.cpp +++ b/src/particleContainer/adapter/FlopCounter.cpp @@ -110,9 +110,8 @@ void FlopCounter::_Counts::allReduce() { void FlopCounter::_Counts::print() const { using std::endl; - using Log::global_log; - - global_log->info() << " Molecule distances: " << _moleculeDistances << endl; + + global_log->info() << " Molecule distances: " << _moleculeDistances << std::endl; for (int i = 0; i < NUM_POTENTIALS; ++i) { std::string str = _potCounts[i].printNameKernelAndMacroCalls(); @@ -451,9 +450,9 @@ void FlopCounter::_calculatePairs(const CellDataSoARMM & soa1, const CellDataSoA } void FlopCounter::printStats() const { - global_log->info() << "FlopCounter stats: " << endl; + global_log->info() << "FlopCounter stats: " << std::endl; _currentCounts.print(); global_log->info() << "\tfraction of Flops for molecule dist: " - << getTotalMoleculeDistanceFlopCount() / getTotalFlopCount() << endl; + << getTotalMoleculeDistanceFlopCount() / getTotalFlopCount() << std::endl; } diff --git a/src/particleContainer/adapter/LegacyCellProcessor.cpp b/src/particleContainer/adapter/LegacyCellProcessor.cpp index 56143e16ae..010afb3c3b 100644 --- a/src/particleContainer/adapter/LegacyCellProcessor.cpp +++ b/src/particleContainer/adapter/LegacyCellProcessor.cpp @@ -12,8 +12,6 @@ #include "utils/Logger.h" #include -using namespace std; -using namespace Log; LegacyCellProcessor::LegacyCellProcessor(const double cutoffRadius, const double LJCutoffRadius, ParticlePairsHandler* particlePairsHandler) diff --git a/src/particleContainer/adapter/ParticlePairs2LoadCalcAdapter.h b/src/particleContainer/adapter/ParticlePairs2LoadCalcAdapter.h index 35a1f88078..ae925103fb 100644 --- a/src/particleContainer/adapter/ParticlePairs2LoadCalcAdapter.h +++ b/src/particleContainer/adapter/ParticlePairs2LoadCalcAdapter.h @@ -46,7 +46,7 @@ class ParticlePairs2LoadCalcAdapter : public ParticlePairsHandler { MPI_CHECK( MPI_Allreduce(_globalLoadPerCell, temp, _globalNumCells, MPI_FLOAT, MPI_SUM, MPI_COMM_WORLD) ); delete[] _globalLoadPerCell; _globalLoadPerCell = temp; - //cout << "LocalLoad: " << _localLoad << endl; + //cout << "LocalLoad: " << _localLoad << std::endl; } //! @brief calculate force between pairs and collect macroscopic contribution diff --git a/src/particleContainer/adapter/RDFCellProcessor.cpp b/src/particleContainer/adapter/RDFCellProcessor.cpp index 30be777bf9..89946f172f 100644 --- a/src/particleContainer/adapter/RDFCellProcessor.cpp +++ b/src/particleContainer/adapter/RDFCellProcessor.cpp @@ -12,8 +12,6 @@ #include "utils/Logger.h" #include -using namespace std; -using namespace Log; void RDFCellProcessor::processCell(ParticleCell& cell) { if (cell.isInnerCell() || cell.isBoundaryCell()) { diff --git a/src/particleContainer/adapter/VCP1CLJRMM.cpp b/src/particleContainer/adapter/VCP1CLJRMM.cpp index bee488878f..f5b8f036f3 100644 --- a/src/particleContainer/adapter/VCP1CLJRMM.cpp +++ b/src/particleContainer/adapter/VCP1CLJRMM.cpp @@ -42,7 +42,7 @@ VCP1CLJRMM::VCP1CLJRMM(Domain& domain, double cutoffRadius, double LJcutoffRadiu double dt = global_simulation->getIntegrator()->getTimestepLength(); _dtInvm = dt / componentZero.m(); } else { - global_log->info() << "VCP1CLJRMM: initialize dtInv2m via setter method necessary." << endl; + global_log->info() << "VCP1CLJRMM: initialize dtInv2m via setter method necessary." << std::endl; } // initialize thread data diff --git a/src/particleContainer/adapter/VectorizedCellProcessor.cpp b/src/particleContainer/adapter/VectorizedCellProcessor.cpp index 04ff55c092..03069b74bc 100644 --- a/src/particleContainer/adapter/VectorizedCellProcessor.cpp +++ b/src/particleContainer/adapter/VectorizedCellProcessor.cpp @@ -15,8 +15,6 @@ #include #include "vectorization/MaskGatherChooser.h" -using namespace Log; -using namespace std; VectorizedCellProcessor::VectorizedCellProcessor(Domain & domain, double cutoffRadius, double LJcutoffRadius) : CellProcessor(cutoffRadius, LJcutoffRadius), _domain(domain), diff --git a/src/particleContainer/adapter/tests/VectorizedCellProcessorTest.cpp b/src/particleContainer/adapter/tests/VectorizedCellProcessorTest.cpp index 1befe11969..bb809c6a9b 100644 --- a/src/particleContainer/adapter/tests/VectorizedCellProcessorTest.cpp +++ b/src/particleContainer/adapter/tests/VectorizedCellProcessorTest.cpp @@ -322,15 +322,15 @@ void VectorizedCellProcessorTest::testElectrostaticVectorization(const char* fil } if(printStats) { - test_log->info() << endl; - test_log->info() << "max_abs_F: " << max_abs_F << endl; - test_log->info() << "max_abs_M: " << max_abs_M << endl; - test_log->info() << "max_abs_Vi: " << max_abs_Vi << endl; - test_log->info() << "mean_abs_F: " << mean_abs_F / counter << endl; - test_log->info() << "mean_abs_M: " << mean_abs_M / counter << endl; - test_log->info() << "mean_abs_Vi: " << mean_abs_Vi / counter << endl; - test_log->info() << "upot: " << std::abs(legacy_u_pot - vectorized_u_pot) << endl; - test_log->info() << "viri: " << std::abs(legacy_virial - vectorized_virial) << endl; + test_log->info() << std::endl; + test_log->info() << "max_abs_F: " << max_abs_F << std::endl; + test_log->info() << "max_abs_M: " << max_abs_M << std::endl; + test_log->info() << "max_abs_Vi: " << max_abs_Vi << std::endl; + test_log->info() << "mean_abs_F: " << mean_abs_F / counter << std::endl; + test_log->info() << "mean_abs_M: " << mean_abs_M / counter << std::endl; + test_log->info() << "mean_abs_Vi: " << mean_abs_Vi / counter << std::endl; + test_log->info() << "upot: " << std::abs(legacy_u_pot - vectorized_u_pot) << std::endl; + test_log->info() << "viri: " << std::abs(legacy_virial - vectorized_virial) << std::endl; } // Assert that macroscopic quantities are the same diff --git a/src/particleContainer/tests/ParticleContainerFactory.cpp b/src/particleContainer/tests/ParticleContainerFactory.cpp index 46f9cc9116..60ee46b701 100644 --- a/src/particleContainer/tests/ParticleContainerFactory.cpp +++ b/src/particleContainer/tests/ParticleContainerFactory.cpp @@ -26,7 +26,6 @@ #include #include -using namespace Log; ParticleContainer* ParticleContainerFactory::createEmptyParticleContainer(Type type) { if (type == LinkedCell) { diff --git a/src/plugins/DirectedPM.cpp b/src/plugins/DirectedPM.cpp index 4d76d0e047..643269514b 100644 --- a/src/plugins/DirectedPM.cpp +++ b/src/plugins/DirectedPM.cpp @@ -375,12 +375,12 @@ void DirectedPM::beforeForces(ParticleContainer* particleContainer, DomainDecomp << _xyzEkinDroplet[_outputFrequency] / (3 * particleDropletTrue) << " \t\t " << TxzGAS << " \t\t " << TxzDROPLET << " \t\t " << _xzEkinGas[_outputFrequency] / (2 * particleDropletFalse) << " \t\t " - << _xzEkinDroplet[_outputFrequency] / (2 * particleDropletTrue) << endl; + << _xzEkinDroplet[_outputFrequency] / (2 * particleDropletTrue) << std::endl; } _DPMGlobalStream.close(); // 2D DENSITY OUTPUT - DPMStreamDensity.open("drop_MK_DirectedPM_" + to_string(simstep) + ".NDpr", std::ios::out); + DPMStreamDensity.open("drop_MK_DirectedPM_" + std::to_string(simstep) + ".NDpr", std::ios::out); DPMStreamDensity.precision(6); // Write Header DPMStreamDensity << "//Segment volume: " << _volumebox @@ -413,7 +413,7 @@ void DirectedPM::beforeForces(ParticleContainer* particleContainer, DomainDecomp DPMStreamDensity.close(); // 2D Temperature OUTPUT - DPMStreamTemperature.open("drop_MK_DirectedPM_" + to_string(simstep) + ".Temppr", std::ios::out); + DPMStreamTemperature.open("drop_MK_DirectedPM_" + std::to_string(simstep) + ".Temppr", std::ios::out); DPMStreamTemperature.precision(6); // Write Header DPMStreamTemperature << "//Segment volume: " << _volumebox @@ -438,7 +438,7 @@ void DirectedPM::beforeForces(ParticleContainer* particleContainer, DomainDecomp for (unsigned phiID = 0; phiID < _phiIncrements; phiID++) { for (unsigned r = 0; r < _rIncrements; r++) { auto ID = (long)(h * _rIncrements * _phiIncrements + r * _phiIncrements + phiID); - if (isnan(_temperatureBox[ID])) { + if (std::isnan(_temperatureBox[ID])) { _temperatureBox[ID] = 0.; } DPMStreamTemperature << _temperatureBox[ID] << "\t"; @@ -449,7 +449,7 @@ void DirectedPM::beforeForces(ParticleContainer* particleContainer, DomainDecomp DPMStreamTemperature.close(); // 2D TemperatureXZ OUTPUT - DPMStreamTemperatureXZ.open("drop_MK_DirectedPM_" + to_string(simstep) + ".TempprXZ", std::ios::out); + DPMStreamTemperatureXZ.open("drop_MK_DirectedPM_" + std::to_string(simstep) + ".TempprXZ", std::ios::out); DPMStreamTemperatureXZ.precision(6); // Write Header DPMStreamTemperatureXZ << "//Segment volume: " << _volumebox @@ -475,7 +475,7 @@ void DirectedPM::beforeForces(ParticleContainer* particleContainer, DomainDecomp for (unsigned phiID = 0; phiID < _phiIncrements; phiID++) { for (unsigned r = 0; r < _rIncrements; r++) { auto ID = (long)(h * _rIncrements * _phiIncrements + r * _phiIncrements + phiID); - if (isnan(_temperatureBoxXZ[ID])) { + if (std::isnan(_temperatureBoxXZ[ID])) { _temperatureBoxXZ[ID] = 0.; } DPMStreamTemperatureXZ << _temperatureBoxXZ[ID] << "\t"; @@ -486,7 +486,7 @@ void DirectedPM::beforeForces(ParticleContainer* particleContainer, DomainDecomp DPMStreamTemperatureXZ.close(); // 2D Ekin OUTPUT - DPMStreamEkin.open("drop_MK_DirectedPM_" + to_string(simstep) + ".Ekin", std::ios::out); + DPMStreamEkin.open("drop_MK_DirectedPM_" + std::to_string(simstep) + ".Ekin", std::ios::out); DPMStreamEkin.precision(6); // Write Header DPMStreamEkin << "//Segment volume: " << _volumebox << "\n//Accumulated data sets: " << _outputFrequency @@ -516,7 +516,7 @@ void DirectedPM::beforeForces(ParticleContainer* particleContainer, DomainDecomp DPMStreamEkin.close(); // 2D VIRIAL OUTPUT - DPMStreamVirial.open("drop_MK_DirectedPM_" + to_string(simstep) + ".Vipr", std::ios::out); + DPMStreamVirial.open("drop_MK_DirectedPM_" + std::to_string(simstep) + ".Vipr", std::ios::out); DPMStreamVirial.precision(6); // Write Header DPMStreamVirial << "//Segment volume: " << _volumebox @@ -538,7 +538,7 @@ void DirectedPM::beforeForces(ParticleContainer* particleContainer, DomainDecomp for (unsigned phiID = 0; phiID < _phiIncrements; phiID++) { for (unsigned r = 0; r < _rIncrements; r++) { auto ID = (long)(h * _rIncrements * _phiIncrements + r * _phiIncrements + phiID); - if (isnan(_virialBox[ID])) { + if (std::isnan(_virialBox[ID])) { _virialBox[ID] = 0.; } DPMStreamVirial << _virialBox[ID] << "\t"; diff --git a/src/plugins/DirectedPM.h b/src/plugins/DirectedPM.h index e9a55c0e76..e98443a6bf 100644 --- a/src/plugins/DirectedPM.h +++ b/src/plugins/DirectedPM.h @@ -171,12 +171,12 @@ class DirectedPM : public PluginBase { _DPMGlobalStream.open("Global_output_DPM_MK.txt", std::ios::out); _DPMGlobalStream << "Ausgabe der globalen Gr��en gerichtete Geschwindigkeit, dichteGas, dichteLiq, druckGas, " "druckLiq, TGas, TLiq, EkinxyzGas, EkinxyzLiq, TGasXZ, TLiqXZ,EkinxzGas und EkinxzLiq," - << endl; - _DPMGlobalStream << endl; + << std::endl; + _DPMGlobalStream << std::endl; _DPMGlobalStream << "Timestept \t\t gerichtete Geschw. \t\t dichteGas \t\t dichteLiq \t\t druckGas \t\t " "druckLiq \t\t TGas \t\t TLiq \t\t EkinxyzGas \t\t EkinxyzLiq\t\t TGasXZ\t\t " "TLiqXZ\t\t EkinxzGas \t\t EkinxzLiq\t\t" - << endl; + << std::endl; _DPMGlobalStream.close(); } void readXML(XMLfileUnits& xmlconfig) override; diff --git a/src/plugins/ExamplePlugin.cpp b/src/plugins/ExamplePlugin.cpp index 51f8f6d5d1..2161d5416c 100644 --- a/src/plugins/ExamplePlugin.cpp +++ b/src/plugins/ExamplePlugin.cpp @@ -11,7 +11,6 @@ #include "utils/xmlfileUnits.h" #include "utils/Logger.h" -using Log::global_log; void ExamplePlugin::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 1; @@ -67,7 +66,7 @@ void ExamplePlugin::init(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain) { if (_displaySelector == WhereToDisplay::ALL or _displaySelector == WhereToDisplay::AT_INIT) { - global_log->info() << "ExamplePlugin::init " << _message << endl; + global_log->info() << "ExamplePlugin::init " << _message << std::endl; } } @@ -77,7 +76,7 @@ void ExamplePlugin::beforeEventNewTimestep(ParticleContainer* particleContainer, and (_displaySelector == WhereToDisplay::ALL or _displaySelector == WhereToDisplay::BEFORE_EVENT_NEW_TIMESTEP)) { - global_log->info() << "ExamplePlugin::beforeEventNewTimestep " << _message << endl; + global_log->info() << "ExamplePlugin::beforeEventNewTimestep " << _message << std::endl; } } @@ -86,7 +85,7 @@ void ExamplePlugin::beforeForces(ParticleContainer* particleContainer, if (simstep % _writeFrequency == 0 and (_displaySelector == WhereToDisplay::ALL or _displaySelector == WhereToDisplay::BEFORE_FORCES)) { - global_log->info() << "ExamplePlugin::beforeForces " << _message << endl; + global_log->info() << "ExamplePlugin::beforeForces " << _message << std::endl; } } @@ -95,7 +94,7 @@ void ExamplePlugin::afterForces(ParticleContainer* particleContainer, if (simstep % _writeFrequency == 0 and (_displaySelector == WhereToDisplay::ALL or _displaySelector == WhereToDisplay::AFTER_FORCES)) { - global_log->info() << "ExamplePlugin::afterForces " << _message << endl; + global_log->info() << "ExamplePlugin::afterForces " << _message << std::endl; } } @@ -104,7 +103,7 @@ void ExamplePlugin::endStep(ParticleContainer* particleContainer, if (simstep % _writeFrequency == 0 and (_displaySelector == WhereToDisplay::ALL or _displaySelector == WhereToDisplay::END_STEP)) { - global_log->info() << "ExamplePlugin::endStep " << _message << endl; + global_log->info() << "ExamplePlugin::endStep " << _message << std::endl; } } @@ -112,6 +111,6 @@ void ExamplePlugin::finish(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain) { if (_displaySelector == WhereToDisplay::ALL or _displaySelector == WhereToDisplay::AT_FINISH) { - global_log->info() << "ExamplePlugin::finish " << _message << endl; + global_log->info() << "ExamplePlugin::finish " << _message << std::endl; } } diff --git a/src/plugins/InMemoryCheckpointing.cpp b/src/plugins/InMemoryCheckpointing.cpp index a0a98e96d2..b3de8d86da 100644 --- a/src/plugins/InMemoryCheckpointing.cpp +++ b/src/plugins/InMemoryCheckpointing.cpp @@ -14,7 +14,6 @@ #include "Domain.h" #include "parallel/DomainDecompBase.h" -using Log::global_log; void InMemoryCheckpointing::readXML(XMLfileUnits& xmlconfig) { _writeFrequency = 5; diff --git a/src/plugins/MaxCheck.cpp b/src/plugins/MaxCheck.cpp index 721f4cce9b..556683fe71 100644 --- a/src/plugins/MaxCheck.cpp +++ b/src/plugins/MaxCheck.cpp @@ -13,8 +13,6 @@ #include "utils/Logger.h" #include -using namespace std; -using Log::global_log; MaxCheck::MaxCheck() { } @@ -38,7 +36,7 @@ void MaxCheck::readXML(XMLfileUnits& xmlconfig) { xmlconfig.getNodeValue("control/stop", _control.stop); global_log->info() << "[MaxCheck] Active period: start:freq:stop = " << _control.start << ":" << _control.freq << ":" << _control.stop - << endl; + << std::endl; // range Domain* domain = global_simulation->getDomain(); @@ -59,27 +57,27 @@ void MaxCheck::readXML(XMLfileUnits& xmlconfig) { // Warn if old config style is used as it has big influence on the simulation if (not xmlconfig.query("yrange").empty()) { - global_log->warning() << "[MaxCheck] is deprecated! Use and / instead." << endl; + global_log->warning() << "[MaxCheck] is deprecated! Use and / instead." << std::endl; } global_log->info() << "[MaxCheck] Apply " << ((_range.inclusive) ? "inside" : "outside") << " range:" << " x = " << _range.xmin << " - " << _range.xmax << " ;" << " y = " << _range.ymin << " - " << _range.ymax << " ;" - << " z = " << _range.zmin << " - " << _range.zmax << endl; + << " z = " << _range.zmin << " - " << _range.zmax << std::endl; // targets uint32_t numTargets = 0; XMLfile::Query query = xmlconfig.query("targets/target"); numTargets = query.card(); global_log->info() << "[MaxCheck] Number of component targets: " - << numTargets << endl; + << numTargets << std::endl; if (numTargets < 1) { global_log->warning() << "[MaxCheck] No target parameters specified. Program exit ..." - << endl; + << std::endl; Simulation::exit(-1); } - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); XMLfile::Query::const_iterator nodeIter; for (nodeIter = query.begin(); nodeIter; nodeIter++) { xmlconfig.changecurrentnode(nodeIter); @@ -96,26 +94,26 @@ void MaxCheck::readXML(XMLfileUnits& xmlconfig) { xmlconfig.getNodeValue("@method", mv.method); global_log->info() << "[MaxCheck] Method(cid=" << cid_ub << "): " - << mv.method << endl; + << mv.method << std::endl; xmlconfig.getNodeValue("Fmax", mv.F); global_log->info() << "[MaxCheck] Fmax(cid=" << cid_ub << "): " << mv.F - << endl; + << std::endl; mv.F2 = mv.F * mv.F; xmlconfig.getNodeValue("vmax", mv.v); global_log->info() << "[MaxCheck] vmax(cid=" << cid_ub << "): " << mv.v - << endl; + << std::endl; mv.v2 = mv.v * mv.v; xmlconfig.getNodeValue("Mmax", mv.M); global_log->info() << "[MaxCheck] Mmax(cid=" << cid_ub << "): " << mv.M - << endl; + << std::endl; mv.M2 = mv.M * mv.M; xmlconfig.getNodeValue("Lmax", mv.L); global_log->info() << "[MaxCheck] Lmax(cid=" << cid_ub << "): " << mv.L - << endl; + << std::endl; mv.L2 = mv.L * mv.L; _maxVals[cid_ub] = mv; diff --git a/src/plugins/Mirror.cpp b/src/plugins/Mirror.cpp index 1d4efbb261..e5c499fdf0 100644 --- a/src/plugins/Mirror.cpp +++ b/src/plugins/Mirror.cpp @@ -12,8 +12,6 @@ #include #include -using namespace std; -using Log::global_log; void printInsertionStatus(std::pair::iterator,bool> &status) { diff --git a/src/plugins/MirrorSystem.cpp b/src/plugins/MirrorSystem.cpp index 8f18ca5254..307ae774ad 100644 --- a/src/plugins/MirrorSystem.cpp +++ b/src/plugins/MirrorSystem.cpp @@ -10,8 +10,6 @@ #include #include -using namespace std; -using Log::global_log; MirrorSystem::MirrorSystem() { @@ -34,7 +32,7 @@ void MirrorSystem::beforeEventNewTimestep( if(_bDone) return; - global_log->info() << "HELLO beforeEventNewTimestep() ..." << endl; + global_log->info() << "HELLO beforeEventNewTimestep() ..." << std::endl; Domain* domain = global_simulation->getDomain(); @@ -59,15 +57,15 @@ void MirrorSystem::beforeEventNewTimestep( newPos.at(1) = oldPos.at(1) + width.at(1)*0.5; newPos.at(2) = oldPos.at(2) + width.at(2)*0.5; - cout << domainDecomp->getRank() << ": oldPos = " << oldPos.at(0) << "," << oldPos.at(1) << "," << oldPos.at(2); - cout << domainDecomp->getRank() << ": newPos = " << newPos.at(0) << "," << newPos.at(1) << "," << newPos.at(2) << endl; + std::cout << domainDecomp->getRank() << ": oldPos = " << oldPos.at(0) << "," << oldPos.at(1) << "," << oldPos.at(2); + std::cout << domainDecomp->getRank() << ": newPos = " << newPos.at(0) << "," << newPos.at(1) << "," << newPos.at(2) << std::endl; it->setr(0, newPos.at(0) ); it->setr(1, newPos.at(1) ); it->setr(2, newPos.at(2) ); } // particleContainer->update(); - global_log->info() << "System shifted." << endl; + global_log->info() << "System shifted." << std::endl; } else if(_type == MST_ENLARGE) { // add vapor @@ -193,13 +191,13 @@ void MirrorSystem::beforeEventNewTimestep( arr.at(1) = -1; arr.at(2) = -1; - global_log->info() << "Adding new particles ..." << endl; + global_log->info() << "Adding new particles ..." << std::endl; uint64_t numAdded = 0; double bbMin[3]; double bbMax[3]; domainDecomp->getBoundingBoxMinMax(domain, bbMin, bbMax); - cout << domainDecomp->getRank() << ": bbMin = " << bbMin[0] << "," << bbMin[1] << "," << bbMin[2] << endl; - cout << domainDecomp->getRank() << ": bbMax = " << bbMax[0] << "," << bbMax[1] << "," << bbMax[2] << endl; + std::cout << domainDecomp->getRank() << ": bbMin = " << bbMin[0] << "," << bbMin[1] << "," << bbMin[2] << std::endl; + std::cout << domainDecomp->getRank() << ": bbMax = " << bbMax[0] << "," << bbMax[1] << "," << bbMax[2] << std::endl; for(auto it = particleContainer->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); it.isValid(); ++it) { std::array oldPos; @@ -227,15 +225,15 @@ void MirrorSystem::beforeEventNewTimestep( mol.setr(1, newPos.at(1) ); mol.setr(2, newPos.at(2) ); - cout << domainDecomp->getRank() << ": newPos = " << newPos.at(0) << "," << newPos.at(1) << "," << newPos.at(2); - cout << domainDecomp->getRank() << ": oldPos = " << oldPos.at(0) << "," << oldPos.at(1) << "," << oldPos.at(2) << endl; + std::cout << domainDecomp->getRank() << ": newPos = " << newPos.at(0) << "," << newPos.at(1) << "," << newPos.at(2); + std::cout << domainDecomp->getRank() << ": oldPos = " << oldPos.at(0) << "," << oldPos.at(1) << "," << oldPos.at(2) << std::endl; particleContainer->addParticle(mol, true, false); numAdded++; } } } - cout << domainDecomp->getRank() << ": Added " << numAdded << " new particles." << endl; + std::cout << domainDecomp->getRank() << ": Added " << numAdded << " new particles." << std::endl; } else if(_type == MST_MIRROR) { @@ -257,7 +255,7 @@ void MirrorSystem::readXML(XMLfileUnits& xmlconfig) { // mirror position _yPos = 0.; xmlconfig.getNodeValue("yPos", _yPos); - global_log->info() << "MirrorSystem: y position = " << _yPos << endl; + global_log->info() << "MirrorSystem: y position = " << _yPos << std::endl; // old box size xmlconfig.getNodeValue("box/old/x", _box_old.at(0)); diff --git a/src/plugins/NEMD/DensityControl.cpp b/src/plugins/NEMD/DensityControl.cpp index 93a77d8c01..a270a795f6 100644 --- a/src/plugins/NEMD/DensityControl.cpp +++ b/src/plugins/NEMD/DensityControl.cpp @@ -112,7 +112,7 @@ void DensityControl::readXML(XMLfileUnits& xmlconfig) { global_log->error() << "[DensityControl] No target parameters specified. Program exit ..." << std::endl; Simulation::exit(-1); } - const string oldpath = xmlconfig.getcurrentnodepath(); + const std::string oldpath = xmlconfig.getcurrentnodepath(); XMLfile::Query::const_iterator nodeIter; for (nodeIter = query.begin(); nodeIter; nodeIter++) { xmlconfig.changecurrentnode(nodeIter); @@ -229,7 +229,7 @@ void DensityControl::controlDensity(ParticleContainer* particleContainer, Domain std::map > pidMap; for (int32_t i = 0; i < numComponents + 1; i++) { const std::vector vec; - pidMap.insert(std::pair >(i, vec)); + pidMap.insert(std::pair >(i, vec)); } for (auto it : vec_pacID.global) { pidMap[it.cid].push_back(it.pid); @@ -276,7 +276,7 @@ void DensityControl::controlDensity(ParticleContainer* particleContainer, Domain } if (cid_ub_send > 0 && cid_ub_recv > 0) { - const uint64_t numSwap = min(vecBalance[cid_ub_send], abs(vecBalance[cid_ub_recv])); + const uint64_t numSwap = std::min(vecBalance[cid_ub_send], abs(vecBalance[cid_ub_recv])); global_log->debug() << "[DensityControl] numSwap = " << numSwap << std::endl; for (uint64_t i = 0; i < numSwap; i++) { const uint64_t pid = pidMap[cid_ub_send].back(); @@ -329,7 +329,7 @@ void DensityControl::controlDensity(ParticleContainer* particleContainer, Domain for (auto sid : swpMap[i]) { if (pid == sid) { global_log->debug() << "[DensityControl] Swap pid=" << pid << " with cid=" << it->componentid() + 1 - << " to cid=" << i << endl; + << " to cid=" << i << std::endl; it->setComponent(compNew); } } @@ -340,7 +340,7 @@ void DensityControl::controlDensity(ParticleContainer* particleContainer, Domain std::vector& vec = delMap[i]; if (std::find(vec.begin(), vec.end(), pid) != vec.end()) { // found ID of to be deleted particle in vector global_log->debug() << "[DensityControl] Delete particle with pid= " << pid - << " ; cid_ub= " << it->componentid() + 1 << endl; + << " ; cid_ub= " << it->componentid() + 1 << std::endl; particleContainer->deleteMolecule(it, false); } } @@ -403,7 +403,7 @@ void DensityControl::updateBalanceVector(std::vector& vecBalance, } #ifndef NDEBUG - cout << "_densityTarget.count: "; + std::cout << "_densityTarget.count: "; for (auto i : _densityTarget.count) std::cout << i << ' '; std::cout << std::endl; @@ -509,7 +509,7 @@ void DensityControl::initTargetValues(ParticleContainer* particleContainer, Doma // show target values for (uint32_t i = 0; i < numComponents + 1; i++) { global_log->info() << "cID=" << i << ": target count=" << _densityTarget.count[i] - << ", target density=" << _densityTarget.density[i] << endl; + << ", target density=" << _densityTarget.density[i] << std::endl; } #endif } diff --git a/src/plugins/NEMD/DistControl.cpp b/src/plugins/NEMD/DistControl.cpp index 3d0c5394e7..962bad908b 100644 --- a/src/plugins/NEMD/DistControl.cpp +++ b/src/plugins/NEMD/DistControl.cpp @@ -26,7 +26,6 @@ #include #include -using namespace std; DistControl::DistControl() @@ -71,15 +70,15 @@ void DistControl::readXML(XMLfileUnits& xmlconfig) xmlconfig.getNodeValue("filenames/control", _strFilename); xmlconfig.getNodeValue("filenames/profiles", _strFilenameProfilesPrefix); - global_log->info() << "[DistControl] Writing control data to file: " << _strFilename << endl; - global_log->info() << "[DistControl] Writing profile data to files with prefix: " << _strFilenameProfilesPrefix << endl; + global_log->info() << "[DistControl] Writing control data to file: " << _strFilename << std::endl; + global_log->info() << "[DistControl] Writing profile data to files with prefix: " << _strFilenameProfilesPrefix << std::endl; // subdivision of system uint32_t nSubdivisionType = SDOPT_UNKNOWN; std::string strSubdivisionType; if( !xmlconfig.getNodeValue("subdivision@type", strSubdivisionType) ) { - global_log->error() << "[DistControl] Missing attribute \"subdivision@type\"! Programm exit..." << endl; + global_log->error() << "[DistControl] Missing attribute \"subdivision@type\"! Programm exit..." << std::endl; exit(-1); } if("number" == strSubdivisionType) @@ -87,7 +86,7 @@ void DistControl::readXML(XMLfileUnits& xmlconfig) unsigned int nNumSlabs = 0; if( !xmlconfig.getNodeValue("subdivision/number", nNumSlabs) ) { - global_log->error() << "[DistControl] Missing element \"subdivision/number\"! Programm exit..." << endl; + global_log->error() << "[DistControl] Missing element \"subdivision/number\"! Programm exit..." << std::endl; exit(-1); } else @@ -98,7 +97,7 @@ void DistControl::readXML(XMLfileUnits& xmlconfig) double dSlabWidth = 0.; if( !xmlconfig.getNodeValue("subdivision/width", dSlabWidth) ) { - global_log->error() << "[DistControl] Missing element \"subdivision/width\"! Programm exit..." << endl; + global_log->error() << "[DistControl] Missing element \"subdivision/width\"! Programm exit..." << std::endl; exit(-1); } else @@ -106,7 +105,7 @@ void DistControl::readXML(XMLfileUnits& xmlconfig) } else { - global_log->error() << "[DistControl] Wrong attribute \"subdivision@type\". Expected: type=\"number|width\"! Programm exit..." << endl; + global_log->error() << "[DistControl] Wrong attribute \"subdivision@type\". Expected: type=\"number|width\"! Programm exit..." << std::endl; exit(-1); } @@ -122,7 +121,7 @@ void DistControl::readXML(XMLfileUnits& xmlconfig) if("startconfig" == strInitMethodType) { _nMethodInit = DCIM_START_CONFIGURATION; - global_log->info() << "[DistControl] Init method 'startconfig', dertermining interface midpoints from start configuration." << endl; + global_log->info() << "[DistControl] Init method 'startconfig', dertermining interface midpoints from start configuration." << std::endl; } else if("values" == strInitMethodType) { @@ -133,11 +132,11 @@ void DistControl::readXML(XMLfileUnits& xmlconfig) if(true == bInputIsValid) { global_log->info() << "[DistControl] Init method 'values' => interface midpoint left: " << _dInterfaceMidLeft << ", " - "right: " << _dInterfaceMidRight << "." << endl; + "right: " << _dInterfaceMidRight << "." << std::endl; } else { - global_log->error() << "[DistControl] Missing elements \"init/values/left\" or \"init/values/right\" or both! Programm exit..." << endl; + global_log->error() << "[DistControl] Missing elements \"init/values/left\" or \"init/values/right\" or both! Programm exit..." << std::endl; exit(-1); } } @@ -150,18 +149,18 @@ void DistControl::readXML(XMLfileUnits& xmlconfig) if(true == bInputIsValid) { global_log->info() << "[DistControl] Init method 'file', reading from file: " << _strFilenameInit << ", " - "goto line with simstep == " << _nRestartTimestep << "." << endl; + "goto line with simstep == " << _nRestartTimestep << "." << std::endl; } else { - global_log->error() << "[DistControl] Missing elements \"init/file\" or \"init/simstep\" or both! Programm exit..." << endl; + global_log->error() << "[DistControl] Missing elements \"init/file\" or \"init/simstep\" or both! Programm exit..." << std::endl; exit(-1); } } else { global_log->error() << "[DistControl] Wrong attribute \"init@type\", type = " << strInitMethodType << ", " - "expected: type=\"startconfig|values|file\"! Programm exit..." << endl; + "expected: type=\"startconfig|values|file\"! Programm exit..." << std::endl; exit(-1); } @@ -185,11 +184,11 @@ void DistControl::readXML(XMLfileUnits& xmlconfig) if(true == bInputIsValid) { global_log->info() << "[DistControl] Update method 'density', using constant value for vapor density rho_vap == " << _dVaporDensity << ", " - "target componentID: " << _nTargetCompID << "." << endl; + "target componentID: " << _nTargetCompID << "." << std::endl; } else { - global_log->error() << "[DistControl] Missing elements \"method/componentID\" or \"method/density\" or both! Programm exit..." << endl; + global_log->error() << "[DistControl] Missing elements \"method/componentID\" or \"method/density\" or both! Programm exit..." << std::endl; exit(-1); } } @@ -209,18 +208,18 @@ void DistControl::readXML(XMLfileUnits& xmlconfig) if(true == bInputIsValid) { global_log->info() << "[DistControl] Update method 'denderiv', using " << _nNeighbourValsSmooth << " neigbour values for smoothing " - " and " << _nNeighbourValsDerivate << " neigbour values for derivation of the density profile, target componentID: " << _nTargetCompID << "." << endl; + " and " << _nNeighbourValsDerivate << " neigbour values for derivation of the density profile, target componentID: " << _nTargetCompID << "." << std::endl; } else { - global_log->error() << "[DistControl] Missing elements \"method/componentID\" or \"method/density\" or both! Programm exit..." << endl; + global_log->error() << "[DistControl] Missing elements \"method/componentID\" or \"method/density\" or both! Programm exit..." << std::endl; exit(-1); } } else { global_log->error() << "[DistControl] Wrong attribute \"method@type\", type = " << strUpdateMethodType << ", " - "expected: type=\"density|denderiv\"! Programm exit..." << endl; + "expected: type=\"density|denderiv\"! Programm exit..." << std::endl; exit(-1); } } @@ -266,7 +265,7 @@ void DistControl::PrepareSubdivision() break; case SDOPT_UNKNOWN: default: - global_log->error() << "[DistControl] PrepareSubdivision(): Neither _binParams.width nor _binParams.count was set correctly! Programm exit..." << endl; + global_log->error() << "[DistControl] PrepareSubdivision(): Neither _binParams.width nor _binParams.count was set correctly! Programm exit..." << std::endl; exit(-1); } @@ -389,12 +388,12 @@ void DistControl::CalcProfiles() void DistControl::EstimateInterfaceMidpointsByForce() { // for(unsigned short cid=0; cid<_nNumComponents; ++cid) -// cout << "_nOffsets[cid] = " << _nOffsets[cid] << endl; +// std::cout << "_nOffsets[cid] = " << _nOffsets[cid] << std::endl; unsigned int nIndexMin = 0; unsigned int nIndexMax = 0; -// cout << "_nTargetCompID = " << _nTargetCompID << endl; -// cout << "_nOffsets[_nTargetCompID] = " << _nOffsets[_nTargetCompID] << endl; +// std::cout << "_nTargetCompID = " << _nTargetCompID << std::endl; +// std::cout << "_nOffsets[_nTargetCompID] = " << _nOffsets[_nTargetCompID] << std::endl; double* dProfile = _dDensityProfileSmoothedDerivation.data() + _nOffsets.at(_nTargetCompID); double dMin = dProfile[0]; double dMax = dProfile[0]; @@ -500,9 +499,9 @@ void DistControl::EstimateInterfaceMidpoint() // 1. ym bestimmen double ym = dMin + (dMax - dMin) / 2; -// cout << "dMin = " << dMin << endl; -// cout << "dMax = " << dMax << endl; -// cout << "ym = " << ym << endl; +// std::cout << "dMin = " << dMin << std::endl; +// std::cout << "dMax = " << dMax << std::endl; +// std::cout << "ym = " << ym << std::endl; // 2. Slab mit gerade niedrigerer Anzahl finden --> von links angefangen ersten Slab größer numMax finden --> Index -1 rechnen int nIndexSlabGreater = 0; @@ -518,11 +517,11 @@ void DistControl::EstimateInterfaceMidpoint() if(nIndexSlabGreater < 1) { - global_log->error() << "[DistControl] EstimateInterfaceMidpoint(): could not find valid index in density profile" << endl; + global_log->error() << "[DistControl] EstimateInterfaceMidpoint(): could not find valid index in density profile" << std::endl; return; } -// cout << "nIndexSlabGreater = " << nIndexSlabGreater << endl; +// std::cout << "nIndexSlabGreater = " << nIndexSlabGreater << std::endl; //3. Interpolierte Distanz dInterpol berechnen, die von dem Slab mit N < Nsoll ausgehend in Richtung N > Nsoll gegangen werden muss double dx12, dx1m, y1, y2, dy12, dy1m; @@ -545,13 +544,13 @@ void DistControl::EstimateInterfaceMidpoint() x1 = dOuterBoundarySampleZone + nIndexSlabGreater * _binParams.width - _binParams.width*0.5; -// cout << "x1 = " << x1 << endl; -// cout << "dx1m = " << dx1m << endl; +// std::cout << "x1 = " << x1 << std::endl; +// std::cout << "dx1m = " << dx1m << std::endl; xm = x1 + dx1m; _dInterfaceMidLeft = xm; -// cout << "_dInterfaceMidLeft = " << _dInterfaceMidLeft << endl; +// std::cout << "_dInterfaceMidLeft = " << _dInterfaceMidLeft << std::endl; } @@ -589,7 +588,7 @@ void DistControl::EstimateInterfaceMidpoint() // 1. ym bestimmen double ym = dMin + (dMax - dMin) / 2; -// cout << "ym = " << ym << endl; +// std::cout << "ym = " << ym << std::endl; // 2. Slab mit gerade niedrigerer Anzahl finden --> von links angefangen ersten Slab größer numMax finden --> Index -1 rechnen unsigned int nIndexSlabGreater = 0; @@ -605,7 +604,7 @@ void DistControl::EstimateInterfaceMidpoint() if(nIndexSlabGreater < 1) { - global_log->error() << "[DistControl] EstimateInterfaceMidpoint(): could not find valid index in density profile" << endl; + global_log->error() << "[DistControl] EstimateInterfaceMidpoint(): could not find valid index in density profile" << std::endl; return; } @@ -630,17 +629,17 @@ void DistControl::EstimateInterfaceMidpoint() double dOuterBoundarySampleZone = domain->getGlobalLength(1); //this->GetUpperCorner()[1]; unsigned int numShellsLower = _binParams.count-1 - nIndexSlabGreater; -// cout << "numShellsLower = " << numShellsLower << endl; +// std::cout << "numShellsLower = " << numShellsLower << std::endl; x1 = dOuterBoundarySampleZone - numShellsLower * _binParams.width + _binParams.width*0.5; -// cout << "x1 = " << x1 << endl; -// cout << "dx1m = " << dx1m << endl; +// std::cout << "x1 = " << x1 << std::endl; +// std::cout << "dx1m = " << dx1m << std::endl; xm = x1 - dx1m; _dInterfaceMidRight = xm; -// cout << "_dInterfaceMidRight = " << _dInterfaceMidRight << endl; +// std::cout << "_dInterfaceMidRight = " << _dInterfaceMidRight << std::endl; } } @@ -671,17 +670,17 @@ void DistControl::UpdatePositionsInit(ParticleContainer* particleContainer) break; case DCIM_READ_FROM_FILE: { -// cout << "_strFilenameInit = " << _strFilenameInit << endl; -// cout << "_nRestartTimestep = " << _nRestartTimestep << endl; +// std::cout << "_strFilenameInit = " << _strFilenameInit << std::endl; +// std::cout << "_nRestartTimestep = " << _nRestartTimestep << std::endl; - ifstream filein(_strFilenameInit.c_str(), ios::in); + std::ifstream filein(_strFilenameInit.c_str(), std::ios::in); - string strLine, strToken; - string strTokens[20]; + std::string strLine, strToken; + std::string strTokens[20]; while (getline (filein, strLine)) { - stringstream sstr; + std::stringstream sstr; sstr << strLine; sstr >> strToken; @@ -702,13 +701,13 @@ void DistControl::UpdatePositionsInit(ParticleContainer* particleContainer) } case DCIM_UNKNOWN: default: - global_log->error() << "[DistControl] Wrong Init Method! Programm exit..." << endl; + global_log->error() << "[DistControl] Wrong Init Method! Programm exit..." << std::endl; exit(-1); } #ifndef NDEBUG - global_log->error() << "[DistControl] _dInterfaceMidLeft = " << _dInterfaceMidLeft << endl; - global_log->error() << "[DistControl] _dInterfaceMidRight = " << _dInterfaceMidRight << endl; + global_log->error() << "[DistControl] _dInterfaceMidLeft = " << _dInterfaceMidLeft << std::endl; + global_log->error() << "[DistControl] _dInterfaceMidRight = " << _dInterfaceMidRight << std::endl; #endif // update positions @@ -738,7 +737,7 @@ void DistControl::UpdatePositions(const uint64_t& simstep) break; case DCUM_UNKNOWN: default: - global_log->error() << "[DistControl] UpdatePositions() Corrupted code!!! Programm exit..." << endl; + global_log->error() << "[DistControl] UpdatePositions() Corrupted code!!! Programm exit..." << std::endl; exit(-1); } @@ -764,7 +763,7 @@ void DistControl::WriteData(const uint64_t& simstep) DomainDecompBase& domainDecomp = global_simulation->domainDecomposition(); // write out data - stringstream outputstream; + std::stringstream outputstream; // write data if(simstep % _controlFreqs.write.data == 0) @@ -798,9 +797,9 @@ void DistControl::WriteData(const uint64_t& simstep) } } - outputstream << endl; + outputstream << std::endl; - ofstream fileout(_strFilename.c_str(), ios::out|ios::app); + std::ofstream fileout(_strFilename.c_str(), std::ios::out|std::ios::app); fileout << outputstream.str(); fileout.close(); #ifdef ENABLE_MPI @@ -815,7 +814,7 @@ void DistControl::WriteHeader() DomainDecompBase& domainDecomp = global_simulation->domainDecomposition(); // write header - stringstream outputstream; + std::stringstream outputstream; #ifdef ENABLE_MPI int rank = domainDecomp.getRank(); @@ -843,9 +842,9 @@ void DistControl::WriteHeader() if(nullptr != ctrlInst) outputstream << std::setw (24) << ctrlInst->getShortName(); } - outputstream << endl; + outputstream << std::endl; - ofstream fileout(_strFilename.c_str(), ios::out); + std::ofstream fileout(_strFilename.c_str(), std::ios::out); fileout << outputstream.str(); fileout.close(); @@ -863,13 +862,13 @@ void DistControl::WriteDataProfiles(const uint64_t& simstep) // domain decomposition DomainDecompBase& domainDecomp = global_simulation->domainDecomposition(); - stringstream outputstream; - stringstream filenamestream; + std::stringstream outputstream; + std::stringstream filenamestream; filenamestream << _strFilenameProfilesPrefix << "_TS"; filenamestream.fill('0'); filenamestream.width(9); - filenamestream << right << simstep; + filenamestream << std::right << simstep; filenamestream << ".dat"; #ifdef ENABLE_MPI @@ -889,7 +888,7 @@ void DistControl::WriteDataProfiles(const uint64_t& simstep) outputstream << " Fy[" << cid << "]"; outputstream << " Fy_smooth[" << cid << "]"; } - outputstream << endl; + outputstream << std::endl; // write data for(auto s=0u; s<_binParams.count; ++s) { @@ -903,9 +902,9 @@ void DistControl::WriteDataProfiles(const uint64_t& simstep) outputstream << FORMAT_SCI_MAX_DIGITS << _dForceProfile.at(nIndex); outputstream << FORMAT_SCI_MAX_DIGITS << _dForceProfileSmoothed.at(nIndex); } - outputstream << endl; + outputstream << std::endl; } - ofstream fileout(filenamestream.str().c_str(), ios::out|ios::out); + std::ofstream fileout(filenamestream.str().c_str(), std::ios::out|std::ios::out); fileout << outputstream.str(); fileout.close(); } @@ -992,8 +991,8 @@ void DistControl::DerivateProfile(double* dDataX, double* dDataY, double* dDeriv } */ - vector x; - vector y; + std::vector x; + std::vector y; for(auto s=0u; s #include -using namespace std; -using Log::global_log; DriftCtrl::DriftCtrl() { @@ -141,13 +139,13 @@ void DriftCtrl::readXML(XMLfileUnits& xmlconfig) _directions.push_back(2); break; default: - global_log->warning() << "[DriftCtrl] Unknown direction: " << c << endl; + global_log->warning() << "[DriftCtrl] Unknown direction: " << c << std::endl; } } - global_log->info() << "[DriftCtrl] Directions to be controlled: " << strDirs << endl; + global_log->info() << "[DriftCtrl] Directions to be controlled: " << strDirs << std::endl; global_log->info() << "[DriftCtrl] Target drift vx,vy,vz=" - << _target.drift.at(0) << "," << _target.drift.at(1) << "," << _target.drift.at(2) << ", cid=" << _target.cid << endl; + << _target.drift.at(0) << "," << _target.drift.at(1) << "," << _target.drift.at(2) << ", cid=" << _target.cid << std::endl; } void DriftCtrl::beforeForces(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, unsigned long simstep) @@ -202,7 +200,7 @@ void DriftCtrl::beforeForces(ParticleContainer* particleContainer, DomainDecompB numValsCheck += 4; } } - //~ cout << "numVals ?= numValsCheck: " << numVals << "?=" << numValsCheck << endl; + //~ cout << "numVals ?= numValsCheck: " << numVals << "?=" << numValsCheck << std::endl; // reduce domainDecomp->collCommAllreduceSum(); // collect global values @@ -215,7 +213,7 @@ void DriftCtrl::beforeForces(ParticleContainer* particleContainer, DomainDecompB numParticles = 1; double invNumParticles = 1./static_cast(numParticles); _sampling.at(cid).numParticles.global.at(yPosID) = numParticles; - //~ cout << "[" << nRank << "]: cid=" << cid << ",yPosID=" << yPosID << ",numParticles=" << numParticles << endl; + //~ cout << "[" << nRank << "]: cid=" << cid << ",yPosID=" << yPosID << ",numParticles=" << numParticles << std::endl; _sampling.at(cid).velocity.at(0).global.at(yPosID) = domainDecomp->collCommGetDouble() * invNumParticles; _sampling.at(cid).velocity.at(1).global.at(yPosID) = domainDecomp->collCommGetDouble() * invNumParticles; _sampling.at(cid).velocity.at(2).global.at(yPosID) = domainDecomp->collCommGetDouble() * invNumParticles; @@ -271,7 +269,7 @@ void DriftCtrl::beforeForces(ParticleContainer* particleContainer, DomainDecompB const std::string fname = "DriftCtrl_drift.dat"; std::ofstream ofs; ofs.open(fname, std::ios::app); - ofs << setw(12) << simstep; + ofs << std::setw(12) << simstep; for(const auto &veloGlobalY : _sampling.at(_target.cid).velocity.at(1).global) { ofs << FORMAT_SCI_MAX_DIGITS << veloGlobalY; } @@ -282,9 +280,9 @@ void DriftCtrl::beforeForces(ParticleContainer* particleContainer, DomainDecompB const std::string fname = "DriftCtrl_numParticles.dat"; std::ofstream ofs; ofs.open(fname, std::ios::app); - ofs << setw(12) << simstep; + ofs << std::setw(12) << simstep; for(const auto &numPartsGlobal : _sampling.at(_target.cid).numParticles.global) { - ofs << setw(12) << numPartsGlobal; + ofs << std::setw(12) << numPartsGlobal; } ofs << std::endl; ofs.close(); diff --git a/src/plugins/NEMD/MettDeamon.cpp b/src/plugins/NEMD/MettDeamon.cpp index ad0dae750e..f212b712c4 100644 --- a/src/plugins/NEMD/MettDeamon.cpp +++ b/src/plugins/NEMD/MettDeamon.cpp @@ -30,7 +30,6 @@ #include #include -using namespace std; template < typename T > void shuffle( std::list& lst ) // shuffle contents of a list { @@ -65,9 +64,9 @@ void update_velocity_vectors(Random* rnd, const uint64_t& numSamples, const doub std::vector& vxi, std::vector& vyi, std::vector& vzi) { double stdDev = sqrt(T); - vector v2xi(numSamples); - vector v2yi(numSamples); - vector v2zi(numSamples); + std::vector v2xi(numSamples); + std::vector v2yi(numSamples); + std::vector v2zi(numSamples); vxi.resize(numSamples); vyi.resize(numSamples); vzi.resize(numSamples); @@ -397,7 +396,7 @@ void MettDeamon::readXML(XMLfileUnits& xmlconfig) // reservoir { - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); xmlconfig.changecurrentnode("reservoir"); _reservoir->readXML(xmlconfig); xmlconfig.changecurrentnode(oldpath); @@ -413,12 +412,12 @@ void MettDeamon::readXML(XMLfileUnits& xmlconfig) uint8_t numChanges = 0; XMLfile::Query query = xmlconfig.query("change"); numChanges = query.card(); - global_log->info() << "[MettDeamon] Number of fixed molecules components: " << numChanges << endl; + global_log->info() << "[MettDeamon] Number of fixed molecules components: " << numChanges << std::endl; if(numChanges < 1) { - global_log->error() << "[MettDeamon] No component change defined in XML-config file. Program exit ..." << endl; + global_log->error() << "[MettDeamon] No component change defined in XML-config file. Program exit ..." << std::endl; Simulation::exit(-1); } - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); XMLfile::Query::const_iterator changeIter; for( changeIter = query.begin(); changeIter; changeIter++ ) { xmlconfig.changecurrentnode(changeIter); @@ -433,7 +432,7 @@ void MettDeamon::readXML(XMLfileUnits& xmlconfig) xmlconfig.changecurrentnode(".."); } else { - global_log->error() << "[MettDeamon] No component changes defined in XML-config file. Program exit ..." << endl; + global_log->error() << "[MettDeamon] No component changes defined in XML-config file. Program exit ..." << std::endl; Simulation::exit(-1); } } @@ -495,7 +494,7 @@ void MettDeamon::prepare_start(DomainDecompBase* domainDecomp, ParticleContainer _dInvDensityArea = 1. / (_dAreaXZ * _reservoir->getDensity() ); if(_reservoir->getDensity() < 1e-9) { global_log->warning() << "[MettDeamon] ERROR: Reservoir density too low, _reservoir->getDensity()=" - << _reservoir->getDensity() << endl; + << _reservoir->getDensity() << std::endl; } // Activate reservoir bin with respect to restart information if(_bIsRestart) @@ -838,9 +837,9 @@ void MettDeamon::postForce_action(ParticleContainer* particleContainer, DomainDe this->calcDeltaY(); else if(FRM_DENSITY == _nFeedRateMethod) this->calcDeltaYbyDensity(); - global_log->debug() << "_numDeletedMolsSum = " << _numDeletedMolsSum << endl; - global_log->debug() << "_dDeletedMolsPerTimestep = " << _dDeletedMolsPerTimestep << endl; - global_log->debug() << "_feedrate.feed.actual = " << _feedrate.feed.actual << endl; + global_log->debug() << "_numDeletedMolsSum = " << _numDeletedMolsSum << std::endl; + global_log->debug() << "_dDeletedMolsPerTimestep = " << _dDeletedMolsPerTimestep << std::endl; + global_log->debug() << "_feedrate.feed.actual = " << _feedrate.feed.actual << std::endl; } else { @@ -887,7 +886,7 @@ void MettDeamon::writeRestartfile() } else { ofs.open(fname, std::ios::app); } - ofs << setw(12) << simstep << setw(12) << _reservoir->getActualBinIndex(); + ofs << std::setw(12) << simstep << std::setw(12) << _reservoir->getActualBinIndex(); ofs << FORMAT_SCI_MAX_DIGITS << _feedrate.feed.sum << std::endl; ofs.close(); } @@ -899,13 +898,13 @@ void MettDeamon::writeRestartfile() const std::string fname = "MettDeamonRestart_movdir-"+std::to_string(_nMovingDirection); fnamestream << fname << "_TS" << fill_width('0', 9) << simstep << ".xml"; ofs.open(fnamestream.str().c_str(), std::ios::out); - ofs << "" << endl; - ofs << "" << endl; - ofs << "\t" << _reservoir->getActualBinIndex() << "" << endl; - ios::fmtflags f( ofs.flags() ); - ofs << "\t" << FORMAT_SCI_MAX_DIGITS_WIDTH_21 << _feedrate.feed.sum << "" << endl; + ofs << "" << std::endl; + ofs << "" << std::endl; + ofs << "\t" << _reservoir->getActualBinIndex() << "" << std::endl; + std::ios::fmtflags f( ofs.flags() ); + ofs << "\t" << FORMAT_SCI_MAX_DIGITS_WIDTH_21 << _feedrate.feed.sum << "" << std::endl; ofs.flags(f); // restore default format flags - ofs << "" << endl; + ofs << "" << std::endl; ofs.close(); } } @@ -935,7 +934,7 @@ void MettDeamon::logFeedrate() } else { ofs.open(fname, std::ios::app); } - ofs << setw(12) << global_simulation->getSimulationStep(); + ofs << std::setw(12) << global_simulation->getSimulationStep(); ofs << FORMAT_SCI_MAX_DIGITS << _feedrate.feed.actual << std::endl; ofs.close(); } @@ -976,7 +975,7 @@ void MettDeamon::logReleased() } else { ofs.open(fname, std::ios::app); } - ofs << setw(12) << global_simulation->getSimulationStep() << setw(12) << _released.count.global << setw(12) << _released.deleted.global << std::endl; + ofs << std::setw(12) << global_simulation->getSimulationStep() << std::setw(12) << _released.count.global << std::setw(12) << _released.deleted.global << std::endl; ofs.close(); } @@ -1059,14 +1058,14 @@ void MettDeamon::getAvailableParticleIDs(ParticleContainer* particleContainer, D domain->updateMaxMoleculeID(particleContainer, domainDecomp); maxID = domain->getMaxMoleculeID(); numMolecules.global = domain->getglobalNumMolecules(true, particleContainer, domainDecomp); - global_log->debug() << "[" << nRank << "]: maxID.local, maxID.global=" << maxID.local << ", " << maxID.global << endl; + global_log->debug() << "[" << nRank << "]: maxID.local, maxID.global=" << maxID.local << ", " << maxID.global << std::endl; uint64_t numMoleculesAfterInsertion = numMolecules.global + numParticleIDs.global; uint64_t numIDs; if(maxID.global >= numMoleculesAfterInsertion) numIDs = maxID.global + 1; else numIDs = numMoleculesAfterInsertion + 1; - global_log->debug() << "[" << nRank << "]: numMoleculesAfterInsertion, numMolecules.global=" << numMoleculesAfterInsertion << ", " << numMolecules.global << endl; + global_log->debug() << "[" << nRank << "]: numMoleculesAfterInsertion, numMolecules.global=" << numMoleculesAfterInsertion << ", " << numMolecules.global << std::endl; std::vector& vl = particleIDs_assigned.local; vl.resize(numIDs); std::fill(vl.begin(), vl.end(), 0); @@ -1085,7 +1084,7 @@ void MettDeamon::getAvailableParticleIDs(ParticleContainer* particleContainer, D vg.at(ii) = vl.at(ii); #endif - global_log->debug() << "[" << nRank << "]: assigned.local, assigned.global=" << particleIDs_assigned.local.size() << ", " << particleIDs_assigned.global.size() << endl; + global_log->debug() << "[" << nRank << "]: assigned.local, assigned.global=" << particleIDs_assigned.local.size() << ", " << particleIDs_assigned.global.size() << std::endl; // check for available particle IDs for(uint64_t pid=1; piddebug() << "[" << nRank << "]: avail.local, avail.global=" << particleIDs_available.local.size() << ", " << particleIDs_available.global.size() << endl; + global_log->debug() << "[" << nRank << "]: avail.local, avail.global=" << particleIDs_available.local.size() << ", " << particleIDs_available.global.size() << std::endl; #ifdef ENABLE_MPI // gather displacement (displs) @@ -1187,10 +1186,10 @@ void MettDeamon::InsertReservoirSlab(ParticleContainer* particleContainer) } _feedrate.feed.sum -= _reservoir->getBinWidth(); // reset feed sum if(not _reservoir->nextBin(_nMaxMoleculeID.global) ) { - global_log->error() << "[MettDeamon] Failed to activate new bin of particle Reservoir's BinQueue => Program exit." << endl; + global_log->error() << "[MettDeamon] Failed to activate new bin of particle Reservoir's BinQueue => Program exit." << std::endl; Simulation::exit(-1); } - global_log->debug() << "[" << nRank << "]: ADDED " << numAdded.local << "/" << numParticlesCurrentSlab.local << " particles (" << numAdded.local/static_cast(numParticlesCurrentSlab.local)*100 << ")%." << endl; + global_log->debug() << "[" << nRank << "]: ADDED " << numAdded.local << "/" << numParticlesCurrentSlab.local << " particles (" << numAdded.local/static_cast(numParticlesCurrentSlab.local)*100 << ")%." << std::endl; // calc global values domainDecomp.collCommInit(1); domainDecomp.collCommAppendUnsLong(numAdded.local); @@ -1199,7 +1198,7 @@ void MettDeamon::InsertReservoirSlab(ParticleContainer* particleContainer) domainDecomp.collCommFinalize(); if(0 == nRank) - global_log->debug() << "[" << nRank << "]: ADDED " << numAdded.global << "/" << numParticlesCurrentSlab.global << " particles (" << numAdded.global/static_cast(numParticlesCurrentSlab.global)*100 << ")%." << endl; + global_log->debug() << "[" << nRank << "]: ADDED " << numAdded.global << "/" << numParticlesCurrentSlab.global << " particles (" << numAdded.global/static_cast(numParticlesCurrentSlab.global)*100 << ")%." << std::endl; } void MettDeamon::initRestart() @@ -1207,7 +1206,7 @@ void MettDeamon::initRestart() bool bRet = _reservoir->activateBin(_restartInfo.nBindindex); if(not bRet) { - global_log->info() << "[MettDeamon] Failed to activate reservoir bin after restart! Program exit ... " << endl; + global_log->info() << "[MettDeamon] Failed to activate reservoir bin after restart! Program exit ... " << std::endl; Simulation::exit(-1); } _feedrate.feed.sum = _restartInfo.dYsum; @@ -1255,7 +1254,7 @@ void MettDeamon::updateRandVecTrappedIns() global_log->debug() << vi << ","; nSum += vi; } - global_log->debug() << "sum=" << nSum << endl; + global_log->debug() << "sum=" << nSum << std::endl; } // class Reservoir @@ -1307,7 +1306,7 @@ void Reservoir::readXML(XMLfileUnits& xmlconfig) xmlconfig.getNodeValue("file/data", _filepath.data); } else { - global_log->error() << "[MettDeamon] Reservoir file type not specified or unknown. Programm exit ..." << endl; + global_log->error() << "[MettDeamon] Reservoir file type not specified or unknown. Programm exit ..." << std::endl; Simulation::exit(-1); } @@ -1317,10 +1316,10 @@ void Reservoir::readXML(XMLfileUnits& xmlconfig) XMLfile::Query query = xmlconfig.query("change"); numChanges = query.card(); if(numChanges < 1) { - global_log->error() << "[MettDeamon] No component change defined in XML-config file. Program exit ..." << endl; + global_log->error() << "[MettDeamon] No component change defined in XML-config file. Program exit ..." << std::endl; Simulation::exit(-1); } - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); XMLfile::Query::const_iterator changeIter; for( changeIter = query.begin(); changeIter; changeIter++ ) { xmlconfig.changecurrentnode(changeIter); @@ -1346,7 +1345,7 @@ void Reservoir::readParticleData(DomainDecompBase* domainDecomp, ParticleContain this->readFromFileBinary(domainDecomp, particleContainer); break; default: - global_log->error() << "[MettDeamon] Unknown (or ambiguous) method to read reservoir for feature MettDeamon. Program exit ..." << endl; + global_log->error() << "[MettDeamon] Unknown (or ambiguous) method to read reservoir for feature MettDeamon. Program exit ..." << std::endl; Simulation::exit(-1); } @@ -1382,7 +1381,7 @@ void Reservoir::updateParticleData(DomainDecompBase* domainDecomp, ParticleConta ParticleData::MoleculeToParticleData(particle_buff[particle_buff_pos], _particleVector[i]); particle_buff_pos++; if ((particle_buff_pos >= PARTICLE_BUFFER_SIZE) || (i == num_particles - 1)) { - global_log->debug() << "broadcasting(sending) particles" << endl; + global_log->debug() << "broadcasting(sending) particles" << std::endl; MPI_Bcast(particle_buff, PARTICLE_BUFFER_SIZE, mpi_Particle, rank, domainDecomp->getCommunicator()); particle_buff_pos = 0; } @@ -1391,7 +1390,7 @@ void Reservoir::updateParticleData(DomainDecompBase* domainDecomp, ParticleConta uint64_t numParticlesAdd = 0; for(unsigned long i = 0; i < num_particles; ++i) { if(i % PARTICLE_BUFFER_SIZE == 0) { - global_log->debug() << "broadcasting(receiving) particles" << endl; + global_log->debug() << "broadcasting(receiving) particles" << std::endl; MPI_Bcast(particle_buff, PARTICLE_BUFFER_SIZE, mpi_Particle, rank, domainDecomp->getCommunicator()); particle_buff_pos = 0; } @@ -1406,10 +1405,10 @@ void Reservoir::updateParticleData(DomainDecompBase* domainDecomp, ParticleConta } } if(numParticlesAdd > 0) { - global_log->debug() << "Rank " << ownRank << " received " << numParticlesAdd << " particles from rank " << rank << "." << endl; + global_log->debug() << "Rank " << ownRank << " received " << numParticlesAdd << " particles from rank " << rank << "." << std::endl; } } - global_log->debug() << "broadcasting(sending/receiving) particles complete" << endl; + global_log->debug() << "broadcasting(sending/receiving) particles complete" << std::endl; } // delete particles out of bounding box @@ -1424,7 +1423,7 @@ void Reservoir::updateParticleData(DomainDecompBase* domainDecomp, ParticleConta _particleVector.resize(particleVectorTmp.size()); _particleVector = particleVectorTmp; if(_particleVector.size() < numParticlesOld) { - global_log->debug() << "Rank " << ownRank << " deleted " << numParticlesOld - _particleVector.size() << " particles from particle vector." << endl; + global_log->debug() << "Rank " << ownRank << " deleted " << numParticlesOld - _particleVector.size() << " particles from particle vector." << std::endl; } // Refresh BinQueue uint32_t actual = _binQueue->getActualBinIndex(); @@ -1441,10 +1440,10 @@ void Reservoir::sortParticlesToBins(DomainDecompBase* domainDecomp, ParticleCont uint32_t numBins = _box.length.at(1) / _dBinWidthInit; _dBinWidth = _box.length.at(1) / static_cast(numBins); if (_dBinWidthInit != _dBinWidth) { global_log->warning() << "[MettDeamon] Bin width changed from " << _dBinWidthInit << " to " << _dBinWidth << std::endl; } - global_log->debug() << "_arrBoxLength[1]="<<_box.length.at(1)<debug() << "_dBinWidthInit="<<_dBinWidthInit<debug() << "_numBins="<debug() << "_particleVector.size()=" << _particleVector.size() << endl; + global_log->debug() << "_arrBoxLength[1]="<<_box.length.at(1)<debug() << "_dBinWidthInit="<<_dBinWidthInit<debug() << "_numBins="<debug() << "_particleVector.size()=" << _particleVector.size() << std::endl; global_log->debug() << "bbMin =" << domainDecomp->getBoundingBoxMin(0, domain) << ", " @@ -1452,7 +1451,7 @@ void Reservoir::sortParticlesToBins(DomainDecompBase* domainDecomp, ParticleCont << domainDecomp->getBoundingBoxMin(2, domain) << "; bbMax = " << domainDecomp->getBoundingBoxMax(0, domain) << ", " << domainDecomp->getBoundingBoxMax(1, domain) << ", " - << domainDecomp->getBoundingBoxMax(2, domain) << endl; + << domainDecomp->getBoundingBoxMax(2, domain) << std::endl; std::vector< std::vector > binVector; binVector.resize(numBins); uint32_t nBinIndex; @@ -1462,7 +1461,7 @@ void Reservoir::sortParticlesToBins(DomainDecompBase* domainDecomp, ParticleCont this->changeComponentID(mol, mol.componentid() ); double y = mol.r(1); nBinIndex = floor(y / _dBinWidth); - global_log->debug() << "[MettDeamon] y="<error() << "[MettDeamon] Unknown moving direction" << std::endl; } // check if molecule is in bounding box of the process domain bool bIsInsideBB = domainDecomp->procOwnsPos(mol.r(0), mol.r(1), mol.r(2), domain); bool bIsInsidePC = particleContainer->isInBoundingBox(mol.r_arr().data()); if(bIsInsideBB != bIsInsidePC) - global_log->debug() << "[MettDeamon] bIsInsideBB=" << bIsInsideBB << ", bIsInsidePC=" << bIsInsidePC << endl; + global_log->debug() << "[MettDeamon] bIsInsideBB=" << bIsInsideBB << ", bIsInsidePC=" << bIsInsidePC << std::endl; if (bIsInsideBB) binVector.at(nBinIndex).push_back(mol); } @@ -1492,7 +1491,7 @@ void Reservoir::sortParticlesToBins(DomainDecompBase* domainDecomp, ParticleCont case MD_LEFT_TO_RIGHT: for (auto bit = binVector.rbegin(); bit != binVector.rend(); ++bit) { - global_log->debug() << "(*bit).size()=" << (*bit).size() << endl; + global_log->debug() << "(*bit).size()=" << (*bit).size() << std::endl; _binQueue->enque(*bit); } break; @@ -1500,12 +1499,12 @@ void Reservoir::sortParticlesToBins(DomainDecompBase* domainDecomp, ParticleCont case MD_RIGHT_TO_LEFT: for(const auto& bin:binVector) { - global_log->debug() << "bin.size()=" << bin.size() << endl; + global_log->debug() << "bin.size()=" << bin.size() << std::endl; _binQueue->enque(bin); } break; default: - global_log->error() << "[MettDeamon] Unknown moving direction" << endl; + global_log->error() << "[MettDeamon] Unknown moving direction" << std::endl; } } @@ -1513,19 +1512,19 @@ void Reservoir::readFromFile(DomainDecompBase* domainDecomp, ParticleContainer* { Domain* domain = global_simulation->getDomain(); std::ifstream ifs; - global_log->info() << "[MettDeamon] Reservoir read in from ASCII file" << endl; - global_log->info() << "[MettDeamon] Opening Reservoirfile " << _filepath.data << endl; + global_log->info() << "[MettDeamon] Reservoir read in from ASCII file" << std::endl; + global_log->info() << "[MettDeamon] Opening Reservoirfile " << _filepath.data << std::endl; ifs.open( _filepath.data.c_str() ); if (!ifs.is_open()) { - global_log->error() << "[MettDeamon] Could not open Mettdeamon Reservoirfile " << _filepath.data << endl; + global_log->error() << "[MettDeamon] Could not open Mettdeamon Reservoirfile " << _filepath.data << std::endl; Simulation::exit(1); } - global_log->info() << "[MettDeamon] Reading Mettdeamon Reservoirfile " << _filepath.data << endl; + global_log->info() << "[MettDeamon] Reading Mettdeamon Reservoirfile " << _filepath.data << std::endl; - string token; - vector& dcomponents = *(_simulation.getEnsemble()->getComponents()); + std::string token; + std::vector& dcomponents = *(_simulation.getEnsemble()->getComponents()); unsigned int numcomponents = dcomponents.size(); - string ntypestring("ICRVQD"); + std::string ntypestring("ICRVQD"); enum Ndatatype { ICRVQDV, ICRVQD, IRV, ICRV } ntype = ICRVQD; double Xlength, Ylength, Zlength; @@ -1546,14 +1545,14 @@ void Reservoir::readFromFile(DomainDecompBase* domainDecomp, ParticleContainer* } if((token != "NumberOfMolecules") && (token != "N")) { - global_log->error() << "[MettDeamon] Expected the token 'NumberOfMolecules (N)' instead of '" << token << "'" << endl; + global_log->error() << "[MettDeamon] Expected the token 'NumberOfMolecules (N)' instead of '" << token << "'" << std::endl; Simulation::exit(1); } ifs >> _numMoleculesRead; this->setDensity(_numMoleculesRead / dVolume); - streampos spos = ifs.tellg(); + std::streampos spos = ifs.tellg(); ifs >> token; if((token=="MoleculeFormat") || (token == "M")) { @@ -1566,16 +1565,16 @@ void Reservoir::readFromFile(DomainDecompBase* domainDecomp, ParticleContainer* else if (ntypestring == "ICRV") ntype = ICRV; else if (ntypestring == "IRV") ntype = IRV; else { - global_log->error() << "[MettDeamon] Unknown molecule format '" << ntypestring << "'" << endl; + global_log->error() << "[MettDeamon] Unknown molecule format '" << ntypestring << "'" << std::endl; Simulation::exit(1); } } else { ifs.seekg(spos); } - global_log->info() << " molecule format: " << ntypestring << endl; + global_log->info() << " molecule format: " << ntypestring << std::endl; if( numcomponents < 1 ) { - global_log->warning() << "[MettDeamon] No components defined! Setting up single one-centered LJ" << endl; + global_log->warning() << "[MettDeamon] No components defined! Setting up single one-centered LJ" << std::endl; numcomponents = 1; dcomponents.resize( numcomponents ); dcomponents[0].setID(0); @@ -1608,7 +1607,7 @@ void Reservoir::readFromFile(DomainDecompBase* domainDecomp, ParticleContainer* ifs >> id >> x >> y >> z >> vx >> vy >> vz; break; default: - global_log->error() << "[MettDeamon] Unknown molecule format" << endl; + global_log->error() << "[MettDeamon] Unknown molecule format" << std::endl; } if( componentid > numcomponents ) { @@ -1616,7 +1615,7 @@ void Reservoir::readFromFile(DomainDecompBase* domainDecomp, ParticleContainer* << " has a component ID greater than the existing number of components: " << componentid << ">" - << numcomponents << endl; + << numcomponents << std::endl; Simulation::exit(1); } // ComponentIDs are used as array IDs, hence need to start at 0. @@ -1632,7 +1631,7 @@ void Reservoir::readFromFile(DomainDecompBase* domainDecomp, ParticleContainer* // Print status message unsigned long iph = _numMoleculesRead / 100; if( iph != 0 && (i % iph) == 0 ) - global_log->info() << "[MettDeamon] Finished reading molecules: " << i/iph << "%\r" << flush; + global_log->info() << "[MettDeamon] Finished reading molecules: " << i/iph << "%\r" << std::flush; } ifs.close(); @@ -1644,8 +1643,8 @@ void Reservoir::readFromFileBinaryHeader() XMLfileUnits inp(_filepath.header); if(not inp.changecurrentnode("/mardyn")) { - global_log->error() << "[MettDeamon] Could not find root node /mardyn in XML header file or file itself." << endl; - global_log->fatal() << "[MettDeamon] Not a valid MarDyn XML header file." << endl; + global_log->error() << "[MettDeamon] Could not find root node /mardyn in XML header file or file itself." << std::endl; + global_log->fatal() << "[MettDeamon] Not a valid MarDyn XML header file." << std::endl; Simulation::exit(1); } @@ -1673,7 +1672,7 @@ void Reservoir::readFromFileBinaryHeader() if(not bInputOk) { - global_log->error() << "[MettDeamon] Content of file: '" << _filepath.header << "' corrupted! Program exit ..." << endl; + global_log->error() << "[MettDeamon] Content of file: '" << _filepath.header << "' corrupted! Program exit ..." << std::endl; Simulation::exit(1); } @@ -1685,7 +1684,7 @@ void Reservoir::readFromFileBinaryHeader() _nMoleculeFormat = ICRV; else { - global_log->error() << "[MettDeamon] Not a valid molecule format: " << strMoleculeFormat << ", program exit ..." << endl; + global_log->error() << "[MettDeamon] Not a valid molecule format: " << strMoleculeFormat << ", program exit ..." << std::endl; Simulation::exit(1); } } @@ -1693,24 +1692,24 @@ void Reservoir::readFromFileBinaryHeader() void Reservoir::readFromFileBinary(DomainDecompBase* domainDecomp, ParticleContainer* particleContainer) { Domain* domain = global_simulation->getDomain(); - global_log->info() << "[MettDeamon] Reservoir read in from binary file" << endl; + global_log->info() << "[MettDeamon] Reservoir read in from binary file" << std::endl; // read header this->readFromFileBinaryHeader(); #ifdef ENABLE_MPI if(domainDecomp->getRank() == 0) { #endif - global_log->info() << "[MettDeamon] Opening phase space file " << _filepath.data << endl; + global_log->info() << "[MettDeamon] Opening phase space file " << _filepath.data << std::endl; std::ifstream ifs; - ifs.open(_filepath.data.c_str(), ios::binary | ios::in); + ifs.open(_filepath.data.c_str(), std::ios::binary | std::ios::in); if (!ifs.is_open()) { - global_log->error() << "[MettDeamon] Could not open reservoir phaseSpaceFile " << _filepath.data << endl; + global_log->error() << "[MettDeamon] Could not open reservoir phaseSpaceFile " << _filepath.data << std::endl; Simulation::exit(1); } - global_log->info() << "[MettDeamon] Reading phase space file " << _filepath.data << endl; + global_log->info() << "[MettDeamon] Reading phase space file " << _filepath.data << std::endl; - vector& components = *(_simulation.getEnsemble()->getComponents()); + std::vector& components = *(_simulation.getEnsemble()->getComponents()); // Select appropriate reader switch (_nMoleculeFormat) { @@ -1723,7 +1722,7 @@ void Reservoir::readFromFileBinary(DomainDecompBase* domainDecomp, ParticleConta case IRV: _moleculeDataReader = std::make_unique(); break; - default: global_log->error() << "[MettDeamon] Unknown molecule format" << endl; + default: global_log->error() << "[MettDeamon] Unknown molecule format" << std::endl; } for (uint64_t pi=0; pi<_numMoleculesRead; pi++) { @@ -1752,7 +1751,7 @@ void Reservoir::readFromFileBinary(DomainDecompBase* domainDecomp, ParticleConta ParticleData::MoleculeToParticleData(particle_buff[particle_buff_pos], _particleVector[i]); particle_buff_pos++; if ((particle_buff_pos >= PARTICLE_BUFFER_SIZE) || (i == num_particles - 1)) { - global_log->debug() << "broadcasting(sending) particles" << endl; + global_log->debug() << "broadcasting(sending) particles" << std::endl; MPI_Bcast(particle_buff, PARTICLE_BUFFER_SIZE, mpi_Particle, 0, domainDecomp->getCommunicator()); particle_buff_pos = 0; } @@ -1767,7 +1766,7 @@ void Reservoir::readFromFileBinary(DomainDecompBase* domainDecomp, ParticleConta } else { for(unsigned long i = 0; i < num_particles; ++i) { if(i % PARTICLE_BUFFER_SIZE == 0) { - global_log->debug() << "broadcasting(receiving) particles" << endl; + global_log->debug() << "broadcasting(receiving) particles" << std::endl; MPI_Bcast(particle_buff, PARTICLE_BUFFER_SIZE, mpi_Particle, 0, domainDecomp->getCommunicator()); particle_buff_pos = 0; } @@ -1781,7 +1780,7 @@ void Reservoir::readFromFileBinary(DomainDecompBase* domainDecomp, ParticleConta } } } - global_log->debug() << "broadcasting(sending/receiving) particles complete" << endl; + global_log->debug() << "broadcasting(sending/receiving) particles complete" << std::endl; #endif } @@ -1806,7 +1805,7 @@ bool Reservoir::isRelevant(DomainDecompBase* domainDecomp, Domain* domain, Molec dOffset = nBinIndex*_dBinWidth + (domain->getGlobalLength(1) - _dBinWidth); break; default: - global_log->error() << "[MettDeamon] Unknown moving direction" << endl; + global_log->error() << "[MettDeamon] Unknown moving direction" << std::endl; } return domainDecomp->procOwnsPos(mol.r(0), y-dOffset, mol.r(2), domain); } @@ -1822,9 +1821,9 @@ bool Reservoir::activateBin(uint32_t nBinIndex){return _binQueue->activateBin(nB void Reservoir::clearBinQueue() {_binQueue->clear();} void Reservoir::printBinQueueInfo() { - global_log->debug() << "_binQueue->getActualBinIndex()=" << _binQueue->getActualBinIndex() << endl; - global_log->debug() << "_binQueue->getNumBins()=" << _binQueue->getNumBins() << endl; - global_log->debug() << "_binQueue->getRoundCount()=" << _binQueue->getRoundCount() << endl; - global_log->debug() << "_binQueue->getNumParticles()=" << _binQueue->getNumParticles() << endl; - global_log->debug() << "_binQueue->getMaxID()=" << _binQueue->getMaxID() << endl; + global_log->debug() << "_binQueue->getActualBinIndex()=" << _binQueue->getActualBinIndex() << std::endl; + global_log->debug() << "_binQueue->getNumBins()=" << _binQueue->getNumBins() << std::endl; + global_log->debug() << "_binQueue->getRoundCount()=" << _binQueue->getRoundCount() << std::endl; + global_log->debug() << "_binQueue->getNumParticles()=" << _binQueue->getNumParticles() << std::endl; + global_log->debug() << "_binQueue->getMaxID()=" << _binQueue->getMaxID() << std::endl; } diff --git a/src/plugins/NEMD/MettDeamon.h b/src/plugins/NEMD/MettDeamon.h index ae21fe957c..583a77fbe2 100644 --- a/src/plugins/NEMD/MettDeamon.h +++ b/src/plugins/NEMD/MettDeamon.h @@ -575,7 +575,7 @@ class BinQueue void showActualBin() { for(auto& p:_actual->_particles) std::cout << p << ", "; - std::cout << endl; + std::cout << std::endl; } void connectTailToHead() diff --git a/src/plugins/NEMD/MettDeamonFeedrateDirector.cpp b/src/plugins/NEMD/MettDeamonFeedrateDirector.cpp index 41ae21af21..19f0c86561 100644 --- a/src/plugins/NEMD/MettDeamonFeedrateDirector.cpp +++ b/src/plugins/NEMD/MettDeamonFeedrateDirector.cpp @@ -17,8 +17,6 @@ #include #include -using namespace std; -using Log::global_log; MettDeamonFeedrateDirector::MettDeamonFeedrateDirector() : @@ -71,7 +69,7 @@ void MettDeamonFeedrateDirector::readXML(XMLfileUnits& xmlconfig) _updateControl.sampledTimestepCount = 0; _updateControl.updateFreq = 1000; xmlconfig.getNodeValue("mirror/control/update_freq", _updateControl.updateFreq); - global_log->info() << "[MettDeamonFeedrateDirector] Update frequency of Mirror = " << _updateControl.updateFreq << endl; + global_log->info() << "[MettDeamonFeedrateDirector] Update frequency of Mirror = " << _updateControl.updateFreq << std::endl; // feedrate _feedrate.init = 0.; @@ -97,17 +95,17 @@ void MettDeamonFeedrateDirector::readXML(XMLfileUnits& xmlconfig) this->csv_str2list(strCSV, _feedrate.list); } #ifndef NDEBUG - cout << "feedrate.list:" << endl; + std::cout << "feedrate.list:" << std::endl; for (std::list::iterator it=_feedrate.list.begin(); it != _feedrate.list.end(); ++it) std::cout << ' ' << *it; - cout << endl; + std::cout << std::endl; #endif // init actual feed rate _feedrate.actual = _feedrate.list.back(); // _forceConstant = 100.; // xmlconfig.getNodeValue("forceConstant", _forceConstant); -// global_log->info() << "MettDeamonFeedrateDirector: force constant = " << _forceConstant << endl; +// global_log->info() << "MettDeamonFeedrateDirector: force constant = " << _forceConstant << std::endl; // restart information _restart.writefreq = 1000; @@ -196,17 +194,17 @@ void MettDeamonFeedrateDirector::calcFeedrate(MettDeamon* mettDeamon) _feedrate.avg = _feedrate.sum * dInvNumvals; #ifndef NDEBUG - cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : feedrate.list: "; + std::cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : feedrate.list: "; for (std::list::iterator it=_feedrate.list.begin(); it != _feedrate.list.end(); ++it) std::cout << " " << *it; - cout << endl; - cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : _particleManipCount.deleted.local.at(cid)=" << _particleManipCount.deleted.local.at(cid) << endl; - cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : _particleManipCount.deleted.global.at(cid)=" << _particleManipCount.deleted.global.at(cid) << endl; - cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : deletedParticlesPerTimestep=" << deletedParticlesPerTimestep << endl; - cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : _feedrate.actual=" << _feedrate.actual << endl; - cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : _feedrate.sum=" << _feedrate.sum << endl; - cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : _feedrate.avg=" << _feedrate.avg << endl; - cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : mettDeamon->getInvDensityArea()=" << mettDeamon->getInvDensityArea() << endl; + std::cout << std::endl; + std::cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : _particleManipCount.deleted.local.at(cid)=" << _particleManipCount.deleted.local.at(cid) << std::endl; + std::cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : _particleManipCount.deleted.global.at(cid)=" << _particleManipCount.deleted.global.at(cid) << std::endl; + std::cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : deletedParticlesPerTimestep=" << deletedParticlesPerTimestep << std::endl; + std::cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : _feedrate.actual=" << _feedrate.actual << std::endl; + std::cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : _feedrate.sum=" << _feedrate.sum << std::endl; + std::cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : _feedrate.avg=" << _feedrate.avg << std::endl; + std::cout << "[MDFD] Rank: " << domainDecomp.getRank() << " : mettDeamon->getInvDensityArea()=" << mettDeamon->getInvDensityArea() << std::endl; #endif } @@ -246,17 +244,17 @@ void MettDeamonFeedrateDirector::writeRestartfile() std::stringstream fnamestream; fnamestream << "MettDeamonFeedrateDirectorRestart" << "_TS" << fill_width('0', 9) << simstep << ".xml"; std::ofstream ofs(fnamestream.str().c_str(), std::ios::out); - ofs << "" << endl; - ofs << "" << endl; - ofs << "\t" << _feedrate.numvals << "" << endl; - ios::fmtflags f( ofs.flags() ); + ofs << "" << std::endl; + ofs << "" << std::endl; + ofs << "\t" << _feedrate.numvals << "" << std::endl; + std::ios::fmtflags f( ofs.flags() ); ofs << "\t" << FORMAT_SCI_MAX_DIGITS_WIDTH_21 << _feedrate.list.front(); std::list::iterator it=_feedrate.list.begin(); for(std::advance(it, 1); it!=_feedrate.list.end(); ++it) ofs << "," << FORMAT_SCI_MAX_DIGITS_WIDTH_21 << *it; - ofs << "" << endl; + ofs << "" << std::endl; ofs.flags(f); // restore default format flags - ofs << "" << endl; + ofs << "" << std::endl; ofs.close(); } } diff --git a/src/plugins/NEMD/RegionSampling.cpp b/src/plugins/NEMD/RegionSampling.cpp index 585ea0b5a9..9d53dfe883 100644 --- a/src/plugins/NEMD/RegionSampling.cpp +++ b/src/plugins/NEMD/RegionSampling.cpp @@ -29,7 +29,6 @@ #define M_PI 3.14159265358979323846 #endif -using namespace std; // init static ID --> instance counting @@ -108,21 +107,21 @@ void SampleRegion::initComponentSpecificParamsVDF() void SampleRegion::showComponentSpecificParamsVDF() { - global_log->info() << ">>>> ComponentSpecificParamsVDF" << endl; - global_log->info() << "-----------------------------------------------------" << endl; + global_log->info() << ">>>> ComponentSpecificParamsVDF" << std::endl; + global_log->info() << "-----------------------------------------------------" << std::endl; uint32_t cid = 0; for(auto&& csp : _vecComponentSpecificParamsVDF) { - global_log->info() << "bSamplingEnabled = " << csp.bSamplingEnabled << endl; - global_log->info() << "dVeloMax = " << csp.dVeloMax << endl; - global_log->info() << "dVelocityClassWidth = " << csp.dVelocityClassWidth << endl; - global_log->info() << "dInvVelocityClassWidth = " << csp.dInvVelocityClassWidth << endl; - global_log->info() << "numVelocityClasses = " << csp.numVelocityClasses << endl; - global_log->info() << "numVals = " << csp.numVals << endl; - global_log->info() << "nOffsetDataStructure = " << csp.nOffsetDataStructure << endl; - global_log->info() << "-----------------------------------------------------" << endl; + global_log->info() << "bSamplingEnabled = " << csp.bSamplingEnabled << std::endl; + global_log->info() << "dVeloMax = " << csp.dVeloMax << std::endl; + global_log->info() << "dVelocityClassWidth = " << csp.dVelocityClassWidth << std::endl; + global_log->info() << "dInvVelocityClassWidth = " << csp.dInvVelocityClassWidth << std::endl; + global_log->info() << "numVelocityClasses = " << csp.numVelocityClasses << std::endl; + global_log->info() << "numVals = " << csp.numVals << std::endl; + global_log->info() << "nOffsetDataStructure = " << csp.nOffsetDataStructure << std::endl; + global_log->info() << "-----------------------------------------------------" << std::endl; } - global_log->info() << "<<<< ComponentSpecificParamsVDF" << endl; + global_log->info() << "<<<< ComponentSpecificParamsVDF" << std::endl; } void SampleRegion::readXML(XMLfileUnits& xmlconfig) @@ -171,7 +170,7 @@ void SampleRegion::readXML(XMLfileUnits& xmlconfig) distControl->registerObserver(this); else { - global_log->error() << "RegionSampling->region["<GetID()<<"]: Initialization of plugin DistControl is needed before! Program exit..." << endl; + global_log->error() << "RegionSampling->region["<GetID()<<"]: Initialization of plugin DistControl is needed before! Program exit..." << std::endl; Simulation::exit(-1); } } @@ -181,9 +180,9 @@ void SampleRegion::readXML(XMLfileUnits& xmlconfig) uint32_t numSamplingModules = 0; XMLfile::Query query = xmlconfig.query("sampling"); numSamplingModules = query.card(); - global_log->info() << "RegionSampling->region["<GetID()-1<<"]: Number of sampling modules: " << numSamplingModules << endl; + global_log->info() << "RegionSampling->region["<GetID()-1<<"]: Number of sampling modules: " << numSamplingModules << std::endl; if(numSamplingModules < 1) { - global_log->error() << "RegionSampling->region["<GetID()-1<<"]: No sampling module parameters specified. Program exit ..." << endl; + global_log->error() << "RegionSampling->region["<GetID()-1<<"]: No sampling module parameters specified. Program exit ..." << std::endl; Simulation::exit(-1); } @@ -202,7 +201,7 @@ void SampleRegion::readXML(XMLfileUnits& xmlconfig) _boolSingleComp = bVal; if(_boolSingleComp) { _numComponents=2; - global_log->info() << "Pretend single component sampling: _numComponents=" << _numComponents << endl; + global_log->info() << "Pretend single component sampling: _numComponents=" << _numComponents << std::endl; } // enable profile sampling _SamplingEnabledProfiles = true; @@ -211,15 +210,15 @@ void SampleRegion::readXML(XMLfileUnits& xmlconfig) xmlconfig.getNodeValue("control/frequency", _writeFrequencyProfiles); xmlconfig.getNodeValue("control/stop", _stopSamplingProfiles); this->setParamProfiles(); - global_log->info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "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('"<setSubdivisionProfiles(nNumSlabs); - global_log->info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<setSubdivisionProfiles(dSlabWidth); - global_log->info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region[" << this->GetID()-1 << "]: Single component enabled ( " << _boolSingleComp << " ) " << endl; + global_log->info() << "RegionSampling->region[" << this->GetID()-1 << "]: Single component enabled ( " << _boolSingleComp << " ) " << std::endl; } else { - global_log->info() << "RegionSampling->region[" << this->GetID()-1 << "]: Single component disabled ( " << _boolSingleComp << " ) " << endl; + global_log->info() << "RegionSampling->region[" << this->GetID()-1 << "]: Single component disabled ( " << _boolSingleComp << " ) " << std::endl; } // velocity dicretization { - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); xmlconfig.changecurrentnode("discretizations"); uint32_t numDiscretizations = 0; XMLfile::Query query_vd = xmlconfig.query("discretization"); numDiscretizations = query_vd.card(); - global_log->info() << "RegionSampling->region["<GetID()-1<<"]: Number of velocity discretizations: " << numDiscretizations << endl; + global_log->info() << "RegionSampling->region["<GetID()-1<<"]: Number of velocity discretizations: " << numDiscretizations << std::endl; if(numDiscretizations < 1) { - global_log->error() << "RegionSampling->region["<GetID()-1<<"]: No velocity discretizations specified for VDF sampling. Program exit ..." << endl; + global_log->error() << "RegionSampling->region["<GetID()-1<<"]: No velocity discretizations specified for VDF sampling. Program exit ..." << std::endl; Simulation::exit(-1); } XMLfile::Query::const_iterator nodeIter; @@ -306,15 +305,15 @@ void SampleRegion::readXML(XMLfileUnits& xmlconfig) uint32_t cid = 0; bool bVal = xmlconfig.getNodeValue("@cid", cid); if( (cid > _numComponents) || ((not bVal) && (not _boolSingleComp)) ){ - global_log->error() << "RegionSampling->region["<GetID()-1<<"]: VDF velocity discretization corrupted. Program exit ..." << endl; + global_log->error() << "RegionSampling->region["<GetID()-1<<"]: VDF velocity discretization corrupted. Program exit ..." << std::endl; Simulation::exit(-1); } if(_boolSingleComp){ cid = 1; - global_log->info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "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('"<setSubdivisionVDF(nNumSlabs); - global_log->info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<setSubdivisionVDF(dSlabWidth); - global_log->info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "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 ..." << endl; + "expected: 2. Program exit ..." << std::endl; Simulation::exit(-1); } - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); XMLfile::Query::const_iterator outputSubdivisionIter; for( outputSubdivisionIter = query_sd.begin(); outputSubdivisionIter != query_sd.end(); outputSubdivisionIter++ ) { @@ -442,12 +441,12 @@ void SampleRegion::readXML(XMLfileUnits& xmlconfig) if("number" == strSubdivisionType) { _nSubdivisionOptFieldYR_Y = SDOPT_BY_NUM_SLABS; bInputIsValid = bInputIsValid && xmlconfig.getNodeValue("number", _nNumBinsFieldYR); - global_log->info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<info() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]->sampling('"<error() << "RegionSampling->region["<GetID()-1<<"]: Wrong attribute 'sampling@type', expected type='profiles|VDF|fieldYR'! Program exit..." << endl; + global_log->error() << "RegionSampling->region["<GetID()-1<<"]: Wrong attribute 'sampling@type', expected type='profiles|VDF|fieldYR'! Program exit..." << std::endl; Simulation::exit(-1); } } // for( outputSamplingIter = query.begin(); outputSamplingIter; outputSamplingIter++ ) @@ -506,7 +505,7 @@ void SampleRegion::prepareSubdivisionProfiles() break; case SDOPT_UNKNOWN: default: - global_log->error() << "tec::ControlRegion::PrepareSubdivisionProfiles(): Unknown subdivision type! Program exit..." << endl; + global_log->error() << "tec::ControlRegion::PrepareSubdivisionProfiles(): Unknown subdivision type! Program exit..." << std::endl; exit(-1); } } @@ -530,7 +529,7 @@ void SampleRegion::prepareSubdivisionVDF() break; case SDOPT_UNKNOWN: default: - global_log->error() << "ERROR in SampleRegion::PrepareSubdivisionVDF(): Unknown subdivision type! Program exit..." << endl; + global_log->error() << "ERROR in SampleRegion::PrepareSubdivisionVDF(): Unknown subdivision type! Program exit..." << std::endl; exit(-1); } } @@ -554,7 +553,7 @@ void SampleRegion::prepareSubdivisionFieldYR() break; case SDOPT_UNKNOWN: default: - global_log->error() << "SampleRegion::PrepareSubdivisionFieldYR(): Unknown subdivision type! Program exit..." << endl; + global_log->error() << "SampleRegion::PrepareSubdivisionFieldYR(): Unknown subdivision type! Program exit..." << std::endl; Simulation::exit(-1); } @@ -573,7 +572,7 @@ void SampleRegion::prepareSubdivisionFieldYR() break; case SDOPT_UNKNOWN: default: - global_log->error() << "SampleRegion::PrepareSubdivisionFieldYR(): Unknown subdivision type! Program exit..." << endl; + global_log->error() << "SampleRegion::PrepareSubdivisionFieldYR(): Unknown subdivision type! Program exit..." << std::endl; Simulation::exit(-1); } } @@ -620,10 +619,10 @@ void SampleRegion::initSamplingProfiles(int nDimension) _nNumValsVector = _nNumValsScalar * 3; // * 3: x, y, z-component #ifndef NDEBUG - cout << "_nNumBinsProfiles = " << _nNumBinsProfiles << endl; - cout << "_numComponents = " << _numComponents << endl; - cout << "_nNumValsScalar = " << _nNumValsScalar << endl; - cout << "_nNumValsVector = " << _nNumValsVector << endl; + std::cout << "_nNumBinsProfiles = " << _nNumBinsProfiles << std::endl; + std::cout << "_numComponents = " << _numComponents << std::endl; + std::cout << "_nNumValsScalar = " << _nNumValsScalar << std::endl; + std::cout << "_nNumValsVector = " << _nNumValsVector << std::endl; #endif // Offsets @@ -825,10 +824,10 @@ void SampleRegion::initSamplingFieldYR(int nDimension) _nNumValsFieldYR = 3ul * _numComponents * _nNumShellsFieldYR * _nNumBinsFieldYR; // *3: number of sections: 0: all, 1: upper, 2: lower section #ifndef NDEBUG - cout << "_numComponents = " << _numComponents << endl; - cout << "_nNumShellsFieldYR = " << _nNumShellsFieldYR << endl; - cout << "_nNumBinsFieldYR = " << _nNumBinsFieldYR << endl; - cout << "_nNumValsFieldYR = " << _nNumValsFieldYR << endl; + std::cout << "_numComponents = " << _numComponents << std::endl; + std::cout << "_nNumShellsFieldYR = " << _nNumShellsFieldYR << std::endl; + std::cout << "_nNumBinsFieldYR = " << _nNumBinsFieldYR << std::endl; + std::cout << "_nNumValsFieldYR = " << _nNumValsFieldYR << std::endl; #endif // Offsets @@ -1619,8 +1618,8 @@ void SampleRegion::writeDataProfiles(DomainDecompBase* domainDecomp, unsigned lo outputstream_vect << " py[" << cid << "]"; outputstream_vect << " pz[" << cid << "]"; } - outputstream_scal << endl; - outputstream_vect << endl; + outputstream_scal << std::endl; + outputstream_vect << std::endl; // data for(uint32_t s=0; s<_nNumBinsProfiles; ++s) @@ -1698,17 +1697,17 @@ void SampleRegion::writeDataProfiles(DomainDecompBase* domainDecomp, unsigned lo outputstream_vect << std::setw(24) << std::scientific << std::setprecision(std::numeric_limits::digits10) << PressureY; outputstream_vect << std::setw(24) << std::scientific << std::setprecision(std::numeric_limits::digits10) << PressureZ; } // loop: cid - outputstream_scal << endl; - outputstream_vect << endl; + outputstream_scal << std::endl; + outputstream_vect << std::endl; } // loop: pos // open file for writing // scalar - ofstream fileout_scal(filenamestream_scal[dir].str().c_str(), ios::out); + std::ofstream fileout_scal(filenamestream_scal[dir].str().c_str(), std::ios::out); fileout_scal << outputstream_scal.str(); fileout_scal.close(); // vector - ofstream fileout_vect(filenamestream_vect[dir].str().c_str(), ios::out); + std::ofstream fileout_vect(filenamestream_vect[dir].str().c_str(), std::ios::out); fileout_vect << outputstream_vect.str(); fileout_vect.close(); } // loop: dir @@ -1788,11 +1787,11 @@ void SampleRegion::writeDataVDF(DomainDecompBase* domainDecomp, unsigned long si sstrFilename[fi] << _fnamePrefixVDF << "_reg" << this->GetID() << "_cid" << cid << strSubPrefixes.at(fi) << "_TS" << fill_width('0', 9) << simstep << ".dat"; // write to string streams - sstrOutput[numFiles-1] << " classes_cid" << cid << endl; + sstrOutput[numFiles-1] << " classes_cid" << cid << std::endl; for(auto&& dvv : csp.dDiscreteVelocityValues) { sstrOutput[numFiles-1] << std::setw(24) << std::scientific << std::setprecision(std::numeric_limits::digits10) << dvv; - sstrOutput[numFiles-1] << endl; + sstrOutput[numFiles-1] << std::endl; } // loop over vdf data structures @@ -1815,7 +1814,7 @@ void SampleRegion::writeDataVDF(DomainDecompBase* domainDecomp, unsigned long si // write to file streams for(uint8_t fi=0; fiGetID() << "_bin_coords" << "_TS" << fill_width('0', 9) << simstep << ".dat"; // write to string stream - sstrOutput << " coords" << endl; + sstrOutput << " coords" << std::endl; for(auto&& bmp : _dBinMidpointsVDF) { sstrOutput << std::setw(24) << std::scientific << std::setprecision(std::numeric_limits::digits10) << bmp; - sstrOutput << endl; + sstrOutput << std::endl; } // write to file stream - ofstream ofs(sstrFilename.str().c_str(), ios::out); + std::ofstream ofs(sstrFilename.str().c_str(), std::ios::out); ofs << sstrOutput.str(); ofs.close(); } @@ -1887,9 +1886,9 @@ void SampleRegion::writeDataFieldYR(DomainDecompBase* domainDecomp, unsigned lon mardyn_assert( (nOffset+bi) < _nNumValsFieldYR ); outputstream << FORMAT_SCI_MAX_DIGITS << _dDensityFieldYR[nOffset+bi]; } - outputstream << endl; + outputstream << std::endl; } - ofstream fileout(filenamestream.str().c_str(), std::ios::out); + std::ofstream fileout(filenamestream.str().c_str(), std::ios::out); fileout << outputstream.str(); fileout.close(); } @@ -1907,7 +1906,7 @@ void SampleRegion::writeDataFieldYR(DomainDecompBase* domainDecomp, unsigned lon outputstream.write(reinterpret_cast(&dVal), 8); } } - ofstream fileout(filenamestream.str().c_str(), std::ios::out | std::ios::binary); + std::ofstream fileout(filenamestream.str().c_str(), std::ios::out | std::ios::binary); fileout << outputstream.str(); fileout.close(); } @@ -2045,12 +2044,12 @@ void RegionSampling::readXML(XMLfileUnits& xmlconfig) uint32_t nRegID = 0; XMLfile::Query query = xmlconfig.query("region"); numRegions = query.card(); - global_log->info() << "RegionSampling: Number of sampling regions: " << numRegions << endl; + global_log->info() << "RegionSampling: Number of sampling regions: " << numRegions << std::endl; if(numRegions < 1) { - global_log->warning() << "RegionSampling: No region parameters specified. Program exit ..." << endl; + global_log->warning() << "RegionSampling: No region parameters specified. Program exit ..." << std::endl; Simulation::exit(-1); } - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); XMLfile::Query::const_iterator outputRegionIter; for( outputRegionIter = query.begin(); outputRegionIter; outputRegionIter++ ) { diff --git a/src/plugins/NEMD/VelocityExchange.cpp b/src/plugins/NEMD/VelocityExchange.cpp index dfaa05895a..62198a897c 100644 --- a/src/plugins/NEMD/VelocityExchange.cpp +++ b/src/plugins/NEMD/VelocityExchange.cpp @@ -77,18 +77,18 @@ void VelocityExchange::readXML(XMLfileUnits& xmlconfig) { global_log->info() << "[VelocityExchange] Cold region:" << " x = " << _cold_region.min[0] << " - " << _cold_region.max[0] << " ;" << " y = " << _cold_region.min[1] << " - " << _cold_region.max[1] << " ;" - << " z = " << _cold_region.min[2] << " - " << _cold_region.max[2] << endl; + << " z = " << _cold_region.min[2] << " - " << _cold_region.max[2] << std::endl; global_log->info() << "[VelocityExchange] Warm region" << ((_symmetry) ? " (left)" : "") << ":" << " x = " << _warm_region.min[0] << " - " << _warm_region.max[0] << " ;" << " y = " << _warm_region.min[1] << " - " << _warm_region.max[1] << " ;" - << " z = " << _warm_region.min[2] << " - " << _warm_region.max[2] << endl; + << " z = " << _warm_region.min[2] << " - " << _warm_region.max[2] << std::endl; if (_symmetry) { global_log->info() << "[VelocityExchange] Warm region (right):" << " x = " << _warm_region.min[0] << " - " << _warm_region.max[0] << " ;" << " y = " << _boxLength[1]-_warm_region.max[1] << " - " << _boxLength[1]-_warm_region.min[1] << " ;" - << " z = " << _warm_region.min[2] << " - " << _warm_region.max[2] << endl; + << " z = " << _warm_region.min[2] << " - " << _warm_region.max[2] << std::endl; } } diff --git a/src/plugins/Permittivity.cpp b/src/plugins/Permittivity.cpp index a91be5df67..f8b0fba406 100644 --- a/src/plugins/Permittivity.cpp +++ b/src/plugins/Permittivity.cpp @@ -20,8 +20,8 @@ void Permittivity::readXML(XMLfileUnits& xmlconfig) { void Permittivity::init(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain) { _totalNumTimeSteps = _simulation.getNumTimesteps(); - global_log->warning() << "Permittivity is being sampled. Using slab thermostat is not recommended" << endl; - global_log->info() << "Number of blocks for calculation of permittivity: "<<_numOutputs << endl; + global_log->warning() << "Permittivity is being sampled. Using slab thermostat is not recommended" << std::endl; + global_log->info() << "Number of blocks for calculation of permittivity: "<<_numOutputs << std::endl; _readStartingStep = false; _currentOutputNum = 0; _accumulatedSteps = 1; @@ -30,7 +30,7 @@ void Permittivity::init(ParticleContainer* particleContainer, DomainDecompBase* _MSquaredRAV = 0.; _RAVCounter = 0; - string permName = _outputPrefix + ".permRAV"; + std::string permName = _outputPrefix + ".permRAV"; int mpi_rank = domainDecomp->getRank(); if (mpi_rank == 0) { _ravStream.open(permName.c_str(), std::ios::app); @@ -71,7 +71,7 @@ void Permittivity::init(ParticleContainer* particleContainer, DomainDecompBase* bool orientationIsCorrect = ci.dipole(0).e() == std::array{0,0,1}; _myAbs[i] = ci.dipole(0).abs(); if(not orientationIsCorrect){ - global_log->error() << "Wrong dipole vector chosen! Please always choose [eMyx eMyy eMyz] = [0 0 1] when using the permittivity plugin" << endl; + global_log->error() << "Wrong dipole vector chosen! Please always choose [eMyx eMyy eMyz] = [0 0 1] when using the permittivity plugin" << std::endl; } } } @@ -125,7 +125,7 @@ void Permittivity::writeRunningAverage(unsigned long indexM, double tempMX, doub double permTemp = 1. + 4. * M_PI * tempMSquared / (_runningAverageSteps * 3. * _T * _V); _ravStream << timestep << "\t" << RAVsteps << "\t" << _globalM[indexM][0] << "\t" << _globalM[indexM][1] << "\t" << _globalM[indexM][2] << "\t" << MsquaredInst << "\t" << permInst << "\t" << tempMX / (double)(_runningAverageSteps) << "\t" << tempMY / (double)(_runningAverageSteps) << "\t" << tempMZ / (double)(_runningAverageSteps) << "\t" - << tempMSquared / (double)(_runningAverageSteps) << "\t" << permTemp << "\t" << M[0] << "\t" << M[1] << "\t" << M[2] << "\t" << Msquared << "\t" << perm << endl; + << tempMSquared / (double)(_runningAverageSteps) << "\t" << permTemp << "\t" << M[0] << "\t" << M[1] << "\t" << M[2] << "\t" << Msquared << "\t" << perm << std::endl; } void Permittivity::collect(DomainDecompBase* domainDecomp) { @@ -209,8 +209,8 @@ void Permittivity::endStep(ParticleContainer* particleContainer, DomainDecompBas _startingStep = simstep; // the original simulation is then simply continued if (_startingStep <= 1) { _numOutputs = (unsigned int)ceil(((double)_totalNumTimeSteps - (double)_initStatistics)/ (double)_writeFrequency); - _ravStream << "//Output generated by Permittivity plugin\n" << endl; - _ravStream << "time steps\trecording steps\tMx_inst\tMy_inst\tMz_inst\tMsquared_inst\tperm_inst\tMx_temp\tMy_temp\tMz_temp\tMsquared_temp\tperm_temp\tMx_rav\tMy_rav\tMz_rav\tMsquared_rav\tperm_rav\t" << endl; + _ravStream << "//Output generated by Permittivity plugin\n" << std::endl; + _ravStream << "time steps\trecording steps\tMx_inst\tMy_inst\tMz_inst\tMsquared_inst\tperm_inst\tMx_temp\tMy_temp\tMz_temp\tMsquared_temp\tperm_temp\tMx_rav\tMy_rav\tMz_rav\tMsquared_rav\tperm_rav\t" << std::endl; } else { _numOutputs = (unsigned int)ceil(((double)_totalNumTimeSteps - (double)_startingStep)/ (double)_writeFrequency); @@ -260,15 +260,15 @@ void Permittivity::output(Domain* domain, unsigned long timestep) { else { writeInit = floor((double)_initStatistics / (double)_writeFrequency); } - string prefix; - ostringstream osstrm; + std::string prefix; + std::ostringstream osstrm; osstrm << _outputPrefix; - osstrm << right << _startingStep; + osstrm << std::right << _startingStep; prefix = osstrm.str(); osstrm.str(""); osstrm.clear(); - string permName = prefix + ".perm"; - ofstream writer(permName.c_str()); + std::string permName = prefix + ".perm"; + std::ofstream writer(permName.c_str()); writer.precision(7); writer << "//Output generated by Permittivity plugin\n" @@ -309,7 +309,7 @@ void Permittivity::output(Domain* domain, unsigned long timestep) { // Permittivity as total simulation average (i.e. NOT block average) double permittivityTotal = 1. + 4. * M_PI /(3. * _T * _V) * (_totalAverageSquaredM / ((double)_numOutputs - correctionFirstBlock)- (_totalAverageM[0] * _totalAverageM[0] + _totalAverageM[1] * _totalAverageM[1] + _totalAverageM[2] * _totalAverageM[2]) / (((double)_numOutputs - correctionFirstBlock) * ((double)_numOutputs - correctionFirstBlock))); double permittivityTotal2 = 1. + 4. * M_PI /(3. * _T * _V) * (_totalAverageSquaredM / ((double)_numOutputs - correctionFirstBlock)); - writer << "\n\n epsilon_total = " << permittivityTotal <<"\tepsilon_total2 = " << permittivityTotal2<<"\t epsilon_avg = "<< averagePermittivity / ((double)_numOutputs - correctionFirstBlock) <<"\tepsilon_avg2 = " << averagePermittivity2 / ((double)_numOutputs - correctionFirstBlock)<<"\tT = " << _T << "\tV = " << _V << "\t = " << _totalAverageSquaredM / ((double)_numOutputs - correctionFirstBlock) <<"\t2 = " << (_totalAverageM[0] * _totalAverageM[0] + _totalAverageM[1] * _totalAverageM[1] + _totalAverageM[2] * _totalAverageM[2]) / (((double)_numOutputs - correctionFirstBlock) * ((double)_numOutputs - correctionFirstBlock)) << endl; + writer << "\n\n epsilon_total = " << permittivityTotal <<"\tepsilon_total2 = " << permittivityTotal2<<"\t epsilon_avg = "<< averagePermittivity / ((double)_numOutputs - correctionFirstBlock) <<"\tepsilon_avg2 = " << averagePermittivity2 / ((double)_numOutputs - correctionFirstBlock)<<"\tT = " << _T << "\tV = " << _V << "\t = " << _totalAverageSquaredM / ((double)_numOutputs - correctionFirstBlock) <<"\t2 = " << (_totalAverageM[0] * _totalAverageM[0] + _totalAverageM[1] * _totalAverageM[1] + _totalAverageM[2] * _totalAverageM[2]) / (((double)_numOutputs - correctionFirstBlock) * ((double)_numOutputs - correctionFirstBlock)) << std::endl; writer.close(); _ravStream.close(); } diff --git a/src/plugins/PluginFactory.cpp b/src/plugins/PluginFactory.cpp index 89d0cbd027..b29a00bbe0 100644 --- a/src/plugins/PluginFactory.cpp +++ b/src/plugins/PluginFactory.cpp @@ -79,7 +79,7 @@ */ template <> void PluginFactory::registerDefaultPlugins() { - global_log->debug() << "REGISTERING PLUGINS" << endl; + global_log->debug() << "REGISTERING PLUGINS" << std::endl; #ifdef ENABLE_ADIOS2 REGISTER_PLUGIN(Adios2Writer); @@ -144,32 +144,32 @@ void PluginFactory::registerDefaultPlugins() { template <> long PluginFactory::enablePlugins(std::list& _plugins, XMLfileUnits& xmlconfig, std::string category, Domain* _domain) { - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); // plugins long numPlugins = 0; XMLfile::Query query = xmlconfig.query(category); numPlugins = query.card(); - global_log->info() << "Number of plugins with tag " << category << ": " << numPlugins << endl; + global_log->info() << "Number of plugins with tag " << category << ": " << numPlugins << std::endl; if (numPlugins < 1) { - global_log->warning() << "No plugins specified for tag " << category << "." << endl; + global_log->warning() << "No plugins specified for tag " << category << "." << std::endl; } for (auto pluginIter = query.begin(); pluginIter; ++pluginIter) { xmlconfig.changecurrentnode(pluginIter); - string pluginname(""); + std::string pluginname(""); xmlconfig.getNodeValue("@name", pluginname); bool enabled = true; xmlconfig.getNodeValue("@enabled", enabled); if (not enabled) { - global_log->debug() << "skipping disabled plugin: " << pluginname << endl; + global_log->debug() << "skipping disabled plugin: " << pluginname << std::endl; continue; } - global_log->info() << "Enabling plugin: " << pluginname << endl; + global_log->info() << "Enabling plugin: " << pluginname << std::endl; PluginBase* plugin = this->create(pluginname); if (plugin == nullptr) { - global_log->warning() << "Could not create plugin using factory: " << pluginname << endl; + global_log->warning() << "Could not create plugin using factory: " << pluginname << std::endl; } //@TODO: add plugin specific functions @@ -185,7 +185,7 @@ long PluginFactory::enablePlugins(std::list& _plugins, plugin = new MmpldWriterMultiSphere(); } else { global_log->error() << "[MMPLD Writer] Unknown sphere representation type: " << sphere_representation - << endl; + << std::endl; Simulation::exit(-1); } } else if (pluginname == "DomainProfiles") { @@ -198,7 +198,7 @@ long PluginFactory::enablePlugins(std::list& _plugins, plugin->readXML(xmlconfig); _plugins.push_back(plugin); } else { - global_log->warning() << "Unknown plugin " << pluginname << endl; + global_log->warning() << "Unknown plugin " << pluginname << std::endl; } } diff --git a/src/plugins/SpatialProfile.cpp b/src/plugins/SpatialProfile.cpp index 6d42f74640..f948e27f7c 100644 --- a/src/plugins/SpatialProfile.cpp +++ b/src/plugins/SpatialProfile.cpp @@ -22,13 +22,13 @@ void SpatialProfile::readXML(XMLfileUnits& xmlconfig) { global_log->debug() << "[SpatialProfile] enabled" << std::endl; xmlconfig.getNodeValue("writefrequency", _writeFrequency); - global_log->info() << "[SpatialProfile] Write frequency: " << _writeFrequency << endl; + global_log->info() << "[SpatialProfile] Write frequency: " << _writeFrequency << std::endl; xmlconfig.getNodeValue("outputprefix", _outputPrefix); - global_log->info() << "[SpatialProfile] Output prefix: " << _outputPrefix << endl; + global_log->info() << "[SpatialProfile] Output prefix: " << _outputPrefix << std::endl; xmlconfig.getNodeValue("mode", _mode); - global_log->info() << "[SpatialProfile] Mode " << _mode << endl; + global_log->info() << "[SpatialProfile] Mode " << _mode << std::endl; xmlconfig.getNodeValue("profiledComponent", _profiledCompString); - global_log->info() << "[SpatialProfile] Profiled Component:" << _profiledCompString << endl; + global_log->info() << "[SpatialProfile] Profiled Component:" << _profiledCompString << std::endl; if (_profiledCompString != "all") { _profiledComp = std::stoi(_profiledCompString); @@ -45,7 +45,7 @@ void SpatialProfile::readXML(XMLfileUnits& xmlconfig) { xmlconfig.getNodeValue("z", samplInfo.universalProfileUnit[2]); samplInfo.cylinder = false; } else { - global_log->error() << "[SpatialProfile] Invalid mode. cylinder/cartesian" << endl; + global_log->error() << "[SpatialProfile] Invalid mode. cylinder/cartesian" << std::endl; Simulation::exit(-1); } @@ -127,9 +127,9 @@ void SpatialProfile::readXML(XMLfileUnits& xmlconfig) { } xmlconfig.getNodeValue("timesteps/init", _initStatistics); - global_log->info() << "[SpatialProfile] init statistics: " << _initStatistics << endl; + global_log->info() << "[SpatialProfile] init statistics: " << _initStatistics << std::endl; xmlconfig.getNodeValue("timesteps/recording", _profileRecordingTimesteps); - global_log->info() << "[SpatialProfile] profile recording timesteps: " << _profileRecordingTimesteps << endl; + global_log->info() << "[SpatialProfile] profile recording timesteps: " << _profileRecordingTimesteps << std::endl; } @@ -157,7 +157,7 @@ void SpatialProfile::init(ParticleContainer* particleContainer, DomainDecompBase } else { samplInfo.numMolFixRegion = 0; } - global_log->info() << "getDomain was called with Molecules in Fix Region: " << samplInfo.numMolFixRegion << endl; + global_log->info() << "getDomain was called with Molecules in Fix Region: " << samplInfo.numMolFixRegion << std::endl; // Calculate sampling units if (samplInfo.cylinder) { diff --git a/src/plugins/TestPlugin.h b/src/plugins/TestPlugin.h index 26789c5c1f..ca85fde933 100755 --- a/src/plugins/TestPlugin.h +++ b/src/plugins/TestPlugin.h @@ -26,7 +26,7 @@ class TestPlugin: public PluginBase { } void readXML(XMLfileUnits& xmlconfig) { - global_log -> debug() << "[TESTPLUGIN] READING XML" << endl; + global_log -> debug() << "[TESTPLUGIN] READING XML" << std::endl; } /** @brief Method will be called first thing in a new timestep. */ @@ -34,7 +34,7 @@ class TestPlugin: public PluginBase { ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, unsigned long simstep ) { - global_log -> debug() << "[TESTPLUGIN] BEFORE EVENT NEW TIMESTEP" << endl; + global_log -> debug() << "[TESTPLUGIN] BEFORE EVENT NEW TIMESTEP" << std::endl; }; /** @brief Method beforeForces will be called before forcefields have been applied @@ -46,7 +46,7 @@ class TestPlugin: public PluginBase { ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, unsigned long simstep ) { - global_log -> debug() << "[TESTPLUGIN] BEFORE FORCES" << endl; + global_log -> debug() << "[TESTPLUGIN] BEFORE FORCES" << std::endl; } /** @brief Method afterForces will be called after forcefields have been applied @@ -57,7 +57,7 @@ class TestPlugin: public PluginBase { ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, unsigned long simstep ) { - global_log->debug() << "[TESTPLUGIN] TESTPLUGIN AFTER FORCES" << endl; + global_log->debug() << "[TESTPLUGIN] TESTPLUGIN AFTER FORCES" << std::endl; } /** @brief Method endStep will be called at the end of each time step. @@ -72,7 +72,7 @@ class TestPlugin: public PluginBase { ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain, unsigned long simstep ) { - global_log->debug() << "[TESTPLUGIN] ENDSTEP" << endl; + global_log->debug() << "[TESTPLUGIN] ENDSTEP" << std::endl; } /** @brief Method finalOutput will be called at the end of the simulation @@ -85,15 +85,15 @@ class TestPlugin: public PluginBase { */ void finish(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain) { - global_log->debug() << "[TESTPLUGIN] FINISHING" << endl; + global_log->debug() << "[TESTPLUGIN] FINISHING" << std::endl; } /** @brief return the name of the plugin */ std::string getPluginName() { - global_log->debug() << "[TESTPLUGIN] GETTING NAME" << endl; + global_log->debug() << "[TESTPLUGIN] GETTING NAME" << std::endl; return "TestPlugin";} static PluginBase* createInstance() { - global_log->debug() << "[TESTPLUGIN] CREATE INSTANCE" << endl; + global_log->debug() << "[TESTPLUGIN] CREATE INSTANCE" << std::endl; return new TestPlugin(); } private: diff --git a/src/plugins/VectorizationTuner.cpp b/src/plugins/VectorizationTuner.cpp index 34a6779228..5936aaba46 100644 --- a/src/plugins/VectorizationTuner.cpp +++ b/src/plugins/VectorizationTuner.cpp @@ -33,7 +33,7 @@ void VectorizationTuner::readXML(XMLfileUnits& xmlconfig) { } else if (mode == "file") { vtWriter.reset(new VTWriter()); } else { - global_log->error() << R"(Unknown FlopRateOutputPlugin::mode. Choose "stdout" or "file".)" << endl; + global_log->error() << R"(Unknown FlopRateOutputPlugin::mode. Choose "stdout" or "file".)" << std::endl; Simulation::exit(1); } @@ -62,7 +62,7 @@ void VectorizationTuner::readXML(XMLfileUnits& xmlconfig) { } else { global_log->error() << R"(Unknown FlopRateOutputPlugin::moleculecntincreasetype. Choose "linear" or "exponential" or "both".)" - << endl; + << std::endl; Simulation::exit(798123); } global_log->info() << "Molecule count increase type: " << incTypeStr << std::endl; @@ -91,19 +91,19 @@ void VectorizationTuner::finish(ParticleContainer * /*particleContainer*/, void VectorizationTuner::writeFile(const TunerLoad& vecs){ int rank = global_simulation->domainDecomposition().getRank(); - ofstream myfile; - string resultfile(_outputPrefix + '.' + std::to_string(rank) + ".VT.data"); + std::ofstream myfile; + std::string resultfile(_outputPrefix + '.' + std::to_string(rank) + ".VT.data"); global_log->info() << "VT: Writing to file " << resultfile << std::endl; - myfile.open(resultfile.c_str(), ofstream::out | ofstream::trunc); + myfile.open(resultfile.c_str(), std::ofstream::out | std::ofstream::trunc); TunerLoad::write(myfile, vecs); } bool VectorizationTuner::readFile(TunerLoad& times) { - ifstream myfile; + std::ifstream myfile; int rank = global_simulation->domainDecomposition().getRank(); - string resultfile(_outputPrefix + '.' + std::to_string(rank) + ".VT.data"); + std::string resultfile(_outputPrefix + '.' + std::to_string(rank) + ".VT.data"); global_log->info() << "VT: Reading from file " << resultfile << std::endl; - myfile.open(resultfile.c_str(), ifstream::in); + myfile.open(resultfile.c_str(), std::ifstream::in); if(!myfile.good()){ return false; } @@ -754,11 +754,11 @@ void VectorizationTuner::init(ParticleContainer *particleContainer, DomainDecomp void VectorizationTuner::VTWriter::initWrite(const std::string& outputPrefix, double cutoffRadius, double LJCutoffRadius, double cutoffRadiusBig, double LJCutoffRadiusBig) { - string resultfile(outputPrefix + ".VT.csv"); + std::string resultfile(outputPrefix + ".VT.csv"); global_log->info() << "VT: Writing to file " << resultfile << std::endl; _rank = global_simulation->domainDecomposition().getRank(); if (_rank == 0) { - _myfile.open(resultfile.c_str(), ofstream::out | ofstream::trunc); + _myfile.open(resultfile.c_str(), std::ofstream::out | std::ofstream::trunc); _myfile << "Vectorization Tuner File" << std::endl << "The Cutoff Radii were: " << std::endl << "NormalRc=" << cutoffRadius << " , LJCutoffRadiusNormal=" << LJCutoffRadius << std::endl << "BigRC=" << cutoffRadiusBig << " , BigLJCR=" << LJCutoffRadiusBig << std::endl; diff --git a/src/plugins/VectorizationTuner.h b/src/plugins/VectorizationTuner.h index 81e9863379..cc5e5dabbd 100644 --- a/src/plugins/VectorizationTuner.h +++ b/src/plugins/VectorizationTuner.h @@ -270,7 +270,7 @@ class VectorizationTuner: public PluginBase { double gflopsOwnZero, double gflopsPairZero) override; void close() override; private: - ofstream _myfile; + std::ofstream _myfile; }; class VTWriterStatistics: public VTWriterI { diff --git a/src/plugins/WallPotential.cpp b/src/plugins/WallPotential.cpp index f2d85265d5..1c573055d9 100755 --- a/src/plugins/WallPotential.cpp +++ b/src/plugins/WallPotential.cpp @@ -22,7 +22,7 @@ void WallPotential::readXML(XMLfileUnits &xmlconfig) { _dWidthHalf = _dWidth * 0.5; global_log->info() << "[WallPotential] Using plugin with parameters: density=" << density << ", sigma=" << sigma << ", epsilon=" << epsilon << ", yoff=" << yoff << ", ycut=" << ycut << ", width=" << _dWidth - << ", delta=" << _delta << endl; + << ", delta=" << _delta << std::endl; int potential; xmlconfig.getNodeValue("potential", potential); @@ -42,7 +42,7 @@ void WallPotential::readXML(XMLfileUnits &xmlconfig) { XMLfile::Query query = xmlconfig.query("component"); unsigned int numComponentsConsidered = query.card(); - global_log->info() << "[WallPotential] Setting parameters 'xi', 'eta' for " << numComponentsConsidered << " components." << endl; + global_log->info() << "[WallPotential] Setting parameters 'xi', 'eta' for " << numComponentsConsidered << " components." << std::endl; std::vector* components = global_simulation->getEnsemble()->getComponents(); unsigned int numComponents = components->size(); @@ -59,7 +59,7 @@ void WallPotential::readXML(XMLfileUnits &xmlconfig) { for (auto &&bi : _bConsiderComponent) bi = false; - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); XMLfile::Query::const_iterator componentIter; for (componentIter = query.begin(); componentIter; componentIter++) { xmlconfig.changecurrentnode(componentIter); @@ -77,11 +77,11 @@ void WallPotential::readXML(XMLfileUnits &xmlconfig) { if(_potential == LJ9_3){ this->initializeLJ93(components, density, sigma, epsilon, xi_sf, eta_sf, yoff, ycut); - global_log->info() << "[WallPotential] LJ9_3 initialized." << endl; + global_log->info() << "[WallPotential] LJ9_3 initialized." << std::endl; } else if(_potential == LJ10_4){ this->initializeLJ1043(components, density, sigma, epsilon, xi_sf, eta_sf, yoff, ycut); - global_log->info() << "[WallPotential] LJ10_4 initialized." << endl; + global_log->info() << "[WallPotential] LJ10_4 initialized." << std::endl; } else{ global_log -> error() << "[WallPotential] UNKNOWN WALL POTENTIAL! EXITING!" << std::endl; @@ -149,7 +149,7 @@ void WallPotential::initializeLJ1043(const std::vector *components, std::vector in_eta, double in_yOffWall, double in_yWallCut) { - global_log->info() << "[WallPotential] Initializing the wall function LJ-10-4-3 with " << _nc << " components.\n" << endl; + global_log->info() << "[WallPotential] Initializing the wall function LJ-10-4-3 with " << _nc << " components.\n" << std::endl; this->_rhoW = in_rhoWall; this->_yc = in_yWallCut; @@ -355,14 +355,14 @@ void WallPotential::siteWiseForces(ParticleContainer *particleContainer, DomainD return; } if(_potential == LJ9_3){ - //global_log->debug() << "[WallPotential] LJ9_3 afterForces." << endl; + //global_log->debug() << "[WallPotential] LJ9_3 afterForces." << std::endl; this->calcTSLJ_9_3(particleContainer); - //global_log->debug() << "[WallPotential] LJ9_3 applied." << endl; + //global_log->debug() << "[WallPotential] LJ9_3 applied." << std::endl; } else if(_potential == LJ10_4){ - //global_log->debug() << "[WallPotential] LJ10_4 afterForces. " << endl; + //global_log->debug() << "[WallPotential] LJ10_4 afterForces. " << std::endl; this->calcTSLJ_10_4(particleContainer); - //global_log->debug() << "[WallPotential] LJ10_4 applied." << endl; + //global_log->debug() << "[WallPotential] LJ10_4 applied." << std::endl; } } \ No newline at end of file diff --git a/src/plugins/WallPotential.h b/src/plugins/WallPotential.h index 6b2a4d05c3..b51e7f23a9 100755 --- a/src/plugins/WallPotential.h +++ b/src/plugins/WallPotential.h @@ -111,11 +111,11 @@ class WallPotential : public PluginBase{ static PluginBase* createInstance(){return new WallPotential();} - void initializeLJ93(const vector *components, double in_rhoWall, double in_sigWall, double in_epsWall, - vector in_xi, vector in_eta, double in_yOffWall, double in_yWallCut); + void initializeLJ93(const std::vector *components, double in_rhoWall, double in_sigWall, double in_epsWall, + std::vector in_xi, std::vector in_eta, double in_yOffWall, double in_yWallCut); - void initializeLJ1043(const vector *components, double in_rhoWall, double in_sigWall, double in_epsWall, - vector in_xi, vector in_eta, double in_yOffWall, double in_yWallCut); + void initializeLJ1043(const std::vector *components, double in_rhoWall, double in_sigWall, double in_epsWall, + std::vector in_xi, std::vector in_eta, double in_yOffWall, double in_yWallCut); void calcTSLJ_9_3(ParticleContainer *partContainer); diff --git a/src/plugins/profiles/DOFProfile.cpp b/src/plugins/profiles/DOFProfile.cpp index 4238358ede..4e52f6bc58 100644 --- a/src/plugins/profiles/DOFProfile.cpp +++ b/src/plugins/profiles/DOFProfile.cpp @@ -4,10 +4,10 @@ #include "DOFProfile.h" -void DOFProfile::output(string prefix, long unsigned accumulatedDatasets) { +void DOFProfile::output(std::string prefix, long unsigned accumulatedDatasets) { global_log->debug() << "[DOFProfile] has no output.\n"; } -void DOFProfile::writeDataEntry(unsigned long uID, ofstream &outfile) const { +void DOFProfile::writeDataEntry(unsigned long uID, std::ofstream &outfile) const { global_log->debug() << "[DOFProfile] has no writeDataEntry.\n"; } diff --git a/src/plugins/profiles/DOFProfile.h b/src/plugins/profiles/DOFProfile.h index b80b7e6fae..ebf3212d6a 100644 --- a/src/plugins/profiles/DOFProfile.h +++ b/src/plugins/profiles/DOFProfile.h @@ -24,7 +24,7 @@ class DOFProfile final : public ProfileBase { void collectRetrieve(DomainDecompBase *domainDecomp, unsigned long uID) final { _globalProfile[uID] = domainDecomp->collCommGetInt(); } - void output(string prefix, long unsigned accumulatedDatasets) final; + void output(std::string prefix, long unsigned accumulatedDatasets) final; void reset(unsigned long uID) final { _localProfile[uID] = 0; _globalProfile[uID] = 0; @@ -41,7 +41,7 @@ class DOFProfile final : public ProfileBase { // Global 1D Profile std::map _globalProfile; - void writeDataEntry(unsigned long uID, ofstream &outfile) const final; + void writeDataEntry(unsigned long uID, std::ofstream &outfile) const final; }; diff --git a/src/plugins/profiles/DensityProfile.cpp b/src/plugins/profiles/DensityProfile.cpp index 428ed832e4..92bcb8ba4a 100644 --- a/src/plugins/profiles/DensityProfile.cpp +++ b/src/plugins/profiles/DensityProfile.cpp @@ -5,13 +5,13 @@ #include "DensityProfile.h" -void DensityProfile::output(string prefix, long unsigned accumulatedDatasets) { +void DensityProfile::output(std::string prefix, long unsigned accumulatedDatasets) { global_log->info() << "[DensityProfile] output" << std::endl; // Setup outfile _accumulatedDatasets = accumulatedDatasets; _profilePrefix = prefix + ".NDpr"; - ofstream outfile(_profilePrefix.c_str()); + std::ofstream outfile(_profilePrefix.c_str()); outfile.precision(6); // Write Header @@ -32,6 +32,6 @@ void DensityProfile::output(string prefix, long unsigned accumulatedDatasets) { outfile.close(); } -void DensityProfile::writeDataEntry (unsigned long uID, ofstream& outfile) const { +void DensityProfile::writeDataEntry (unsigned long uID, std::ofstream& outfile) const { outfile << (double) this->_globalProfile.at(uID) / (_samplInfo.segmentVolume * _accumulatedDatasets) << "\t"; } diff --git a/src/plugins/profiles/DensityProfile.h b/src/plugins/profiles/DensityProfile.h index eb6751ae73..f558612f29 100644 --- a/src/plugins/profiles/DensityProfile.h +++ b/src/plugins/profiles/DensityProfile.h @@ -23,7 +23,7 @@ class DensityProfile final : public ProfileBase { void collectRetrieve(DomainDecompBase *domainDecomp, unsigned long uID) final { _globalProfile[uID] = domainDecomp->collCommGetInt(); } - void output(string prefix, long unsigned accumulatedDatasets) final; + void output(std::string prefix, long unsigned accumulatedDatasets) final; void reset(unsigned long uID) final { _localProfile[uID] = 0; _globalProfile[uID] = 0; @@ -40,7 +40,7 @@ class DensityProfile final : public ProfileBase { // Global 1D Profile std::map _globalProfile; - void writeDataEntry(unsigned long uID, ofstream &outfile) const final; + void writeDataEntry(unsigned long uID, std::ofstream &outfile) const final; }; diff --git a/src/plugins/profiles/KineticProfile.cpp b/src/plugins/profiles/KineticProfile.cpp index fc325d5890..9674838cf3 100644 --- a/src/plugins/profiles/KineticProfile.cpp +++ b/src/plugins/profiles/KineticProfile.cpp @@ -4,10 +4,10 @@ #include "KineticProfile.h" -void KineticProfile::output(string prefix, long unsigned accumulatedDatasets) { +void KineticProfile::output(std::string prefix, long unsigned accumulatedDatasets) { global_log->info() << "[KineticProfile] has no output.\n"; } -void KineticProfile::writeDataEntry(unsigned long uID, ofstream &outfile) const { +void KineticProfile::writeDataEntry(unsigned long uID, std::ofstream &outfile) const { global_log->debug() << "[KineticProfile] has no writeDataEntry.\n"; } diff --git a/src/plugins/profiles/KineticProfile.h b/src/plugins/profiles/KineticProfile.h index 956d011ec8..7bd0b84f1a 100644 --- a/src/plugins/profiles/KineticProfile.h +++ b/src/plugins/profiles/KineticProfile.h @@ -26,7 +26,7 @@ class KineticProfile final : public ProfileBase { void collectRetrieve(DomainDecompBase *domainDecomp, unsigned long uID) final { _globalProfile[uID] = domainDecomp->collCommGetDouble(); } - void output(string prefix, long unsigned accumulatedDatasets) final; + void output(std::string prefix, long unsigned accumulatedDatasets) final; void reset(unsigned long uID) final { _localProfile[uID] = 0.0; _globalProfile[uID] = 0.0; @@ -43,7 +43,7 @@ class KineticProfile final : public ProfileBase { // Global 1D Profile std::map _globalProfile; - void writeDataEntry(unsigned long uID, ofstream &outfile) const final; + void writeDataEntry(unsigned long uID, std::ofstream &outfile) const final; }; diff --git a/src/plugins/profiles/ProfileBase.cpp b/src/plugins/profiles/ProfileBase.cpp index 20d7ff2287..3169916679 100644 --- a/src/plugins/profiles/ProfileBase.cpp +++ b/src/plugins/profiles/ProfileBase.cpp @@ -5,7 +5,7 @@ #include "ProfileBase.h" #include "plugins/SpatialProfile.h" -void ProfileBase::writeMatrix (ofstream& outfile) { +void ProfileBase::writeMatrix (std::ofstream& outfile) { if (_samplInfo.cylinder) { writeCylMatrix(outfile); } else { @@ -13,7 +13,7 @@ void ProfileBase::writeMatrix (ofstream& outfile) { } } -void ProfileBase::writeKartMatrix (ofstream& outfile) { +void ProfileBase::writeKartMatrix (std::ofstream& outfile) { // Write Data // Assuming x = 1 -> projection along x axis // Z - axis label @@ -42,11 +42,11 @@ void ProfileBase::writeKartMatrix (ofstream& outfile) { } -void ProfileBase::writeSimpleMatrix (ofstream& outfile) { +void ProfileBase::writeSimpleMatrix (std::ofstream& outfile) { global_log->error() << "SIMPLE MATRIX OUTPUT NOT IMPLEMENTED!\n"; } -void ProfileBase::writeCylMatrix (ofstream& outfile) { +void ProfileBase::writeCylMatrix (std::ofstream& outfile) { // Write Data // Assuming phi = 1 -> projection along phi axis // R2 - axis label diff --git a/src/plugins/profiles/ProfileBase.h b/src/plugins/profiles/ProfileBase.h index 2247461b8e..35c2259be4 100644 --- a/src/plugins/profiles/ProfileBase.h +++ b/src/plugins/profiles/ProfileBase.h @@ -71,7 +71,7 @@ class ProfileBase { * @param prefix File prefix including the global _outputPrefix for all profiles and the current timestep. Should be * appended by some specific file ending for this specific profile. */ - virtual void output(string prefix, long unsigned accumulatedDatasets) = 0; + virtual void output(std::string prefix, long unsigned accumulatedDatasets) = 0; /** @brief Used to reset all array contents for a specific uID in order to start the next recording timeframe. * @@ -88,7 +88,7 @@ class ProfileBase { protected: // output file prefix - string _profilePrefix; + std::string _profilePrefix; SamplingInformation _samplInfo; long _accumulatedDatasets = -1; // Number of Datasets between output writes / profile resets // -1 if not set properly @@ -98,28 +98,28 @@ class ProfileBase { * @param uID unique ID of bin * @param outfile outfile to write to */ - virtual void writeDataEntry(unsigned long uID, ofstream& outfile) const = 0; + virtual void writeDataEntry(unsigned long uID, std::ofstream& outfile) const = 0; /**@brief Matrix writing routine to avoid code duplication * * @param outfile opened filestream from Profile */ - void writeMatrix(ofstream& outfile); + void writeMatrix(std::ofstream& outfile); - void writeKartMatrix(ofstream& outfile); + void writeKartMatrix(std::ofstream& outfile); /**@brief STUB for simple Matrix output without headers * * @param outfile opened filestream from Profile */ // TODO: implement if needed - void writeSimpleMatrix(ofstream& outfile); + void writeSimpleMatrix(std::ofstream& outfile); /**@brief cylinder Matrix output * * @param outfile opened filestream from Profile */ - void writeCylMatrix(ofstream& outfile); + void writeCylMatrix(std::ofstream& outfile); }; #endif //MARDYN_TRUNK_PROFILEBASE_H diff --git a/src/plugins/profiles/TemperatureProfile.cpp b/src/plugins/profiles/TemperatureProfile.cpp index ccb0c568de..fc2034cd13 100644 --- a/src/plugins/profiles/TemperatureProfile.cpp +++ b/src/plugins/profiles/TemperatureProfile.cpp @@ -7,14 +7,14 @@ #include "KineticProfile.h" -void TemperatureProfile::output(string prefix, long unsigned accumulatedDatasets) { +void TemperatureProfile::output(std::string prefix, long unsigned accumulatedDatasets) { global_log->info() << "[TemperatureProfile] output" << std::endl; // Generate Outfile _accumulatedDatasets = accumulatedDatasets; _profilePrefix = prefix + ".Temppr"; - ofstream outfile(_profilePrefix.c_str()); + std::ofstream outfile(_profilePrefix.c_str()); outfile.precision(6); // Write Header @@ -31,7 +31,7 @@ void TemperatureProfile::output(string prefix, long unsigned accumulatedDatasets outfile.close(); } -void TemperatureProfile::writeDataEntry(unsigned long uID, ofstream &outfile) const { +void TemperatureProfile::writeDataEntry(unsigned long uID, std::ofstream &outfile) const { int dofs = _dofProfile->getGlobalDOF(uID); if(dofs == 0){ outfile << 0.0 << "\t"; diff --git a/src/plugins/profiles/TemperatureProfile.h b/src/plugins/profiles/TemperatureProfile.h index 8d10fb8474..2a5a08a86c 100644 --- a/src/plugins/profiles/TemperatureProfile.h +++ b/src/plugins/profiles/TemperatureProfile.h @@ -29,7 +29,7 @@ class TemperatureProfile final : public ProfileBase { void collectRetrieve(DomainDecompBase *domainDecomp, unsigned long uID) final { _globalProfile[uID] = domainDecomp->collCommGetLongDouble(); } - void output(string prefix, long unsigned accumulatedDatasets) final; + void output(std::string prefix, long unsigned accumulatedDatasets) final; void reset(unsigned long uID) final { _localProfile[uID] = 0.0; _globalProfile[uID] = 0.0; @@ -45,7 +45,7 @@ class TemperatureProfile final : public ProfileBase { // Global 1D Profile std::map _globalProfile; - void writeDataEntry(unsigned long uID, ofstream &outfile) const final; + void writeDataEntry(unsigned long uID, std::ofstream &outfile) const final; }; diff --git a/src/plugins/profiles/Velocity3dProfile.cpp b/src/plugins/profiles/Velocity3dProfile.cpp index 1e178dcc1f..67de256249 100644 --- a/src/plugins/profiles/Velocity3dProfile.cpp +++ b/src/plugins/profiles/Velocity3dProfile.cpp @@ -6,14 +6,14 @@ #include "Velocity3dProfile.h" #include "DensityProfile.h" -void Velocity3dProfile::output(string prefix, long unsigned accumulatedDatasets) { +void Velocity3dProfile::output(std::string prefix, long unsigned accumulatedDatasets) { global_log->info() << "[Velocity3dProfile] output" << std::endl; // Setup outfile _accumulatedDatasets = accumulatedDatasets; _profilePrefix = prefix; _profilePrefix += ".V3Dpr"; - ofstream outfile(_profilePrefix.c_str()); + std::ofstream outfile(_profilePrefix.c_str()); outfile.precision(6); // Write header @@ -33,7 +33,7 @@ void Velocity3dProfile::output(string prefix, long unsigned accumulatedDatasets) } -void Velocity3dProfile::writeDataEntry (unsigned long uID, ofstream& outfile) const { +void Velocity3dProfile::writeDataEntry (unsigned long uID, std::ofstream& outfile) const { long double vd; // X - Y - Z output for (unsigned d = 0; d < 3; d++) { diff --git a/src/plugins/profiles/Velocity3dProfile.h b/src/plugins/profiles/Velocity3dProfile.h index 4135fa708d..4eade53e9f 100644 --- a/src/plugins/profiles/Velocity3dProfile.h +++ b/src/plugins/profiles/Velocity3dProfile.h @@ -36,7 +36,7 @@ class Velocity3dProfile final : public ProfileBase { _global3dProfile[uID][d] = domainDecomp->collCommGetDouble(); } } - void output(string prefix, long unsigned accumulatedDatasets) final; + void output(std::string prefix, long unsigned accumulatedDatasets) final; void reset(unsigned long uID) final { for(unsigned d = 0; d < 3; d++){ _local3dProfile[uID][d] = 0.0; @@ -54,7 +54,7 @@ class Velocity3dProfile final : public ProfileBase { // Global 3D Profile std::map> _global3dProfile; - void writeDataEntry(unsigned long uID, ofstream &outfile) const final; + void writeDataEntry(unsigned long uID, std::ofstream &outfile) const final; }; diff --git a/src/plugins/profiles/VelocityAbsProfile.cpp b/src/plugins/profiles/VelocityAbsProfile.cpp index 31542143ae..6fa8f27d6b 100644 --- a/src/plugins/profiles/VelocityAbsProfile.cpp +++ b/src/plugins/profiles/VelocityAbsProfile.cpp @@ -5,13 +5,13 @@ #include "VelocityAbsProfile.h" #include "plugins/profiles/DensityProfile.h" -void VelocityAbsProfile::output(string prefix, long unsigned accumulatedDatasets) { +void VelocityAbsProfile::output(std::string prefix, long unsigned accumulatedDatasets) { global_log->info() << "[VelocityAbsProfile] output" << std::endl; // Setup outfile _accumulatedDatasets = accumulatedDatasets; _profilePrefix = prefix + ".VAbspr"; - ofstream outfile(_profilePrefix.c_str()); + std::ofstream outfile(_profilePrefix.c_str()); outfile.precision(6); // Write header @@ -30,7 +30,7 @@ void VelocityAbsProfile::output(string prefix, long unsigned accumulatedDatasets outfile.close(); } -void VelocityAbsProfile::writeDataEntry (unsigned long uID, ofstream& outfile) const { +void VelocityAbsProfile::writeDataEntry (unsigned long uID, std::ofstream& outfile) const { // Check for division by 0 long double vd; int numberDensity = _densityProfile->getGlobalNumber(uID); diff --git a/src/plugins/profiles/VelocityAbsProfile.h b/src/plugins/profiles/VelocityAbsProfile.h index 034f09c129..b5218607ca 100644 --- a/src/plugins/profiles/VelocityAbsProfile.h +++ b/src/plugins/profiles/VelocityAbsProfile.h @@ -35,7 +35,7 @@ class VelocityAbsProfile final : public ProfileBase { void collectRetrieve(DomainDecompBase *domainDecomp, unsigned long uID) final { _globalProfile[uID] = domainDecomp->collCommGetDouble(); } - void output(string prefix, long unsigned accumulatedDatasets) final; + void output(std::string prefix, long unsigned accumulatedDatasets) final; void reset(unsigned long uID) final { _localProfile[uID] = 0.0; _globalProfile[uID] = 0.0; @@ -51,7 +51,7 @@ class VelocityAbsProfile final : public ProfileBase { // Global 1D Profile std::map _globalProfile; - void writeDataEntry(unsigned long uID, ofstream &outfile) const final; + void writeDataEntry(unsigned long uID, std::ofstream &outfile) const final; }; #endif //MARDYN_TRUNK_VELOCITYABSPROFILE_H diff --git a/src/plugins/profiles/Virial2DProfile.cpp b/src/plugins/profiles/Virial2DProfile.cpp index f3f216f9a0..23fbdefc58 100644 --- a/src/plugins/profiles/Virial2DProfile.cpp +++ b/src/plugins/profiles/Virial2DProfile.cpp @@ -8,14 +8,14 @@ #include "KineticProfile.h" #include "../FixRegion.h" -void Virial2DProfile::output(string prefix, long unsigned accumulatedDatasets) { +void Virial2DProfile::output(std::string prefix, long unsigned accumulatedDatasets) { global_log->info() << "[VirialProfile2D] output" << std::endl; // Setup outfile _accumulatedDatasets = accumulatedDatasets; _profilePrefix = prefix + ".Vipr"; - ofstream outfile(_profilePrefix.c_str()); + std::ofstream outfile(_profilePrefix.c_str()); outfile.precision(6); @@ -32,7 +32,7 @@ void Virial2DProfile::output(string prefix, long unsigned accumulatedDatasets) { outfile.close(); } -void Virial2DProfile::writeDataEntry(unsigned long uID, ofstream &outfile) const { +void Virial2DProfile::writeDataEntry(unsigned long uID, std::ofstream &outfile) const { // calculate global temperature diff --git a/src/plugins/profiles/Virial2DProfile.h b/src/plugins/profiles/Virial2DProfile.h index 98dce5225b..37809e6fab 100644 --- a/src/plugins/profiles/Virial2DProfile.h +++ b/src/plugins/profiles/Virial2DProfile.h @@ -42,7 +42,7 @@ class Virial2DProfile final : public ProfileBase { } - void output(string prefix, long unsigned accumulatedDatasets) final; + void output(std::string prefix, long unsigned accumulatedDatasets) final; void reset(unsigned long uID) final { for (unsigned d = 0; d < 3; d++) { @@ -64,7 +64,7 @@ class Virial2DProfile final : public ProfileBase { std::map> _global3dProfile; // Only needed because its abstract, all output handled by output() - void writeDataEntry(unsigned long uID, ofstream& outfile) const final; + void writeDataEntry(unsigned long uID, std::ofstream& outfile) const final; }; diff --git a/src/plugins/profiles/VirialProfile.cpp b/src/plugins/profiles/VirialProfile.cpp index c7f8883bdd..bacdffa7c5 100644 --- a/src/plugins/profiles/VirialProfile.cpp +++ b/src/plugins/profiles/VirialProfile.cpp @@ -5,14 +5,14 @@ #include "VirialProfile.h" #include "DensityProfile.h" -void VirialProfile::output(string prefix, long unsigned accumulatedDatasets) { +void VirialProfile::output(std::string prefix, long unsigned accumulatedDatasets) { global_log->info() << "[VirialProfile] output" << std::endl; // Setup outfile _accumulatedDatasets = accumulatedDatasets; _profilePrefix = prefix + "_1D-Y.Vipr"; - ofstream outfile(_profilePrefix.c_str()); + std::ofstream outfile(_profilePrefix.c_str()); outfile.precision(6); // Write Header diff --git a/src/plugins/profiles/VirialProfile.h b/src/plugins/profiles/VirialProfile.h index cb3154740d..808c6fb875 100644 --- a/src/plugins/profiles/VirialProfile.h +++ b/src/plugins/profiles/VirialProfile.h @@ -47,7 +47,7 @@ class VirialProfile : public ProfileBase { * @param prefix * @param accumulatedDatasets */ - void output(string prefix, long unsigned accumulatedDatasets) final; + void output(std::string prefix, long unsigned accumulatedDatasets) final; void reset(unsigned long uID) final { for (unsigned d = 0; d < 3; d++) { @@ -67,7 +67,7 @@ class VirialProfile : public ProfileBase { std::map> _global3dProfile; // Only needed because its abstract, all output handled by output() - void writeDataEntry(unsigned long uID, ofstream& outfile) const final {}; + void writeDataEntry(unsigned long uID, std::ofstream& outfile) const final {}; }; diff --git a/src/tests/MarDynInitOptionsTest.cpp b/src/tests/MarDynInitOptionsTest.cpp index c0c361f679..0a3663fe91 100644 --- a/src/tests/MarDynInitOptionsTest.cpp +++ b/src/tests/MarDynInitOptionsTest.cpp @@ -10,7 +10,6 @@ #include -using namespace std; TEST_SUITE_REGISTRATION(MarDynInitOptionsTest); diff --git a/src/thermostats/TemperatureControl.cpp b/src/thermostats/TemperatureControl.cpp index b783dc5329..023ba58de8 100644 --- a/src/thermostats/TemperatureControl.cpp +++ b/src/thermostats/TemperatureControl.cpp @@ -24,7 +24,6 @@ #include #include -using namespace std; // init static ID --> instance counting unsigned short ControlRegionT::_nStaticID = 0; @@ -105,7 +104,7 @@ void ControlRegionT::readXML(XMLfileUnits& xmlconfig) { for (uint8_t d = 0; d < 3; ++d) uc[d] = (strVal[d] == "box") ? domain->getGlobalLength(d) : atof(strVal[d].c_str()); #ifndef NDEBUG - global_log->info() << "TemperatureControl: upper corner: " << uc[0] << ", " << uc[1] << ", " << uc[2] << endl; + global_log->info() << "TemperatureControl: upper corner: " << uc[0] << ", " << uc[1] << ", " << uc[2] << std::endl; #endif for (uint8_t d = 0; d < 3; ++d) { @@ -442,9 +441,9 @@ void ControlRegionT::InitBetaLogfile() { const std::string fname = _strFilenamePrefixBetaLog + "_reg" + std::to_string(this->GetID()) + ".dat"; std::ofstream ofs; ofs.open(fname, std::ios::out); - ofs << setw(12) << "simstep" - << setw(24) << "dBetaTrans" - << setw(24) << "dBetaRot" + ofs << std::setw(12) << "simstep" + << std::setw(24) << "dBetaTrans" + << std::setw(24) << "dBetaRot" << std::endl; ofs.close(); } @@ -474,7 +473,7 @@ void ControlRegionT::WriteBetaLogfile(unsigned long simstep) { const std::string fname = _strFilenamePrefixBetaLog + "_reg" + std::to_string(this->GetID()) + ".dat"; std::ofstream ofs; ofs.open(fname, std::ios::app); - ofs << setw(12) << simstep + ofs << std::setw(12) << simstep << FORMAT_SCI_MAX_DIGITS << dBetaTrans << FORMAT_SCI_MAX_DIGITS << dBetaRot << std::endl; @@ -504,7 +503,7 @@ void ControlRegionT::registerAsObserver() { distControl->registerObserver(this); else { global_log->error() << "TemperatureControl->region[" << this->GetID() - << "]: Initialization of plugin DistControl is needed before! Program exit..." << endl; + << "]: Initialization of plugin DistControl is needed before! Program exit..." << std::endl; Simulation::exit(-1); } } @@ -528,10 +527,10 @@ void ControlRegionT::InitAddedEkin() { const std::string fname = "addedEkin_reg" + std::to_string(this->GetID()) + "_cid" + std::to_string(_nTargetComponentID) + ".dat"; std::ofstream ofs; ofs.open(fname, std::ios::out); - ofs << setw(12) << "simstep"; + ofs << std::setw(12) << "simstep"; for (int i = 0; i < _nNumSlabs; ++i) { std::string s = "bin" + std::to_string(i+1); - ofs << setw(24) << s; + ofs << std::setw(24) << s; } ofs << std::endl; ofs.close(); @@ -581,7 +580,7 @@ void ControlRegionT::writeAddedEkin(DomainDecompBase* domainDecomp, const uint64 std::ofstream ofs; ofs.open(fname, std::ios::app); - ofs << setw(12) << simstep; + ofs << std::setw(12) << simstep; for (double& it : vg) { ofs << FORMAT_SCI_MAX_DIGITS << it; } @@ -603,9 +602,9 @@ void TemperatureControl::readXML(XMLfileUnits& xmlconfig) { xmlconfig.getNodeValue("control/start", _nStart); xmlconfig.getNodeValue("control/frequency", _nControlFreq); xmlconfig.getNodeValue("control/stop", _nStop); - global_log->info() << "Start control from simstep: " << _nStart << endl; - global_log->info() << "Control with frequency: " << _nControlFreq << endl; - global_log->info() << "Stop control at simstep: " << _nStop << endl; + global_log->info() << "Start control from simstep: " << _nStart << std::endl; + global_log->info() << "Control with frequency: " << _nControlFreq << std::endl; + global_log->info() << "Stop control at simstep: " << _nStop << std::endl; // turn on/off explosion heuristics // domain->setExplosionHeuristics(bUseExplosionHeuristics); @@ -614,11 +613,11 @@ void TemperatureControl::readXML(XMLfileUnits& xmlconfig) { uint32_t numRegions = 0; XMLfile::Query query = xmlconfig.query("regions/region"); numRegions = query.card(); - global_log->info() << "Number of control regions: " << numRegions << endl; + global_log->info() << "Number of control regions: " << numRegions << std::endl; if (numRegions < 1) { - global_log->warning() << "No region parameters specified." << endl; + global_log->warning() << "No region parameters specified." << std::endl; } - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); XMLfile::Query::const_iterator outputRegionIter; for (outputRegionIter = query.begin(); outputRegionIter; outputRegionIter++) { xmlconfig.changecurrentnode(outputRegionIter); diff --git a/src/thermostats/VelocityScalingThermostat.cpp b/src/thermostats/VelocityScalingThermostat.cpp index 6d1339d51c..f272ad9fb4 100644 --- a/src/thermostats/VelocityScalingThermostat.cpp +++ b/src/thermostats/VelocityScalingThermostat.cpp @@ -6,8 +6,6 @@ #include "utils/Logger.h" #include "particleContainer/ParticleContainer.h" -using namespace std; -using Log::global_log; VelocityScalingThermostat::VelocityScalingThermostat() { this->_globalBetaTrans = 1.0; @@ -54,7 +52,7 @@ void VelocityScalingThermostat::apply(ParticleContainer *moleculeContainer) { betaTrans = _componentBetaTrans[thermostatId]; betaRot = _componentBetaRot[thermostatId]; - map::iterator vIter; + std::map::iterator vIter; if( (vIter = _componentVelocity.find(thermostatId)) != _componentVelocity.end()) { molecule->scale_v(betaTrans); } @@ -74,8 +72,8 @@ void VelocityScalingThermostat::apply(ParticleContainer *moleculeContainer) { { double betaTrans = _globalBetaTrans; double betaRot = _globalBetaRot; - global_log->debug() << "Beta rot: " << betaRot << endl; - global_log->debug() << "Beta trans: " << betaTrans << endl; + global_log->debug() << "Beta rot: " << betaRot << std::endl; + global_log->debug() << "Beta trans: " << betaTrans << std::endl; for (auto i = moleculeContainer->iterator(ParticleIterator::ONLY_INNER_AND_BOUNDARY); i.isValid(); ++i) { if(this->_useGlobalVelocity) { diff --git a/src/utils/DynAlloc.h b/src/utils/DynAlloc.h index 91bec49df2..995dd64d04 100644 --- a/src/utils/DynAlloc.h +++ b/src/utils/DynAlloc.h @@ -10,7 +10,6 @@ #include #include -using namespace std; // leak save dynamic memory allocation inline void AllocateUnsLongArray(unsigned long* &ptr, const unsigned int& nSize) diff --git a/src/utils/Expression.cpp b/src/utils/Expression.cpp index 0fe1e37026..c65317e949 100644 --- a/src/utils/Expression.cpp +++ b/src/utils/Expression.cpp @@ -7,7 +7,6 @@ #include "Expression.h" -using namespace std; bool Expression::Value::operator==(Value const& v) const @@ -128,11 +127,11 @@ const Expression::Value Expression::Value::operator/(Value const& v) const } -Expression::Variable* Expression::VariableSet::addVariable(const string& name) +Expression::Variable* Expression::VariableSet::addVariable(const std::string& name) { - string vgrpname,varname(name); + std::string vgrpname,varname(name); size_t colonpos=name.find(":"); - if(colonpos!=string::npos) + if(colonpos!=std::string::npos) { vgrpname=name.substr(0,colonpos); varname=name.substr(colonpos+1); @@ -140,14 +139,14 @@ Expression::Variable* Expression::VariableSet::addVariable(const string& name) if(!existVariableGroup(vgrpname)) { // create variable group //_vargroups[vgrpname]=VariableGroup(vgrpname); - _vargroups.insert(pair(vgrpname,VariableGroup(vgrpname))); + _vargroups.insert(std::pair(vgrpname,VariableGroup(vgrpname))); } //_variables[name]=Variable(varname,&_vargroups[vgrpname],val); - _variables.insert(pair(name,Variable(varname,&_vargroups[vgrpname]))); + _variables.insert(std::pair(name,Variable(varname,&_vargroups[vgrpname]))); return &_variables[name]; } -bool Expression::VariableSet::removeVariable(const string& name) +bool Expression::VariableSet::removeVariable(const std::string& name) { Variable* var=getVariable(name); if(var) @@ -168,7 +167,7 @@ bool Expression::VariableSet::removeVariable(const string& name) -void Expression::Node::traverse(list& nodelist, enum Etraversetype traversetype) const +void Expression::Node::traverse(std::list& nodelist, enum Etraversetype traversetype) const { switch(traversetype) { @@ -190,7 +189,7 @@ void Expression::Node::traverse(list& nodelist, enum Etraversetype } } -void Expression::Node::writeSubExpr(ostream& ostrm, enum Etraversetype traversetype, char sep) const +void Expression::Node::writeSubExpr(std::ostream& ostrm, enum Etraversetype traversetype, char sep) const { switch(traversetype) { @@ -464,7 +463,7 @@ Expression::Value Expression::NodeFunction::evaluate() const return Value(); } -void Expression::NodeFunction::write(ostream& ostrm) const { +void Expression::NodeFunction::write(std::ostream& ostrm) const { switch(_functype) { // case functypeNONE: ostrm << "undef"; break; @@ -507,7 +506,7 @@ Expression::Tvaltype Expression::NodeFunctionVarSet::valueType() const { // functions with 1 argument case functypeRCL: { - string varname("_localstore:"+static_cast(*_children[1])); + std::string varname("_localstore:"+static_cast(*_children[1])); Expression::Tvaltype valtype = valtypeNONE; Expression::Variable* var=NULL; if(_variableset) var=_variableset->getVariable(varname); @@ -537,7 +536,7 @@ Expression::Value Expression::NodeFunctionVarSet::evaluate() const { // functions with 1 argument case functypeRCL: { - string varname("_localstore:"+static_cast(*_children[1])); + std::string varname("_localstore:"+static_cast(*_children[1])); Expression::Value val; Expression::Variable* var=NULL; if(_variableset) var=_variableset->getVariable(varname); @@ -553,7 +552,7 @@ Expression::Value Expression::NodeFunctionVarSet::evaluate() const case functypeSTO: { Expression::Value val=_children[0]->evaluate(); - string varname("_localstore:"+static_cast(*_children[1])); + std::string varname("_localstore:"+static_cast(*_children[1])); if(_variableset) _variableset->setVariable(varname,val); return val; } @@ -564,7 +563,7 @@ Expression::Value Expression::NodeFunctionVarSet::evaluate() const return Value(); } -void Expression::NodeFunctionVarSet::write(ostream& ostrm) const { +void Expression::NodeFunctionVarSet::write(std::ostream& ostrm) const { switch(_functype) { // case functypeRCL: ostrm << "RCL"; break; @@ -576,15 +575,15 @@ void Expression::NodeFunctionVarSet::write(ostream& ostrm) const { -void Expression::initializeRPN(const string& exprstr, bool genlabel) +void Expression::initializeRPN(const std::string& exprstr, bool genlabel) { clear(); - stack nodestack; + std::stack nodestack; // split expr to generate Nodes size_t startpos=0,endpos; while(startpossetParent(node0); node2->setParent(node0); } - } else if(token.find_first_not_of("0123456789.-E")==string::npos){ + } else if(token.find_first_not_of("0123456789.-E")==std::string::npos){ // constant ................................................ - istringstream iss(token); - if(token.find_first_not_of("0123456789-")==string::npos) + std::istringstream iss(token); + if(token.find_first_not_of("0123456789-")==std::string::npos) { // Tint Tint valInt=0; iss>>valInt; @@ -622,8 +621,8 @@ void Expression::initializeRPN(const string& exprstr, bool genlabel) iss>>valFloat; nodestack.push(new NodeConstant(valFloat)); } - iss.str(string()); - } else if(colonpos!=string::npos) { + iss.str(std::string()); + } else if(colonpos!=std::string::npos) { // variable ................................................ nodestack.push(new NodeVariable(_variableset->addVariable(token))); } else { diff --git a/src/utils/FileUtils.h b/src/utils/FileUtils.h index fbad7940b5..e874cf85cb 100644 --- a/src/utils/FileUtils.h +++ b/src/utils/FileUtils.h @@ -64,7 +64,7 @@ std::ostream& operator<<( std::ostream& o, const fill_width& a ); * * call e.g. like this: * - * std::vector fields; + * std::vector fields; * std::string str = "split:this:string"; * fields = split( fields, str, ":", split_type::no_empties ); * diff --git a/src/utils/Logger.h b/src/utils/Logger.h index 1e97f99a4c..1adef68327 100644 --- a/src/utils/Logger.h +++ b/src/utils/Logger.h @@ -49,8 +49,7 @@ class Logger; * Gobal logger variable for use in the entire program. * Must be initialized with constructor e.g. new Log::Logger(). * Namespace visibility: - * using Log::global_log; - */ + * */ #ifndef LOGGER_SRC extern Log::Logger *global_log; #endif @@ -77,7 +76,7 @@ typedef enum { * create and write to his own file. * For writing log messages use fatal(), error(), warning(), info() or debug() as * with normal streams, e.g. - * > log.error() << "Wrong parameter." << endl; + * > log.error() << "Wrong parameter." << std::endl; * For easy handling of output within MPI applications there are the following methods: * set_mpi_output_root(int root) * set_mpi_output_rall() @@ -160,23 +159,22 @@ class Logger { /// Add log info in front of messages Logger& msg_level(logLevel level) { - using namespace std; - _msg_log_level = level; + _msg_log_level = level; if (_msg_log_level <= _log_level && _do_output) { // Include timestamp const auto now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); tm unused{}; const auto* lt = localtime_r(&now, &unused); //*_log_stream << ctime(&t) << " "; - stringstream timestampstream; + std::stringstream timestampstream; // maybe sprintf is easier here... - timestampstream << setfill('0') << setw(4) << (1900 + lt->tm_year) << setw(2) << (1 + lt->tm_mon) << setw(2) << lt->tm_mday << "T" << setw(2) << lt->tm_hour << setw(2) << lt->tm_min << setw(2) << lt->tm_sec; + timestampstream << std::setfill('0') << std::setw(4) << (1900 + lt->tm_year) << std::setw(2) << (1 + lt->tm_mon) << std::setw(2) << lt->tm_mday << "T" << std::setw(2) << lt->tm_hour << std::setw(2) << lt->tm_min << std::setw(2) << lt->tm_sec; *_log_stream << logLevelNames[level] << ":\t" << timestampstream.str() << " "; //timestampstream.str(""); timestampstream.clear(); #ifdef USE_GETTIMEOFDAY timeval tod; gettimeofday(&tod, 0); - *_log_stream << setw(8) << tod.tv_sec - _starttime.tv_sec + (tod.tv_usec - _starttime.tv_usec) / 1.E6 << " "; + *_log_stream << std::setw(8) << tod.tv_sec - _starttime.tv_sec + (tod.tv_usec - _starttime.tv_usec) / 1.E6 << " "; #else *_log_stream << t-_starttime << "\t"; #endif diff --git a/src/utils/MPI_Info_object.cpp b/src/utils/MPI_Info_object.cpp index d5391e7e95..c0b8259c6e 100644 --- a/src/utils/MPI_Info_object.cpp +++ b/src/utils/MPI_Info_object.cpp @@ -21,9 +21,9 @@ void MPI_Info_object::readXML(XMLfile& xmlconfig) { } XMLfile::Query query = xmlconfig.query("hint"); - global_log->debug() << "[MPI_Info_object]\tNumber of hint key value pairs: " << query.card() << endl; + global_log->debug() << "[MPI_Info_object]\tNumber of hint key value pairs: " << query.card() << std::endl; - string oldpath = xmlconfig.getcurrentnodepath(); + std::string oldpath = xmlconfig.getcurrentnodepath(); for(auto pairIter = query.begin(); pairIter; ++pairIter) { xmlconfig.changecurrentnode(pairIter); std::string key, value; diff --git a/src/utils/OptionParser.cpp b/src/utils/OptionParser.cpp index 5788b885d7..37ce4edf0d 100644 --- a/src/utils/OptionParser.cpp +++ b/src/utils/OptionParser.cpp @@ -20,20 +20,19 @@ #endif -using namespace std; namespace optparse { ////////// auxiliary (string) functions { ////////// struct str_wrap { - str_wrap(const string& l, const string& r) : lwrap(l), rwrap(r) {} - str_wrap(const string& w) : lwrap(w), rwrap(w) {} - string operator() (const string& s) { return lwrap + s + rwrap; } - const string lwrap, rwrap; + str_wrap(const std::string& l, const std::string& r) : lwrap(l), rwrap(r) {} + str_wrap(const std::string& w) : lwrap(w), rwrap(w) {} + std::string operator() (const std::string& s) { return lwrap + s + rwrap; } + const std::string lwrap, rwrap; }; template -static string str_join_trans(const string& sep, InputIterator begin, InputIterator end, UnaryOperator op) { - string buf; +static std::string str_join_trans(const std::string& sep, InputIterator begin, InputIterator end, UnaryOperator op) { + std::string buf; for (InputIterator it = begin; it != end; ++it) { if (it != begin) buf += sep; @@ -42,30 +41,30 @@ static string str_join_trans(const string& sep, InputIterator begin, InputIterat return buf; } template -static string str_join(const string& sep, InputIterator begin, InputIterator end) { +static std::string str_join(const std::string& sep, InputIterator begin, InputIterator end) { return str_join_trans(sep, begin, end, str_wrap("")); } -static string& str_replace(string& s, const string& patt, const string& repl) { +static std::string& str_replace(std::string& s, const std::string& patt, const std::string& repl) { size_t pos = 0, n = patt.length(); while (true) { pos = s.find(patt, pos); - if (pos == string::npos) + if (pos == std::string::npos) break; s.replace(pos, n, repl); pos += repl.size(); } return s; } -static string str_replace(const string& s, const string& patt, const string& repl) { - string tmp = s; +static std::string str_replace(const std::string& s, const std::string& patt, const std::string& repl) { + std::string tmp = s; str_replace(tmp, patt, repl); return tmp; } -static string str_format(const string& s, size_t pre, size_t len, bool indent_first = true) { - stringstream ss; - string p; +static std::string str_format(const std::string& s, size_t pre, size_t len, bool indent_first = true) { + std::stringstream ss; + std::string p; if (indent_first) - p = string(pre, ' '); + p = std::string(pre, ' '); size_t pos = 0, linestart = 0; size_t line = 0; @@ -73,29 +72,29 @@ static string str_format(const string& s, size_t pre, size_t len, bool indent_fi bool wrap = false; size_t new_pos = s.find_first_of(" \n\t", pos); - if (new_pos == string::npos) + if (new_pos == std::string::npos) break; if (s[new_pos] == '\n') { pos = new_pos + 1; wrap = true; } if (line == 1) - p = string(pre, ' '); + p = std::string(pre, ' '); if (wrap || new_pos + pre > linestart + len) { - ss << p << s.substr(linestart, pos - linestart - 1) << endl; + ss << p << s.substr(linestart, pos - linestart - 1) << std::endl; linestart = pos; line++; } pos = new_pos + 1; } - ss << p << s.substr(linestart) << endl; + ss << p << s.substr(linestart) << std::endl; return ss.str(); } -static string str_inc(const string& s) { - stringstream ss; - string v = (s != "") ? s : "0"; +static std::string str_inc(const std::string& s) { + std::stringstream ss; + std::string v = (s != "") ? s : "0"; long i; - istringstream(v) >> i; + std::istringstream(v) >> i; ss << i+1; return ss.str(); } @@ -103,20 +102,20 @@ static unsigned int cols() { unsigned int n = 80; const char *s = getenv("COLUMNS"); if (s) - istringstream(s) >> n; + std::istringstream(s) >> n; return n; } -static string basename(const string& s) { - string b = s; +static std::string basename(const std::string& s) { + std::string b = s; size_t i = b.find_last_not_of('/'); - if (i == string::npos) { + if (i == std::string::npos) { if (b[0] == '/') b.erase(1); return b; } b.erase(i+1, b.length()-i-1); i = b.find_last_of("/"); - if (i != string::npos) + if (i != std::string::npos) b.erase(0, i+1); return b; } @@ -130,31 +129,31 @@ OptionParser::OptionParser() : _add_version_option(true), _interspersed_args(true) {} -Option& OptionParser::add_option(const string& opt) { - const string tmp[1] = { opt }; - return add_option(vector(tmp, tmp + 1)); +Option& OptionParser::add_option(const std::string& opt) { + const std::string tmp[1] = { opt }; + return add_option(std::vector(tmp, tmp + 1)); } -Option& OptionParser::add_option(const string& opt1, const string& opt2) { - const string tmp[2] = { opt1, opt2 }; - return add_option(vector(tmp, tmp + 2)); +Option& OptionParser::add_option(const std::string& opt1, const std::string& opt2) { + const std::string tmp[2] = { opt1, opt2 }; + return add_option(std::vector(tmp, tmp + 2)); } -Option& OptionParser::add_option(const string& opt1, const string& opt2, const string& opt3) { - const string tmp[3] = { opt1, opt2, opt3 }; - return add_option(vector(tmp, tmp + 3)); +Option& OptionParser::add_option(const std::string& opt1, const std::string& opt2, const std::string& opt3) { + const std::string tmp[3] = { opt1, opt2, opt3 }; + return add_option(std::vector(tmp, tmp + 3)); } -Option& OptionParser::add_option(const vector& v) { +Option& OptionParser::add_option(const std::vector& v) { _opts.resize(_opts.size()+1); Option& option = _opts.back(); - string dest_fallback; - for (vector::const_iterator it = v.begin(); it != v.end(); ++it) { + std::string dest_fallback; + for (std::vector::const_iterator it = v.begin(); it != v.end(); ++it) { if (it->substr(0,2) == "--") { - const string s = it->substr(2); + const std::string s = it->substr(2); if (option.dest() == "") option.dest(str_replace(s, "-", "_")); option._long_opts.insert(s); _optmap_l[s] = &option; } else { - const string s = it->substr(1,1); + const std::string s = it->substr(1,1); if (dest_fallback == "") dest_fallback = s; option._short_opts.insert(s); @@ -167,28 +166,28 @@ Option& OptionParser::add_option(const vector& v) { } OptionParser& OptionParser::add_option_group(const OptionGroup& group) { - for (list