IMP  2.0.0
The Integrative Modeling Platform
SaveOptimizerState.h
Go to the documentation of this file.
1 /**
2  * \file IMP/rmf/SaveOptimizerState.h
3  * \brief Handle read/write of Model data from/to files.
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPRMF_SAVE_OPTIMIZER_STATE_H
10 #define IMPRMF_SAVE_OPTIMIZER_STATE_H
11 
12 #include <IMP/rmf/rmf_config.h>
13 #include "atom_io.h"
14 #include "restraint_io.h"
15 #include "particle_io.h"
16 #include "geometry_io.h"
19 #include <IMP/atom/Simulator.h>
20 
21 IMPRMF_BEGIN_NAMESPACE
22 
23 /** Periodically call the save_frame() method to save the everything
24  associated with the RMF file to file.
25 */
26 class IMPRMFEXPORT SaveOptimizerState:
28  RMF::FileHandle fh_;
30  public:
31  SaveOptimizerState(RMF::FileHandle fh);
32 #ifndef IMP_DOXYGEN
33  IMP_LIST_ACTION(public, Hierarchy, Hierarchies,
34  hierarchy, hierarchies, Particle*,
35  Particles,
36  {
38  },{},
39  {});
40  IMP_LIST_ACTION(public, Restraint, Restraints,
41  restraint, restraints, Restraint*,
42  Restraints,
43  {
44  rmf::add_restraints(fh_, RestraintsTemp(1,obj));
45  },{},
46  {});
47  IMP_LIST_ACTION(public, Particle, Particles,
48  particle, particles, Particle*,
49  Particles,
50  {
51  rmf::add_particles(fh_, ParticlesTemp(1,obj));
52  },{},
53  {});
54  IMP_LIST_ACTION(public, Geometry, Geometries,
55  geometry, geometries, display::Geometry*,
57  {
58  rmf::add_geometries(fh_, display::GeometriesTemp(1,obj));
59  },{},
60  {});
61 #endif
62  //! Use the simulator to tag frames with current time
63  /** \note This may change to a more general mechanism at some point
64  in the future.
65  */
66  void set_simulator(atom::Simulator *sim);
67  //! Write a frame with a given name
68  void update_always(std::string name);
69  // to prevent it from being hidden
70  void update_always() {
72  }
73  virtual void do_update(unsigned int call_num) IMP_OVERRIDE;
75 };
76 
77 
78 IMPRMF_END_NAMESPACE
79 
80 #endif /* IMPRMF_SAVE_OPTIMIZER_STATE_H */