1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 07:55:35 +00:00

Hadrons: application class now take parameter file name as argument

This commit is contained in:
Antonin Portelli 2016-01-13 20:22:37 -08:00
parent 30146e977c
commit 17c43f49ac
3 changed files with 23 additions and 17 deletions

View File

@ -27,23 +27,11 @@ using namespace Hadrons;
* Application implementation *
******************************************************************************/
// constructor /////////////////////////////////////////////////////////////////
Application::Application(int argc, char *argv[])
: env_(Environment::getInstance())
Application::Application(const std::string parameterFileName)
: parameterFileName_(parameterFileName)
, env_(Environment::getInstance())
, modFactory_(ModuleFactory::getInstance())
{
if (argc < 2)
{
std::cerr << "usage: " << argv[0] << " <parameter file> [Grid options]";
std::cerr << std::endl;
std::exit(EXIT_FAILURE);
}
parameterFileName_ = argv[1];
Grid_init(&argc, &argv);
HadronsLogError.Active(GridLogError.isActive());
HadronsLogWarning.Active(GridLogWarning.isActive());
HadronsLogMessage.Active(GridLogMessage.isActive());
HadronsLogDebug.Active(GridLogDebug.isActive());
LOG(Message) << "Grid initialized" << std::endl;
LOG(Message) << "Modules available:" << std::endl;
auto list = modFactory_.getModuleList();
for (auto &m: list)

View File

@ -64,7 +64,7 @@ public:
public:
// constructor
Application(int argc, char *argv[]);
Application(const std::string parameterFileName);
// destructor
virtual ~Application(void);
// execute

View File

@ -23,7 +23,25 @@ using namespace Hadrons;
int main(int argc, char *argv[])
{
Application application(argc, argv);
// parse command line
std::string parameterFileName;
if (argc < 2)
{
std::cerr << "usage: " << argv[0] << " <parameter file> [Grid options]";
std::cerr << std::endl;
std::exit(EXIT_FAILURE);
}
parameterFileName = argv[1];
Grid_init(&argc, &argv);
HadronsLogError.Active(GridLogError.isActive());
HadronsLogWarning.Active(GridLogWarning.isActive());
HadronsLogMessage.Active(GridLogMessage.isActive());
HadronsLogDebug.Active(GridLogDebug.isActive());
LOG(Message) << "Grid initialized" << std::endl;
// execution
Application application(parameterFileName);
application.run();