Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef InversionThread_H
00029 #define InversionThread_H
00030
00031 #include <DinverCore.h>
00032
00033 class InversionThread : public Thread, public XMLClass
00034 {
00035 Q_OBJECT
00036 public:
00037 InversionThread(QObject * parent=0);
00038 ~InversionThread();
00039
00040 virtual const QString& xml_tagName() const {return xmlInversionThreadTag;}
00041 static const QString xmlInversionThreadTag;
00042
00043 bool operator==(const InversionThread& o) const {return _models==o._models;}
00044 bool operator!=(const InversionThread& o) const {return !(_models==o._models);}
00045
00046 void setForward(AbstractForward * forward);
00047 void setStorage();
00048 void setObjectName(QString name);
00049 bool setReportDir(const QDir& d);
00050 QDir reportDir() const;
00051 bool isReportExists() const {QFileInfo fi(_reportFileName); return fi.exists();}
00052 bool hasReportFile() const {return _hasReportFile;}
00053 bool hasModelsToImport() const {return _hasModelsToImport;}
00054 void checkImportModels();
00055 void importModels(QString fileName, bool strict=true) {_models.importModels(fileName, strict);}
00056 QString reportFileName() const {return _reportFileName;}
00057 void removeReport();
00058
00059 void start();
00060 void terminate();
00061 void clear();
00062
00063 void setImportOnly() {_importOnly=true;}
00064 void setNs0(int ns0) {_ns0=ns0;}
00065 void setNs(int ns) {_ns=ns;}
00066 void setNr(int nr) {_nr=nr;}
00067 void setNw(int nw) {_nw=nw;}
00068 void setGiveUp(double giveUp) {_giveUp=giveUp;}
00069
00070 int ns0() const {return _ns0;}
00071 int ns() const {return _ns;}
00072 int nr() const {return _nr;}
00073 int nw() const {return _nw;}
00074 double giveUp() const {return _giveUp;}
00075 void setTuningParameters(InversionThread * t);
00076
00077 void lock() const {_models.lock();}
00078 void unlock() const {_models.unlock();}
00079
00080 int expectedModelCount() const {return _models.expectedModelCount();}
00081 int visitedModelCount() const {return _models.visitedModelCount();}
00082 int validModelCount() const;
00083 int activeModelCount() const {return _models.activeModelCount();}
00084 int rejectedCount() const {return _models.rejectedCount();}
00085 int giveUpCount() const {return _models.giveUpCount();}
00086 int bestModelCount() const {return _models.bestModelCount();}
00087 int variableParameterCount() const {return _models.variableParameterCount();}
00088 double reportBestMisfit() const {return _reportBestMisfit;}
00089
00090 double misfit(int modelIndex) const {return _models.misfit(modelIndex);}
00091 AbstractForward * forward() {return _models.forward();}
00092 const Parameter * variableParameter(int paramIndex) const {return _models.variableParameter(paramIndex);}
00093 double variableParameterValue(int modelIndex, int paramIndex) const {return _models.variableParameterValue(modelIndex, paramIndex);}
00094 signals:
00095 void started();
00096 void stopped();
00097 protected:
00098 virtual void run();
00099
00100 virtual void xml_writeProperties(XML_WRITEPROPERTIES_ARGS) const;
00101 virtual void xml_writeChildren(XML_WRITECHILDREN_ARGS) const;
00102 virtual XMLMember xml_member(XML_MEMBER_ARGS);
00103 virtual bool xml_setProperty(XML_SETPROPERTY_ARGS);
00104 virtual void xml_polish(XML_POLISH_ARGS);
00105 private:
00106 void renameReport(const QString& oldName);
00107 void importModelsFromAscii(QString fileName);
00108 void importModelsFromReport(QString fileName, bool strict);
00109
00110 int _ns0, _ns, _nr, _nw, _itmax;
00111 double _giveUp;
00112 QString _reportFileName;
00113 bool _importOnly;
00114 bool _hasReportFile;
00115 bool _hasModelsToImport;
00116 int _reportValidModelCount;
00117 double _reportBestMisfit;
00118
00119 ModelRepository _models;
00120 };
00121
00122 #endif