/** * \file LogOptimizerState.h * \brief Write geometry to a file during optimization * * Copyright 2007-2010 IMP Inventors. All rights reserved. */ #ifndef IMPDISPLAY_LOG_OPTIMIZER_STATE_H #define IMPDISPLAY_LOG_OPTIMIZER_STATE_H #include "display_config.h" #include "Writer.h" #include #include #include #include #include #include #include IMPDISPLAY_BEGIN_NAMESPACE IMP_MODEL_SAVE(Write, (Writer *writer, std::string file_name), mutable IMP::internal::OwnerPointer writer_; Geometries gdata_;, writer_=writer;, void add_geometry(Geometry* g) { gdata_.push_back(g); g->set_was_used(true); } void add_geometry(const Geometries& g) { for (unsigned int i=0; i< g.size(); ++i) { add_geometry(g); } }, { IMP_LOG(TERSE, "Writing log file " << file_name << std::endl); writer_->set_output(file_name); for (unsigned int i=0; i < gdata_.size(); ++i) { writer_->add_geometry(gdata_[i]); } writer_->close(); }); #ifndef IMP_DOXYGEN typedef WriteOptimizerState LogOptimizerState; typedef WriteFailureHandler DisplayModelOnFailure; #endif IMPDISPLAY_END_NAMESPACE #endif /* IMPDISPLAY_LOG_OPTIMIZER_STATE_H */