Line data Source code
1 : // Copyright (C) 2015 Technische Universitaet Muenchen
2 : // This file is part of the Mamico project. For conditions of distribution
3 : // and use, please see the copyright notice in Mamico's main folder, or at
4 : // www5.in.tum.de/mamico
5 : #ifndef _MOLECULARDYNAMICS_CONFIGURATIONS_MPICONFIGURATION_H_
6 : #define _MOLECULARDYNAMICS_CONFIGURATIONS_MPICONFIGURATION_H_
7 :
8 : #include "simplemd/MolecularDynamicsDefinitions.h"
9 : #include "tarch/configuration/Configuration.h"
10 : #include "tarch/la/Vector.h"
11 : #include <iostream>
12 :
13 : namespace simplemd {
14 : namespace configurations {
15 : class MPIConfiguration;
16 : }
17 : } // namespace simplemd
18 :
19 : /** configuration for distributed MPI MD simulations. Currently only contains
20 : * the splitting of the processes for the domain.
21 : * @author Philipp Neumann
22 : */
23 : class simplemd::configurations::MPIConfiguration : public tarch::configuration::Configuration {
24 : public:
25 : MPIConfiguration();
26 408 : virtual ~MPIConfiguration() {}
27 :
28 : void parseSubtag(tinyxml2::XMLElement* node);
29 :
30 : /**
31 : * Return name of xml tag that is associated to the configuration.
32 : */
33 : std::string getTag() const;
34 :
35 : /**
36 : * Is config valid?
37 : *
38 : * This operation usually fails, if
39 : *
40 : * - parseSubtag() hasn't been called, i.e. configuration has not been
41 : * used, or
42 : * - parseSubtag() failed due to a wrong file.
43 : *
44 : * If a tag ain't optional and parseSubtag() was not called (first case)
45 : */
46 : bool isValid() const;
47 :
48 : /** getters */
49 4 : const tarch::la::Vector<MD_DIM, unsigned int>& getNumberOfProcesses() const { return _numberOfProcesses; }
50 :
51 : private:
52 : static const std::string NUMBER_OF_PROCESSES;
53 :
54 : tarch::la::Vector<MD_DIM, unsigned int> _numberOfProcesses;
55 : bool _isValid;
56 : };
57 :
58 : #endif // _MOLECULARDYNAMICS_CONFIGURATIONS_MPICONFIGURATION_H_
|