00001 /*************************************************************************** 00002 ** 00003 ** This file is part of DinverCore. 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-13 00021 ** Authors: 00022 ** Marc Wathelet 00023 ** Marc Wathelet (LGIT, Grenoble, France) 00024 ** 00025 ***************************************************************************/ 00026 00027 #ifndef ACTIVEMODELS_H 00028 #define ACTIVEMODELS_H 00029 00030 #include "DinverCoreDLLExport.h" 00031 #include "ModelSet.h" 00032 #include "ActiveModel.h" 00033 00034 namespace DinverCore { 00035 00036 class DINVERCORE_EXPORT ActiveModels : private IncreaseStorage 00037 { 00038 public: 00039 ActiveModels(ModelSet * allModels); 00040 ~ActiveModels(); 00041 00042 inline ActiveModel& add(int modelIndex); 00043 inline ActiveModel& add(const ActiveModel& m); 00044 void clear(); 00045 //void addNavigatorHits(const QVector<int>& activeIndexes); 00046 void setNavigatorHits(const QVector<int>& activeIndexes); 00047 00048 void reserve(int n) {IncreaseStorage::reserve(n);} 00049 int count() const {return IncreaseStorage::size();} 00050 int parameterCount() const {return _allModels->parameterCount();} 00051 int targetCount() const {return _allModels->targetCount();} 00052 ModelSet * allModels() const {return _allModels;} 00053 00054 ActiveModel& at(int activeIndex) {return _infos[ activeIndex ];} 00055 const ActiveModel& at(int activeIndex) const {return _infos[ activeIndex ];} 00056 00057 inline const double * misfit(int activeIndex) const; 00058 //inline double volume(int activeIndex) const; 00059 inline const int * model(int activeIndex) const; 00060 00061 void print(int activeIndex); 00062 private: 00063 virtual void reallocate(); 00064 00065 ModelSet * _allModels; 00066 ActiveModel * _infos; 00067 }; 00068 00069 inline ActiveModel& ActiveModels::add(int modelIndex) 00070 { 00071 _infos[size()]=modelIndex; 00072 IncreaseStorage::add(); 00073 return _infos[size()-1]; // reallocate possible with add 00074 } 00075 00076 inline ActiveModel& ActiveModels::add(const ActiveModel& m) 00077 { 00078 _infos[size()]=m; 00079 IncreaseStorage::add(); 00080 return _infos[size()-1]; // reallocate possible with add 00081 } 00082 00083 inline const double * ActiveModels::misfit(int activeIndex) const 00084 { 00085 return _allModels->misfit(_infos[ activeIndex ].modelIndex()); 00086 } 00087 00088 /*inline double ActiveModels::volume(int activeIndex) const 00089 { 00090 return _models->volume(_infos[ activeIndex ].modelIndex()); 00091 }*/ 00092 00093 inline const int * ActiveModels::model(int activeIndex) const 00094 { 00095 return _allModels->model(_infos[ activeIndex ].modelIndex()); 00096 } 00097 00098 } // namespace DinverCore 00099 00100 #endif // ACTIVEMODELS_H