00001 #ifndef C1DMTOBJECTIVE_H 00002 #define C1DMTOBJECTIVE_H 00003 00004 #include "PlottableObjective.h" 00005 #include "MTStation.h" 00006 #include <boost/function.hpp> 00007 #include <boost/shared_ptr.hpp> 00008 00009 //! C1DMTObjective is the base class for MT misfit calculations from 1D models, it provides common functionality to calculate the misfit of various MT parameters 00010 class C1DMTObjective : public PlottableObjective{ 00011 public: 00012 // We have to declare some public typedefs that are needed below 00013 typedef boost::function<double (const MTTensor* const)> datafunc_t; 00014 typedef std::vector<datafunc_t> datafuncvector_t; 00015 private: 00016 //! A vector of member functions to MTTensor that return the data to fit 00017 datafuncvector_t DataFunctions; 00018 //! A vector of member functions that return the errors associated with the functions in DataFunctions 00019 datafuncvector_t ErrorFunctions; 00020 //! A vector of doubles that cotains the errorlevels associated with the functions in DataFunctions 00021 std::vector<double> ErrorLevels; 00022 //! have the fit parameters been set or do we use default values 00023 bool FitparametersSet; 00024 //! A copy of the data to fit 00025 MTStation MTData; 00026 //! This abstract function has to calculate the Synthetic data and fill the MTSynth object with it 00027 virtual void CalcSynthData(const ttranscribed &member) = 0; 00028 protected: 00029 virtual MTStation &GetMTSynth() = 0; 00030 public: 00031 //! function to set the parameters that determine the type of fit 00032 void SetFitParameters(const datafuncvector_t TheDataV,const datafuncvector_t TheErrorV 00033 ,const std::vector<double> TheErrLevel); 00034 void AppendFitParameters(const datafunc_t TheDataFunc, const datafunc_t TheErrorFunc, const double TheErrLevel); 00035 //! Calc misfit for a model given by member 00036 virtual void SafeParallel(const ttranscribed &member); 00037 virtual double PostParallel(const ttranscribed &member); 00038 //! return a vector with pointers to the functions used to calculate the errors 00039 const datafuncvector_t &GetErrorFunctions() const {return ErrorFunctions;} 00040 //! write the current model to a file 00041 virtual void WriteModel(const std::string &filename)=0; 00042 //! write the current model for plotting to a file 00043 virtual void WritePlot(const std::string &filename)=0; 00044 //! Write current data to a file 00045 virtual void WriteData(const std::string &filename)=0; 00046 //! We need data to fit for any objective function, so we want it as constructor parameter, but no implicit conversion 00047 C1DMTObjective(const MTStation &LocalMTData); 00048 C1DMTObjective(const C1DMTObjective &Old); 00049 virtual ~C1DMTObjective(); 00050 C1DMTObjective& operator= (const C1DMTObjective& source); 00051 }; 00052 00053 #endif
1.5.5