mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-10 07:55:35 +00:00
Hadrons: namespace std not used anymore in compiled sources
This commit is contained in:
parent
76c78f04e2
commit
54eacec261
@ -20,7 +20,6 @@
|
|||||||
#include <Hadrons/Application.hpp>
|
#include <Hadrons/Application.hpp>
|
||||||
#include <Hadrons/Graph.hpp>
|
#include <Hadrons/Graph.hpp>
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace Grid;
|
using namespace Grid;
|
||||||
using namespace Hadrons;
|
using namespace Hadrons;
|
||||||
|
|
||||||
@ -34,9 +33,9 @@ Application::Application(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
{
|
{
|
||||||
cerr << "usage: " << argv[0] << " <parameter file> [Grid options]";
|
std::cerr << "usage: " << argv[0] << " <parameter file> [Grid options]";
|
||||||
cerr << endl;
|
std::cerr << std::endl;
|
||||||
exit(EXIT_FAILURE);
|
std::exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
parameterFileName_ = argv[1];
|
parameterFileName_ = argv[1];
|
||||||
Grid_init(&argc, &argv);
|
Grid_init(&argc, &argv);
|
||||||
@ -44,19 +43,19 @@ Application::Application(int argc, char *argv[])
|
|||||||
HadronsLogWarning.Active(GridLogWarning.isActive());
|
HadronsLogWarning.Active(GridLogWarning.isActive());
|
||||||
HadronsLogMessage.Active(GridLogMessage.isActive());
|
HadronsLogMessage.Active(GridLogMessage.isActive());
|
||||||
HadronsLogDebug.Active(GridLogDebug.isActive());
|
HadronsLogDebug.Active(GridLogDebug.isActive());
|
||||||
LOG(Message) << "Grid initialized" << endl;
|
LOG(Message) << "Grid initialized" << std::endl;
|
||||||
LOG(Message) << "Modules available:" << endl;
|
LOG(Message) << "Modules available:" << std::endl;
|
||||||
auto list = modFactory_.getModuleList();
|
auto list = modFactory_.getModuleList();
|
||||||
for (auto &m: list)
|
for (auto &m: list)
|
||||||
{
|
{
|
||||||
LOG(Message) << " " << m << endl;
|
LOG(Message) << " " << m << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// destructor //////////////////////////////////////////////////////////////////
|
// destructor //////////////////////////////////////////////////////////////////
|
||||||
Application::~Application(void)
|
Application::~Application(void)
|
||||||
{
|
{
|
||||||
LOG(Message) << "Grid is finalizing now" << endl;
|
LOG(Message) << "Grid is finalizing now" << std::endl;
|
||||||
Grid_finalize();
|
Grid_finalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +81,7 @@ void Application::parseParameterFile(void)
|
|||||||
XmlReader reader(parameterFileName_);
|
XmlReader reader(parameterFileName_);
|
||||||
ModuleId id;
|
ModuleId id;
|
||||||
|
|
||||||
LOG(Message) << "Reading '" << parameterFileName_ << "'..." << endl;
|
LOG(Message) << "Reading '" << parameterFileName_ << "'..." << std::endl;
|
||||||
read(reader, "parameters", par_);
|
read(reader, "parameters", par_);
|
||||||
push(reader, "modules");
|
push(reader, "modules");
|
||||||
push(reader, "module");
|
push(reader, "module");
|
||||||
@ -91,7 +90,7 @@ void Application::parseParameterFile(void)
|
|||||||
read(reader, "id", id);
|
read(reader, "id", id);
|
||||||
module_[id.name] = modFactory_.create(id.type, id.name);
|
module_[id.name] = modFactory_.create(id.type, id.name);
|
||||||
module_[id.name]->parseParameters(reader, "options");
|
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)
|
for (auto &n: output)
|
||||||
{
|
{
|
||||||
associatedModule_[n] = id.name;
|
associatedModule_[n] = id.name;
|
||||||
@ -104,21 +103,21 @@ void Application::parseParameterFile(void)
|
|||||||
// schedule computation ////////////////////////////////////////////////////////
|
// schedule computation ////////////////////////////////////////////////////////
|
||||||
void Application::schedule(void)
|
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
|
// create dependency graph
|
||||||
for (auto &m: module_)
|
for (auto &m: module_)
|
||||||
{
|
{
|
||||||
vector<string> input = m.second->getInput();
|
std::vector<std::string> input = m.second->getInput();
|
||||||
for (auto &n: input)
|
for (auto &n: input)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
moduleGraph.addEdge(associatedModule_.at(n), m.first);
|
moduleGraph.addEdge(associatedModule_.at(n), m.first);
|
||||||
}
|
}
|
||||||
catch (out_of_range &)
|
catch (std::out_of_range &)
|
||||||
{
|
{
|
||||||
HADRON_ERROR("unknown object '" + n + "'");
|
HADRON_ERROR("unknown object '" + n + "'");
|
||||||
}
|
}
|
||||||
@ -126,21 +125,21 @@ void Application::schedule(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// topological sort
|
// topological sort
|
||||||
map<string, map<string, bool>> m;
|
std::map<std::string, std::map<std::string, bool>> m;
|
||||||
unsigned int k = 0;
|
unsigned int k = 0;
|
||||||
|
|
||||||
vector<Graph<string>> con = moduleGraph.getConnectedComponents();
|
std::vector<Graph<std::string>> con = moduleGraph.getConnectedComponents();
|
||||||
LOG(Message) << "Program:" << endl;
|
LOG(Message) << "Program:" << std::endl;
|
||||||
for (unsigned int i = 0; i < con.size(); ++i)
|
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);
|
m = makeDependencyMatrix(t);
|
||||||
for (unsigned int j = 0; j < t[0].size(); ++j)
|
for (unsigned int j = 0; j < t[0].size(); ++j)
|
||||||
{
|
{
|
||||||
program_.push_back(t[0][j]);
|
program_.push_back(t[0][j]);
|
||||||
LOG(Message) << setw(4) << right << k << ": "
|
LOG(Message) << std::setw(4) << std::right << k << ": "
|
||||||
<< program_[k] << endl;
|
<< program_[k] << std::endl;
|
||||||
k++;
|
k++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -153,7 +152,8 @@ void Application::configLoop(void)
|
|||||||
|
|
||||||
for (unsigned int t = range.start; t < range.end; t += range.step)
|
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();
|
execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -163,7 +163,7 @@ void Application::execute(void)
|
|||||||
for (unsigned int i = 0; i < program_.size(); ++i)
|
for (unsigned int i = 0; i < program_.size(); ++i)
|
||||||
{
|
{
|
||||||
LOG(Message) << "Measurement step (" << i+1 << "/" << program_.size()
|
LOG(Message) << "Measurement step (" << i+1 << "/" << program_.size()
|
||||||
<< ")" << endl;
|
<< ")" << std::endl;
|
||||||
(*module_[program_[i]])(env_);
|
(*module_[program_[i]])(env_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include <Hadrons/CMeson.hpp>
|
#include <Hadrons/CMeson.hpp>
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace Grid;
|
using namespace Grid;
|
||||||
using namespace Hadrons;
|
using namespace Hadrons;
|
||||||
|
|
||||||
@ -27,7 +26,7 @@ using namespace Hadrons;
|
|||||||
* CMeson implementation *
|
* CMeson implementation *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
// constructor /////////////////////////////////////////////////////////////////
|
// constructor /////////////////////////////////////////////////////////////////
|
||||||
CMeson::CMeson(const string &name)
|
CMeson::CMeson(const std::string &name)
|
||||||
: Module(name)
|
: Module(name)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -38,16 +37,16 @@ void CMeson::parseParameters(XmlReader &reader, const std::string &name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// dependency relation /////////////////////////////////////////////////////////
|
// 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;
|
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;
|
return output;
|
||||||
}
|
}
|
||||||
@ -61,5 +60,6 @@ double CMeson::nCreatedProp(void)
|
|||||||
// execution ///////////////////////////////////////////////////////////////////
|
// execution ///////////////////////////////////////////////////////////////////
|
||||||
void CMeson::operator()(Environment &env)
|
void CMeson::operator()(Environment &env)
|
||||||
{
|
{
|
||||||
LOG(Message) << "computing meson contraction '" << getName() << "'" << endl;
|
LOG(Message) << "computing meson contraction '" << getName() << "'"
|
||||||
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include <Hadrons/Environment.hpp>
|
#include <Hadrons/Environment.hpp>
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace Grid;
|
using namespace Grid;
|
||||||
using namespace Hadrons;
|
using namespace Hadrons;
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include <Hadrons/Global.hpp>
|
#include <Hadrons/Global.hpp>
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace Grid;
|
using namespace Grid;
|
||||||
using namespace Hadrons;
|
using namespace Hadrons;
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include <Hadrons/Application.hpp>
|
#include <Hadrons/Application.hpp>
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace Hadrons;
|
using namespace Hadrons;
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include <Hadrons/MQuark.hpp>
|
#include <Hadrons/MQuark.hpp>
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace Grid;
|
using namespace Grid;
|
||||||
using namespace Hadrons;
|
using namespace Hadrons;
|
||||||
|
|
||||||
@ -38,14 +37,14 @@ void MQuark::parseParameters(XmlReader &reader, const std::string &name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// dependency relation
|
// 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;
|
return out;
|
||||||
}
|
}
|
||||||
@ -59,5 +58,6 @@ double MQuark::nCreatedProp(void)
|
|||||||
// execution
|
// execution
|
||||||
void MQuark::operator()(Environment &env)
|
void MQuark::operator()(Environment &env)
|
||||||
{
|
{
|
||||||
LOG(Message) << "computing quark propagator '" << getName() << "'" << endl;
|
LOG(Message) << "computing quark propagator '" << getName() << "'"
|
||||||
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include <Hadrons/Module.hpp>
|
#include <Hadrons/Module.hpp>
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace Grid;
|
using namespace Grid;
|
||||||
using namespace Hadrons;
|
using namespace Hadrons;
|
||||||
|
|
||||||
@ -27,12 +26,12 @@ using namespace Hadrons;
|
|||||||
* Module implementation *
|
* Module implementation *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
// constructor /////////////////////////////////////////////////////////////////
|
// constructor /////////////////////////////////////////////////////////////////
|
||||||
Module::Module(const string &name)
|
Module::Module(const std::string &name)
|
||||||
: name_(name)
|
: name_(name)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
// access //////////////////////////////////////////////////////////////////////
|
// access //////////////////////////////////////////////////////////////////////
|
||||||
string Module::getName(void) const
|
std::string Module::getName(void) const
|
||||||
{
|
{
|
||||||
return name_;
|
return name_;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include <Hadrons/ModuleFactory.hpp>
|
#include <Hadrons/ModuleFactory.hpp>
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace Grid;
|
using namespace Grid;
|
||||||
using namespace Hadrons;
|
using namespace Hadrons;
|
||||||
|
|
||||||
@ -52,8 +51,8 @@ std::vector<std::string> ModuleFactory::getModuleList(void) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// factory /////////////////////////////////////////////////////////////////////
|
// factory /////////////////////////////////////////////////////////////////////
|
||||||
unique_ptr<Module> ModuleFactory::create(const string &type,
|
std::unique_ptr<Module> ModuleFactory::create(const std::string &type,
|
||||||
const string &name) const
|
const std::string &name) const
|
||||||
{
|
{
|
||||||
FactoryFunc func;
|
FactoryFunc func;
|
||||||
|
|
||||||
@ -61,7 +60,7 @@ unique_ptr<Module> ModuleFactory::create(const string &type,
|
|||||||
{
|
{
|
||||||
func = factory_.at(type);
|
func = factory_.at(type);
|
||||||
}
|
}
|
||||||
catch (out_of_range)
|
catch (std::out_of_range)
|
||||||
{
|
{
|
||||||
HADRON_ERROR("module type '" + type + "' unknown");
|
HADRON_ERROR("module type '" + type + "' unknown");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user