IMP  2.0.1
The Integrative Modeling Platform
LogOptimizerState.h
Go to the documentation of this file.
1 /**
2  * \file IMP/display/LogOptimizerState.h
3  * \brief Write geometry to a file during optimization
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  */
7 
8 #ifndef IMPDISPLAY_LOG_OPTIMIZER_STATE_H
9 #define IMPDISPLAY_LOG_OPTIMIZER_STATE_H
10 
11 #include <IMP/display/display_config.h>
12 #include "declare_Geometry.h"
13 #include "Writer.h"
14 #include <IMP/OptimizerState.h>
15 #include <IMP/SingletonContainer.h>
16 #include <IMP/display/geometry.h>
17 #include <IMP/Pointer.h>
18 #include <IMP/internal/utility.h>
19 #include <vector>
20 
21 IMPDISPLAY_BEGIN_NAMESPACE
22 
23 /** Write to a Writer periodically.
24  */
25 class IMPDISPLAYEXPORT WriteOptimizerState: public OptimizerState {
26  ::IMP::kernel::internal::Counter skip_steps_, call_number_, update_number_;
27  IMP::OwnerPointer<Writer> writer_;
28  void update();
29  public:
31  OptimizerState("WriteOptimizerState%1%"),
32  writer_(w) {}
33  void set_period(unsigned int p) {
34  skip_steps_=p-1;
35  call_number_=0;
36  }
37  IMP_LIST_ACTION(public, Geometry, Geometries, geometry, geometries,
38  Geometry*, Geometries,,,);
39  void write(WriterAdaptor w) const;
41  out << " writer: " << writer_->get_name() << std::endl;,);
42 };
44 
45 
46 IMPDISPLAY_END_NAMESPACE
47 
48 #endif /* IMPDISPLAY_LOG_OPTIMIZER_STATE_H */