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:
parent
30146e977c
commit
17c43f49ac
@ -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)
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
|
||||
public:
|
||||
// constructor
|
||||
Application(int argc, char *argv[]);
|
||||
Application(const std::string parameterFileName);
|
||||
// destructor
|
||||
virtual ~Application(void);
|
||||
// execute
|
||||
|
@ -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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user