20#ifndef _GIMLI_TTDIJKSTRAMODDELING__H
21#define _GIMLI_TTDIJKSTRAMODDELING__H
24#include "modellingbase.h"
32 : time_(0.0), dist_(0.0){
34 GraphDistInfo(
double t,
double d)
37 GraphDistInfo(
double t,
double d, Index cellID)
39 cells_.insert(cellID);
46 double time()
const {
return time_; }
49 double dist()
const {
return dist_; }
52 std::set < Index > &
cellIDs() {
return cells_; }
55 const std::set < Index > &
cellIDs()
const {
return cells_; }
61 std::set < Index > cells_;
65typedef std::map< Index, GraphDistInfo > NodeDistMap;
67typedef std::map< Index, NodeDistMap > Graph;
71class DLLEXPORT Dijkstra {
75 Dijkstra(
const Graph & graph);
79 void setGraph(
const Graph & graph);
81 void setStartNode(Index startNode);
93 double distance(Index root, Index node);
108 const Graph & graph()
const {
113 return graph_[na][nb];
116 class Edge_ : std::pair< Index, Index > {
118 Edge_() : start(0), end(0) {}
119 Edge_(Index a, Index b) : start(a), end(b) {}
125 class DistancePair_ : std::pair< double, Edge_ > {
127 DistancePair_() : first(0.0) {}
128 DistancePair_(
double f,
Edge_ & s) : first(f), second(s) {}
136 bool operator() (
const T & lhs,
const T & rhs) {
137 return lhs.first > rhs.first;
142 std::vector < Edge_ > pathMatrix_;
144 NodeDistMap distances_;
152class DLLEXPORT TravelTimeDijkstraModelling :
public ModellingBase {
154 TravelTimeDijkstraModelling(
bool verbose=
false);
156 TravelTimeDijkstraModelling(
Mesh & mesh,
160 virtual ~TravelTimeDijkstraModelling() { }
164 RVector createGradientModel(
double lBound,
double uBound);
167 virtual RVector
response(
const RVector & slowness);
175 Graph createGraph(
const RVector & slownessPerCell)
const;
179 double findMedianSlowness()
const;
181 RVector getApparentSlowness()
const;
189 const IndexArray &
way(Index sht, Index rec)
const;
197 virtual void updateMeshDependency_();
228 virtual RVector
response(
const RVector & model);
234 size_t nShots(){
return shots_.size(); }
238 std::map< Index, Index > shotMap_;
DataContainer to store, load and save data in the GIMLi unified data format.
Definition datacontainer.h:48
Definition ttdijkstramodelling.h:134
Definition ttdijkstramodelling.h:116
Definition ttdijkstramodelling.h:71
void shortestPathTo(Index node, IndexArray &way) const
Definition ttdijkstramodelling.cpp:125
RVector distances(Index root)
Definition ttdijkstramodelling.cpp:65
double distance(Index root, Index node)
Definition ttdijkstramodelling.cpp:54
IndexArray shortestPath(Index start, Index end)
Definition ttdijkstramodelling.cpp:148
Definition ttdijkstramodelling.h:29
std::set< Index > & cellIDs()
Definition ttdijkstramodelling.h:52
double time() const
Definition ttdijkstramodelling.h:46
const std::set< Index > & cellIDs() const
Definition ttdijkstramodelling.h:55
void setTime(double t)
Definition ttdijkstramodelling.h:43
double dist() const
Definition ttdijkstramodelling.h:49
bool verbose() const
Definition modellingbase.h:48
MatrixBase * jacobian()
Definition modellingbase.h:118
virtual void createJacobian(const RVector &slowness)
Definition ttdijkstramodelling.cpp:666
void initJacobian()
Definition ttdijkstramodelling.cpp:658
virtual RVector response(const RVector &model)
Definition ttdijkstramodelling.cpp:643
virtual RVector createDefaultStartModel()
Definition ttdijkstramodelling.cpp:639
TTModellingWithOffset(Mesh &mesh, DataContainer &dataContainer, bool verbose)
Definition ttdijkstramodelling.cpp:615
std::map< Index, Index > shotsInv_
Definition ttdijkstramodelling.h:206
virtual RVector response(const RVector &slowness)
Definition ttdijkstramodelling.cpp:387
IndexArray shotNodeId_
Definition ttdijkstramodelling.h:203
std::vector< std::vector< IndexArray > > wayMatrix_
Definition ttdijkstramodelling.h:215
std::map< Index, Index > receiInv_
Definition ttdijkstramodelling.h:212
const IndexArray & way(Index sht, Index rec) const
Definition ttdijkstramodelling.cpp:444
virtual void createJacobian(const RVector &slowness)
Definition ttdijkstramodelling.cpp:494
const Dijkstra & dijkstra() const
Definition ttdijkstramodelling.h:192
virtual void initJacobian()
Definition ttdijkstramodelling.cpp:436
IndexArray receNodeId_
Definition ttdijkstramodelling.h:209
virtual RVector createDefaultStartModel()
Definition ttdijkstramodelling.cpp:173
GIMLi main namespace for the Geophyiscal Inversion and Modelling Library.
Definition baseentity.h:24