1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-09-20 09:15:38 +01:00

Hadrons: namespace std not used anymore in compiled sources

This commit is contained in:
Antonin Portelli 2015-12-23 14:30:33 +00:00
parent 76c78f04e2
commit 54eacec261
8 changed files with 41 additions and 46 deletions

View File

@ -20,7 +20,6 @@
#include <Hadrons/Application.hpp>
#include <Hadrons/Graph.hpp>
using namespace std;
using namespace Grid;
using namespace Hadrons;
@ -34,9 +33,9 @@ Application::Application(int argc, char *argv[])
{
if (argc < 2)
{
cerr << "usage: " << argv[0] << " <parameter file> [Grid options]";
cerr << endl;
exit(EXIT_FAILURE);
std::cerr << "usage: " << argv[0] << " <parameter file> [Grid options]";
std::cerr << std::endl;
std::exit(EXIT_FAILURE);
}
parameterFileName_ = argv[1];
Grid_init(&argc, &argv);
@ -44,19 +43,19 @@ Application::Application(int argc, char *argv[])
HadronsLogWarning.Active(GridLogWarning.isActive());
HadronsLogMessage.Active(GridLogMessage.isActive());
HadronsLogDebug.Active(GridLogDebug.isActive());
LOG(Message) << "Grid initialized" << endl;
LOG(Message) << "Modules available:" << endl;
LOG(Message) << "Grid initialized" << std::endl;
LOG(Message) << "Modules available:" << std::endl;
auto list = modFactory_.getModuleList();
for (auto &m: list)
{
LOG(Message) << " " << m << endl;
LOG(Message) << " " << m << std::endl;
}
}
// destructor //////////////////////////////////////////////////////////////////
Application::~Application(void)
{
LOG(Message) << "Grid is finalizing now" << endl;
LOG(Message) << "Grid is finalizing now" << std::endl;
Grid_finalize();
}
@ -82,7 +81,7 @@ void Application::parseParameterFile(void)
XmlReader reader(parameterFileName_);
ModuleId id;
LOG(Message) << "Reading '" << parameterFileName_ << "'..." << endl;
LOG(Message) << "Reading '" << parameterFileName_ << "'..." << std::endl;
read(reader, "parameters", par_);
push(reader, "modules");
push(reader, "module");
@ -91,7 +90,7 @@ void Application::parseParameterFile(void)
read(reader, "id", id);
module_[id.name] = modFactory_.create(id.type, id.name);
module_[id.name]->parseParameters(reader, "options");
vector<string> output = module_[id.name]->getOutput();
std::vector<std::string> output = module_[id.name]->getOutput();
for (auto &n: output)
{
associatedModule_[n] = id.name;
@ -104,21 +103,21 @@ void Application::parseParameterFile(void)
// schedule computation ////////////////////////////////////////////////////////
void Application::schedule(void)
{
Graph<string> moduleGraph;
Graph<std::string> moduleGraph;
LOG(Message) << "Scheduling computation..." << endl;
LOG(Message) << "Scheduling computation..." << std::endl;
// create dependency graph
for (auto &m: module_)
{
vector<string> input = m.second->getInput();
std::vector<std::string> input = m.second->getInput();
for (auto &n: input)
{
try
{
moduleGraph.addEdge(associatedModule_.at(n), m.first);
}
catch (out_of_range &)
catch (std::out_of_range &)
{
HADRON_ERROR("unknown object '" + n + "'");
}
@ -126,21 +125,21 @@ void Application::schedule(void)
}
// topological sort
map<string, map<string, bool>> m;
unsigned int k = 0;
std::map<std::string, std::map<std::string, bool>> m;
unsigned int k = 0;
vector<Graph<string>> con = moduleGraph.getConnectedComponents();
LOG(Message) << "Program:" << endl;
std::vector<Graph<std::string>> con = moduleGraph.getConnectedComponents();
LOG(Message) << "Program:" << std::endl;
for (unsigned int i = 0; i < con.size(); ++i)
{
vector<vector<string>> t = con[i].allTopoSort();
std::vector<std::vector<std::string>> t = con[i].allTopoSort();
m = makeDependencyMatrix(t);
for (unsigned int j = 0; j < t[0].size(); ++j)
{
program_.push_back(t[0][j]);
LOG(Message) << setw(4) << right << k << ": "
<< program_[k] << endl;
LOG(Message) << std::setw(4) << std::right << k << ": "
<< program_[k] << std::endl;
k++;
}
}
@ -153,7 +152,8 @@ void Application::configLoop(void)
for (unsigned int t = range.start; t < range.end; t += range.step)
{
LOG(Message) << "Starting measurement for trajectory " << t << endl;
LOG(Message) << "Starting measurement for trajectory " << t
<< std::endl;
execute();
}
}
@ -163,7 +163,7 @@ void Application::execute(void)
for (unsigned int i = 0; i < program_.size(); ++i)
{
LOG(Message) << "Measurement step (" << i+1 << "/" << program_.size()
<< ")" << endl;
<< ")" << std::endl;
(*module_[program_[i]])(env_);
}
}

View File

@ -19,7 +19,6 @@
#include <Hadrons/CMeson.hpp>
using namespace std;
using namespace Grid;
using namespace Hadrons;
@ -27,7 +26,7 @@ using namespace Hadrons;
* CMeson implementation *
******************************************************************************/
// constructor /////////////////////////////////////////////////////////////////
CMeson::CMeson(const string &name)
CMeson::CMeson(const std::string &name)
: Module(name)
{}
@ -38,16 +37,16 @@ void CMeson::parseParameters(XmlReader &reader, const std::string &name)
}
// dependency relation /////////////////////////////////////////////////////////
vector<string> CMeson::getInput(void)
std::vector<std::string> CMeson::getInput(void)
{
vector<string> input = {par_.q1, par_.q2};
std::vector<std::string> input = {par_.q1, par_.q2};
return input;
}
vector<string> CMeson::getOutput(void)
std::vector<std::string> CMeson::getOutput(void)
{
vector<string> output = {getName()};
std::vector<std::string> output = {getName()};
return output;
}
@ -61,5 +60,6 @@ double CMeson::nCreatedProp(void)
// execution ///////////////////////////////////////////////////////////////////
void CMeson::operator()(Environment &env)
{
LOG(Message) << "computing meson contraction '" << getName() << "'" << endl;
LOG(Message) << "computing meson contraction '" << getName() << "'"
<< std::endl;
}

View File

@ -19,7 +19,6 @@
#include <Hadrons/Environment.hpp>
using namespace std;
using namespace Grid;
using namespace Hadrons;

View File

@ -19,7 +19,6 @@
#include <Hadrons/Global.hpp>
using namespace std;
using namespace Grid;
using namespace Hadrons;

View File

@ -19,7 +19,6 @@
#include <Hadrons/Application.hpp>
using namespace std;
using namespace Hadrons;
int main(int argc, char *argv[])

View File

@ -19,7 +19,6 @@
#include <Hadrons/MQuark.hpp>
using namespace std;
using namespace Grid;
using namespace Hadrons;
@ -38,14 +37,14 @@ void MQuark::parseParameters(XmlReader &reader, const std::string &name)
}
// dependency relation
vector<string> MQuark::getInput(void)
std::vector<std::string> MQuark::getInput(void)
{
return vector<string>();
return std::vector<std::string>();
}
vector<string> MQuark::getOutput(void)
std::vector<std::string> MQuark::getOutput(void)
{
vector<string> out = {getName(), getName() + "_5d"};
std::vector<std::string> out = {getName(), getName() + "_5d"};
return out;
}
@ -59,5 +58,6 @@ double MQuark::nCreatedProp(void)
// execution
void MQuark::operator()(Environment &env)
{
LOG(Message) << "computing quark propagator '" << getName() << "'" << endl;
LOG(Message) << "computing quark propagator '" << getName() << "'"
<< std::endl;
}

View File

@ -19,7 +19,6 @@
#include <Hadrons/Module.hpp>
using namespace std;
using namespace Grid;
using namespace Hadrons;
@ -27,12 +26,12 @@ using namespace Hadrons;
* Module implementation *
******************************************************************************/
// constructor /////////////////////////////////////////////////////////////////
Module::Module(const string &name)
Module::Module(const std::string &name)
: name_(name)
{}
// access //////////////////////////////////////////////////////////////////////
string Module::getName(void) const
std::string Module::getName(void) const
{
return name_;
}

View File

@ -19,7 +19,6 @@
#include <Hadrons/ModuleFactory.hpp>
using namespace std;
using namespace Grid;
using namespace Hadrons;
@ -52,8 +51,8 @@ std::vector<std::string> ModuleFactory::getModuleList(void) const
}
// factory /////////////////////////////////////////////////////////////////////
unique_ptr<Module> ModuleFactory::create(const string &type,
const string &name) const
std::unique_ptr<Module> ModuleFactory::create(const std::string &type,
const std::string &name) const
{
FactoryFunc func;
@ -61,7 +60,7 @@ unique_ptr<Module> ModuleFactory::create(const string &type,
{
func = factory_.at(type);
}
catch (out_of_range)
catch (std::out_of_range)
{
HADRON_ERROR("module type '" + type + "' unknown");
}