PDEOptIterCallbackBase.hpp
Go to the documentation of this file.
00001 #ifndef PDEOPT_ITER_CALLBACK_BASE_H
00002 #define PDEOPT_ITER_CALLBACK_BASE_H
00003 
00004 #include "SundanceDefs.hpp"
00005 #include <string>
00006 
00007 namespace Sundance
00008 {
00009 
00010 class PDEConstrainedObjBase;
00011 
00012 /**
00013  * IterCallbackBase provides an abstract interface for callbacks to be
00014  * performed at the start of each optimization iteration.
00015  */
00016 class IterCallbackBase 
00017 {
00018 public:
00019   /** */
00020   virtual ~IterCallbackBase(){}
00021 
00022   /** */
00023   virtual void call(const PDEConstrainedObjBase* obj, int iter) const = 0 ;
00024 };
00025 
00026 
00027 
00028 /**
00029  * Default callback writes all variables to disk at a specified frequency
00030  */
00031 class DefaultIterCallback : public IterCallbackBase
00032 {
00033 public:
00034 
00035   /** */
00036   DefaultIterCallback(
00037     const std::string& filename, 
00038     const std::string& type,
00039     int frequency=1);
00040 
00041   /** */
00042   virtual ~DefaultIterCallback(){}
00043 
00044   /** */
00045   void call(const PDEConstrainedObjBase* obj, int iter) const ;
00046 
00047 private:
00048   std::string type_;
00049   std::string filename_;
00050   int frequency_;
00051 };
00052 
00053 
00054 
00055 
00056   
00057 }
00058 
00059 #endif

Site Contact