19#ifndef _GIMLI_MODELLINGBASE__H
20#define _GIMLI_MODELLINGBASE__H
31class DLLEXPORT ModellingBase{
34 ModellingBase(
bool verbose=
false) ;
38 ModellingBase(
const Mesh & mesh,
bool verbose=
false);
42 virtual ~ModellingBase();
48 inline bool verbose()
const {
return verbose_;}
50 virtual RVector response(
const RVector & model) {
51 throwError(WHERE_AM_I +
" you need to implement a response "
58 virtual RVector
response_mt(
const RVector & model, Index i=0)
const {
59 throwError(WHERE_AM_I +
" if you want to use read only response "
60 "function to use in multi threading environment .. you need to "
65 inline RVector operator() (
const RVector & model){
return response(model); }
68 void setData(DataContainer & data);
71 DataContainer & data()
const;
80 virtual RVector startModel();
82 virtual void setStartModel(
const RVector & startModel);
86 void setMesh(
const Mesh & mesh,
bool ignoreRegionManager=
false);
88 inline Mesh * mesh() {
return mesh_; }
90 void createRefinedForwardMesh(
bool refine=
true,
bool pRefine=
false);
96 virtual void setJacobian(MatrixBase * J);
99 virtual void createJacobian(
const RVector & model);
105 virtual void createJacobian(
const RVector & model,
const RVector & resp);
112 virtual void createJacobian_mt(
const RVector & model,
const RVector & resp);
115 virtual void initJacobian();
128 throwError(WHERE_AM_I +
" Jacobian matrix is not initialized.");
130 return *
dynamic_cast< RMatrix *
>(jacobian_);
133 virtual RMatrix & jacobianRef() {
135 throwError(WHERE_AM_I +
" Jacobian matrix is not initialized.");
137 return *
dynamic_cast< RMatrix *
>(jacobian_);
149 virtual void clearConstraints();
151 virtual void initConstraints();
153 virtual void createConstraints();
159 virtual RSparseMapMatrix & constraintsRef()
const;
161 virtual RSparseMapMatrix & constraintsRef();
163 const RMatrix & solution()
const {
return solutions_; }
165 void mapModel(
const RVector & model,
double background=0);
171 RVector createMappedModel(
const RVector & model,
double background=-9e99)
const;
173 void setRegionManager(RegionManager * reg);
175 const RegionManager & regionManager()
const;
177 RegionManager & regionManager();
179 RegionManager & regionManagerRef(){
return regionManager(); }
181 bool verbose() {
return verbose_; }
184 Region * region(
int marker);
187 RVector createStartModel();
190 RVector createStartVector();
192 void initRegionManager();
207 void setMultiThreadJacobian(Index nThreads);
215 virtual void init_();
217 virtual void deleteMeshDependency_(){}
219 virtual void updateMeshDependency_(){}
221 virtual void updateDataDependency_(){}
223 void setMesh_(
const Mesh & mesh,
bool update=
true);
227 DataContainer * dataContainer_;
229 MatrixBase * jacobian_;
232 MatrixBase * constraints_;
233 bool ownConstraints_;
241 bool regionManagerInUse_;
242 bool ownRegionManager_;
245 Index nThreadsJacobian_;
248 RegionManager * regionManager_;
255class DLLEXPORT LinearModelling :
public ModellingBase {
258 : ModellingBase(mesh,
verbose){
263 : ModellingBase(mesh,
verbose){
269 virtual ~LinearModelling() { }
272 RVector
response(
const RVector & model);
DataContainer to store, load and save data in the GIMLi unified data format.
Definition datacontainer.h:48
RVector response(const RVector &model)
Definition modellingbase.cpp:565
virtual void createJacobian(const RVector &model)
Definition modellingbase.cpp:574
RVector createDefaultStartModel()
Definition modellingbase.cpp:576
Interface class for matrices.
Definition matrix.h:137
bool verbose() const
Definition modellingbase.h:48
MatrixBase * jacobian() const
Definition modellingbase.h:121
virtual void clearJacobian()
Definition modellingbase.h:141
void setVerbose(bool verbose)
Definition modellingbase.cpp:88
virtual void setJacobian(MatrixBase *J)
Definition modellingbase.cpp:225
virtual RVector createDefaultStartModel()
Definition modellingbase.h:74
virtual RMatrix & jacobianRef() const
Definition modellingbase.h:126
MatrixBase * jacobian()
Definition modellingbase.h:118
virtual RVector response_mt(const RVector &model, Index i=0) const
Definition modellingbase.h:58
Index multiThreadJacobian() const
Definition modellingbase.h:210
GIMLi main namespace for the Geophyiscal Inversion and Modelling Library.
Definition baseentity.h:24
void setThreadCount(Index nThreads)
Definition gimli.cpp:73