00001 /*************************************************************************** 00002 ** 00003 ** This file is part of dinverdc. 00004 ** 00005 ** This file may be distributed and/or modified under the terms of the 00006 ** GNU General Public License version 2 or 3 as published by the Free 00007 ** Software Foundation and appearing in the file LICENSE.GPL included 00008 ** in the packaging of this file. 00009 ** 00010 ** This file is distributed in the hope that it will be useful, but WITHOUT 00011 ** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 ** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 00013 ** more details. 00014 ** 00015 ** You should have received a copy of the GNU General Public License 00016 ** along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 ** 00018 ** See http://www.geopsy.org for more information. 00019 ** 00020 ** Created : 2009-05-14 00021 ** Authors: 00022 ** Marc Wathelet 00023 ** Marc Wathelet (LGIT, Grenoble, France) 00024 ** 00025 ***************************************************************************/ 00026 00027 #ifndef FORWARD_H 00028 #define FORWARD_H 00029 00030 #include <DinverCore.h> 00031 #include <DinverDCCore.h> 00032 00033 class Forward : public AbstractForward 00034 { 00035 TRANSLATIONS("Forward") 00036 public: 00037 Forward(); 00038 ~Forward(); 00039 00040 bool setParamSpace(ParamGroundModel * gm); 00041 void setTargets(TargetList * tl) {_targets=tl;} 00042 00043 ParamGroundModel * paramGroundModel() const {return _paramModel;} 00044 TargetList * targetList() const {return _targets;} 00045 00046 virtual AbstractForward * clone() const; 00047 virtual int maximumThreadCount() const {return RAND_MAX;} 00048 00049 inline virtual double misfit(bool& ok); 00050 inline virtual void writeReport(ReportWriter * report); 00051 inline virtual void valueChanged(const Parameter * p=0); 00052 inline virtual bool isFussyOk(const Parameter * p); 00053 protected: 00054 virtual void xml_writeChildren(XML_WRITECHILDREN_ARGS) const; 00055 virtual XMLMember xml_member(XML_MEMBER_ARGS); 00056 virtual void xml_polish(XML_POLISH_ARGS); 00057 private: 00058 ParamGroundModel * _paramModel; 00059 TargetList * _targets; 00060 }; 00061 00062 inline double Forward::misfit(bool& ok) 00063 { 00064 TRACE; 00065 return _targets->misfit(parameterSpace().variableParameterCount(), ok); 00066 } 00067 00068 inline void Forward::valueChanged(const Parameter * p) 00069 { 00070 if(!p || _targets->isGroundModelParameter(p)) { 00071 _paramModel->updateFinalProfiles(static_cast<const GroundParameter *>(p)); 00072 } 00073 } 00074 00075 inline bool Forward::isFussyOk(const Parameter * p) 00076 { 00077 if(_targets->isGroundModelParameter(p)) { 00078 return _targets->isPoissonRatioOk(static_cast<const GroundParameter *>(p)); 00079 } else { 00080 return false; 00081 } 00082 } 00083 00084 inline void Forward::writeReport(ReportWriter * report) 00085 { 00086 _targets->writeReport(report); 00087 } 00088 00089 #endif // FORWARD_H