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_MOLECULEMAPPINGS_WRITECHECKPOINTMAPPING_H_
6 : #define _MOLECULARDYNAMICS_MOLECULEMAPPINGS_WRITECHECKPOINTMAPPING_H_
7 :
8 : #include "simplemd/Molecule.h"
9 : #include "simplemd/services/ParallelTopologyService.h"
10 : #include <cstdlib>
11 : #include <fstream>
12 : #include <iomanip>
13 : #include <iostream>
14 : #include <sstream>
15 :
16 : namespace simplemd {
17 : namespace moleculemappings {
18 : class WriteCheckPointMapping;
19 : }
20 : } // namespace simplemd
21 :
22 : /** writes checkpoint data for e.g. restarts.
23 : *
24 : * @author Philipp Neumann
25 : */
26 : class simplemd::moleculemappings::WriteCheckPointMapping {
27 : public:
28 4 : WriteCheckPointMapping(const simplemd::services::ParallelTopologyService& parallelTopologyService, const std::string& filestem, const unsigned int& t)
29 8 : : _parallelTopologyService(parallelTopologyService), _file(NULL), _filestem(filestem), _t(t) {}
30 4 : ~WriteCheckPointMapping() {}
31 :
32 : void beginMoleculeIteration();
33 : void endMoleculeIteration();
34 : void handleMolecule(Molecule& molecule);
35 :
36 : static const bool IsParallel = false;
37 :
38 : private:
39 : const simplemd::services::ParallelTopologyService& _parallelTopologyService;
40 : std::ofstream* _file;
41 : const std::string _filestem;
42 : const unsigned int _t;
43 : unsigned int _particleCounter;
44 : std::stringstream _moleculedata;
45 : };
46 :
47 : #endif // _MOLECULARDYNAMICS_MOLECULEMAPPINGS_WRITECHECKPOINTMAPPING_H_
|