38 #ifndef TAUPSITEFNCTNLS_H
39 #define TAUPSITEFNCTNLS_H
158 tpzRRcvr(0.0), tpzRRcvrSgn(1.0), tpzPLast(-1.0),
159 tpzDLast(-1.0), tpzD(0.0), tpzPT(0.0),
160 tpzRayLegDist(0.0), tpzRayLegTime(0.0),
161 tpzSrcLegDist(0.0), tpzSrcLegTime(0.0),
162 tpzRcvrLegDist(0.0), tpzRcvrLegTime(0.0),
163 tpzIsTurningZero(true), tpzIsRayLegValid(false),
164 tpzIsRcvrLegValid(false), tpzIsSrcLegValid(false),
165 tpzRadius(EARTH_RAD) {};
170 tpzTPS(tps), tpzRSrc(0.0), tpzRSrcSgn(1.0),
171 tpzRRcvr(0.0), tpzRRcvrSgn(1.0), tpzPLast(-1.0),
172 tpzDLast(-1.0), tpzD(0.0), tpzPT(0.0),
173 tpzRayLegDist(0.0), tpzRayLegTime(0.0),
174 tpzSrcLegDist(0.0), tpzSrcLegTime(0.0),
175 tpzRcvrLegDist(0.0), tpzRcvrLegTime(0.0),
176 tpzIsTurningZero(true), tpzIsRayLegValid(false),
177 tpzIsRcvrLegValid(false), tpzIsSrcLegValid(false),
178 tpzRadius(EARTH_RAD) {};
183 tpzRSrc(tpzf.tpzRSrc), tpzRSrcSgn(tpzf.tpzRSrcSgn),
184 tpzRRcvr(tpzf.tpzRRcvr), tpzRRcvrSgn(tpzf.tpzRRcvrSgn),
185 tpzPLast(tpzf.tpzPLast), tpzDLast(tpzf.tpzDLast),
186 tpzD(tpzf.tpzD), tpzPT(tpzf.tpzPT),
187 tpzRayLegDist(tpzf.tpzRayLegDist),
188 tpzRayLegTime(tpzf.tpzRayLegTime),
189 tpzSrcLegDist(tpzf.tpzSrcLegDist),
190 tpzSrcLegTime(tpzf.tpzSrcLegTime),
191 tpzRcvrLegDist(tpzf.tpzRcvrLegDist),
192 tpzRcvrLegTime(tpzf.tpzRcvrLegTime),
193 tpzIsTurningZero(tpzf.tpzIsTurningZero),
194 tpzIsRayLegValid(tpzf.tpzIsRayLegValid),
195 tpzIsRcvrLegValid(tpzf.tpzIsRcvrLegValid),
196 tpzIsSrcLegValid(tpzf.tpzIsSrcLegValid),
197 tpzRadius(tpzf.tpzRadius) {};
211 tpzRSrc = tpzf.tpzRSrc;
212 tpzRSrcSgn = tpzf.tpzRSrcSgn;
213 tpzRRcvr = tpzf.tpzRRcvr;
214 tpzRRcvrSgn = tpzf.tpzRRcvrSgn;
215 tpzPLast = tpzf.tpzPLast;
216 tpzDLast = tpzf.tpzDLast;
217 tpzRayLegDist = tpzf.tpzRayLegDist;
218 tpzRayLegTime = tpzf.tpzRayLegTime;
219 tpzSrcLegDist = tpzf.tpzSrcLegDist;
220 tpzSrcLegTime = tpzf.tpzSrcLegTime;
221 tpzRcvrLegDist = tpzf.tpzRcvrLegDist;
222 tpzRcvrLegTime = tpzf.tpzRcvrLegTime;
223 tpzRadius = tpzf.tpzRadius;
224 tpzTPS = tpzf.tpzTPS;
225 tpzIsTurningZero = tpzf.tpzIsTurningZero;
226 tpzIsRayLegValid = tpzf.tpzIsRayLegValid;
227 tpzIsRcvrLegValid = tpzf.tpzIsRcvrLegValid;
228 tpzIsSrcLegValid = tpzf.tpzIsSrcLegValid;
251 if (tpzIsTurningZero)
252 tpzDLast = getTurningZero();
254 tpzDLast = getUpGoingZero();
268 tpzIsTurningZero =
true;
275 return tpzIsTurningZero;
282 return (tpzD - (2.0 * tpzRayLegDist - tpzRSrcSgn * tpzSrcLegDist -
283 tpzRRcvrSgn * tpzRcvrLegDist));
290 return (tpzIsRayLegValid && tpzIsRcvrLegValid && tpzIsSrcLegValid);
297 tpzIsTurningZero =
false;
304 return !tpzIsTurningZero;
313 return (tpzD - tpzSrcLegDist);
320 return (tpzIsRcvrLegValid && tpzIsSrcLegValid);
356 tpzRSrcSgn = setRadius(r);
370 setSourceRadius(tpzRadius - d);
376 return tpzRadius - tpzRSrc;
382 tpzRRcvrSgn = setRadius(r);
396 setReceiverRadius(tpzRadius - d);
402 return tpzRadius - tpzRRcvr;
460 return tpzRRcvrSgn * tpzRcvrLegDist;
484 double setRadius(
double& r)
494 r = 2.0 * tpzRadius - r;
533 double tpzRayLegDist;
536 double tpzRayLegTime;
539 double tpzSrcLegDist;
542 double tpzSrcLegTime;
545 double tpzRcvrLegDist;
548 double tpzRcvrLegTime;
552 bool tpzIsTurningZero;
556 bool tpzIsRayLegValid;
560 bool tpzIsRcvrLegValid;
564 bool tpzIsSrcLegValid;
Function object used by the Brents minF function to find the minimum (or maximum) of a retrograde lay...
SplitDistance(TauPSite *tps)
Standard constructor sets the internal TauPModel and a set of velocity layers.
double operator()(double p)
Function object operator() definition. This operator returns the ray distance as a function of the in...
SplitDistance & operator=(const SplitDistance &sd)
Assignment operator.
SplitDistance(const SplitDistance &sd)
Copy constructor.
virtual ~SplitDistance()
Destructor.
The primary layer search functional used by Brents zeroIn(...) function to find layers that contain a...
void setTauPSite(TauPSite *tps)
Sets the TauPSite.
TPZeroFunctional & operator=(const TPZeroFunctional &tpzf)
Assignment operator.
double getSourceDepth() const
Returns the source depth.
void setSourceRadius(double r)
Sets the source radius and sign.
void distance(double p)
The primary function of this object which calculates the ray travel distance between the source and t...
void setPTop(double p)
Sets the layer top ray parameter p for the current search layer.
void setDist(double d)
Sets the search distance between the source and receiver.
TPZeroFunctional(TauPSite *tps)
Standard constructor. Assigns the TauPSite for this TPZeroFunctional.
void setReceiverDepth(double d)
Sets the receiver radius and sign from the input depth.
double operator()(double p)
The function objects operator() definition which is used by a Brents::zeroIn(...) function to find th...
void setReceiverRadius(double r)
Sets the receiver radius and sign.
double getPTop() const
Gets the layer top ray parameter p for the current search layer.
double getReceiverLegTime() const
Returns the surface-to-receiver ray time.
double getRayDistance() const
Returns the surface-to-surface ray distance.
double getDist() const
Sets the search distance between the source and receiver.
double getTurningZero()
Returns the turning leg zero evaluation from the last distance() function evaluation.
double getReceiverRadius() const
Returns the receiver radius.
double getReceiverDepth() const
Returns the receiver depth.
TPZeroFunctional()
Default constructor.
bool isTurningZero()
Returns true if the turning zero is set for return by the operator() function (tpzIsTurningZero is tr...
double getSourceLegTime() const
Returns the surface-to-source ray time.
double getPlanetRadius() const
Returns the planet radius (default to Earth = 6371.0 km)
double getSourceRadius() const
Returns the source radius.
TPZeroFunctional(const TPZeroFunctional &tpzf)
Copy constructor.
double getSourceLegDistance() const
Returns the surface-to-source ray distance.
bool isUpGoingRayValid()
Returns true if the upgoing receiver and source legs are valid in the last distance() function call e...
double getReceiverLegDistance() const
Returns the surface-to-receiver ray distance.
bool isTurningRayValid()
Returns true if the turning ray, receiver, and source legs are valid in the last distance() function ...
int getReceiverLayerId() const
Return the layer containing the receiver position.
double getMinP()
Returns the minimum allowable ray parameter for a ray to transfer between the source and receiver dep...
void setUpGoingZero()
Sets the upgoing zero for the operator() function (tpzIsTurningZero is set to false).
TauPSite & getTauPSite()
Gets the TauPSite.
int getRadiusLayerId(double r) const
Return the layer containing the input radius r.
double getRayTime() const
Returns the surface-to-surface ray time.
double getUpGoingZero()
Returns the upgoing leg zero evaluation from the last distance() function evaluation.
bool isUpGoingZero()
Returns true if the upgoing zero is set for return by the operator() function (tpzIsTurningZero is fa...
void setSourceDepth(double d)
Sets the source radius and sign from the input depth.
virtual ~TPZeroFunctional()
Destructor.
void setPlanetRadius(double pr)
Sets the planet radius (default to Earth = 6371.0 km)
double time(double p)
Calculates the travel time between the source and receiver for the current layer at the zero in ray p...
int getSourceLayerId() const
Return the layer containing the source position.
void setTurningZero()
Sets the turning zero for the operator() function (tpzIsTurningZero is set to true).