Environment.cpp 836 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include "Environment.hpp"

// AMDiS includes
#include <amdis/Initfile.hpp>
#include <amdis/Output.hpp>

namespace AMDiS
{
  Environment::Environment(std::string const& initFileName)
  {
    Parameters::clearData();
    if (!initFileName.empty())
      Parameters::init(initFileName);
  }

  Environment::Environment(int& argc, char**& argv, std::string const& initFileName)
    : Environment(initFileName)
  {
    auto& helper = Dune::MPIHelper::instance(argc, argv);

    auto& mpi = Mpi::instance();
    mpi.registerMpiHelper(helper);

    Parameters::clearData();
    if (initFileName.empty()) {
      if (argc > 1)
        Parameters::init(argv[1]);
      else
        warning("No initfile specified. Using default values for all parameters.");
    }
  }

} // end namespace AMDiS