C1DMTObjective.h

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

Generated on Tue Nov 3 13:24:13 2009 for GPLIB++ by  doxygen 1.5.8