RSTT 3.2.1 Regional Seismic Travel Time

Loading...
Searching...
No Matches
TPVelocityModels.h
Go to the documentation of this file.
1//- ****************************************************************************
2//-
3//- Copyright 2009 National Technology & Engineering Solutions of Sandia, LLC
4//- (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
5//- Government retains certain rights in this software.
6//-
7//- BSD Open Source License
8//- All rights reserved.
9//-
10//- Redistribution and use in source and binary forms, with or without
11//- modification, are permitted provided that the following conditions are met:
12//-
13//- 1. Redistributions of source code must retain the above copyright notice,
14//- this list of conditions and the following disclaimer.
15//-
16//- 2. Redistributions in binary form must reproduce the above copyright
17//- notice, this list of conditions and the following disclaimer in the
18//- documentation and/or other materials provided with the distribution.
19//-
20//- 3. Neither the name of the copyright holder nor the names of its
21//- contributors may be used to endorse or promote products derived from
22//- this software without specific prior written permission.
23//-
24//- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25//- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26//- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27//- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
28//- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29//- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30//- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31//- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32//- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33//- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34//- POSSIBILITY OF SUCH DAMAGE.
35//-
36//- ****************************************************************************
37
38#ifndef TPVELOCITYMODELS_H
39#define TPVELOCITYMODELS_H
40
41// **** _SYSTEM INCLUDES_ ******************************************************
42#include <float.h>
43#include <vector>
44#include <cmath>
45#include <iostream>
46
47 using namespace std;
48// use standard library objects
49
50// **** _LOCAL INCLUDES_ *******************************************************
51
52#include "TauPGlobals.h"
53#include "IntegrateFunction.h"
54#include "DataBuffer.h"
55#include "CPPUtils.h"
56
57 using util::DataBuffer;
58
59 using namespace geotess;
60
61//template<class F> class util::IntegrateFunction;
62
63// **** _BEGIN TAUP NAMESPACE_ *************************************************
64
65 namespace taup {
66
67// **** _CLASS CONSTANTS_ ******************************************************
68// **** _FORWARD REFERENCES_ ***************************************************
69
70 class TPVelocityLayer;
71 class VelocityConst;
72 class VelocityPower;
73 class VelocityLinear;
74 class VelocityQuadratic;
75 class VelocityCubic;
76
77 template<class V> class TPdDistdr;
78 template<class V> class TPdTaudr;
79
80// *****************************************************************************
81//
83//
97//
98// *****************************************************************************
99 template<class V>
100 class TPdDistdr
101{
102 public:
103
105 //
108 TPdDistdr(V& v) : diV(v), diP(0.0) {};
109
111 TPdDistdr(const TPdDistdr<V>& di) : diV(di.diV), diP(di.diP) {};
112
114 virtual ~TPdDistdr() {};
115
117 //
121 TPdDistdr& operator=(const TPdDistdr<V>& di)
122 {
123 diP = di.diP;
124 return *this;
125 };
126
129 double operator()(double r)
130 {
131 double pv = diP * diV(r);
132 double d = fabs(r - pv) * (r + pv);
133 if (d == 0.0)
134 return 1.0 / sqrt(DBL_EPSILON * (r + pv));
135 else
136 return pv / r / sqrt(d);
137 };
138
140 void setP(double p) {diP = p;};
141
142 private:
143
145 double diP;
146
148 V& diV;
149};
150
151// *****************************************************************************
152//
155//
169//
170// *****************************************************************************
171 template<class V>
172 class TPdTaudr
173{
174 public:
175
177 //
180 TPdTaudr(V& v) : tiV(v), tiP(0.0) {};
181
183 TPdTaudr(const TPdTaudr& ti) : tiV(ti.tiV), tiP(ti.tiP) {};
184
186 virtual ~TPdTaudr() {};
187
189 //
193 TPdTaudr& operator=(const TPdTaudr& ti)
194 {
195 tiP = ti.tiP;
196 return *this;
197 };
198
201 double operator()(double r)
202 {
203 double vr = tiV(r);
204 double pv = tiP * vr;
205
206 return sqrt(fabs(r - pv) * (r + pv)) / r / vr;
207 };
208
210 void setP(double p) {tiP = p;};
211
212 private:
213
215 double tiP;
216
218 V& tiV;
219};
220
221// *****************************************************************************
222//
228//
262//
263// *****************************************************************************
264 class TAUP_EXP TPVelocityLayer
265{
266 public:
267
268 // **** _PUBLIC LIFCYCLES_ *************************************************
269
271 TPVelocityLayer() : vlRt(0.0), vlRb(0.0), vlVt(-1.0), vlVb(-1.0),
272 vlPt(-1.0), vlPb(-1.0), vlRLast(-1.0),
273 vlDistT(0.0), vlDistB(0.0), vlIRt(0.0), vlIRb(0.0),
274 vlPmin(-1.0), vlLayerType(-1),
275 vlPCrit(-1.0), vlRTurn(-1.0), vlDistCrit(-1.0),
276 vlSplitLayer(false), vlInvalidRay(false),
277 vlPassingRay(false), vlTurningRay(false),
278 vldDistdP_T(0.0), vldDistdP_B(0.0), vlVTurn(-1.0),
279 vlPhaseUpperIDef(false), vlPhaseLowerIDef(false),
280 vlLayerName("")
281 {
282 vlPhase = vlPhaseUpper = vlPhaseLower = vlPhaseType= "";
283 vlPhaseIUpper = vlPhaseILower = "";
284 };
285
288 TPVelocityLayer(double rt, double rb, const string& layrnam) :
289 vlRt(rt), vlRb(rb), vlVt(-1.0), vlVb(-1.0),
290 vlPt(-1.0), vlPb(-1.0), vlRLast(-1.0),
291 vlDistT(0.0), vlDistB(0.0), vlIRt(0.0), vlIRb(0.0),
292 vldDistdP_T(0.0), vldDistdP_B(0.0), vlRTurn(-1.0),
293 vlPmin(-1.0), vlLayerType(-1), vlPCrit(-1.0),
294 vlDistCrit(-1.0), vlSplitLayer(false), vlVTurn(-1.0),
295 vlInvalidRay(false), vlPassingRay(false),
296 vlPhaseUpperIDef(false), vlPhaseLowerIDef(false),
297 vlTurningRay(false), vlLayerName(layrnam)
298 {
299 vlPhase = vlPhaseUpper = vlPhaseLower = vlPhaseType = "";
300 vlPhaseIUpper = vlPhaseILower = "";
301 };
302
304 TPVelocityLayer(const TPVelocityLayer& vl) : vlRt(vl.vlRt), vlRb(vl.vlRb),
305 vlVt(vl.vlVt), vlVb(vl.vlVb), vlPt(vl.vlPt), vlPb(vl.vlPb),
306 vlRLast(vl.vlRLast), vlIRt(vl.vlIRt), vlIRb(vl.vlIRb),
307 vlDistT(vl.vlDistT), vlDistB(vl.vlDistB),
308 vldDistdP_T(vl.vldDistdP_T), vldDistdP_B(vl.vldDistdP_B),
309 vlInvalidRay(vl.vlInvalidRay), vlRTurn(vl.vlRTurn),
310 vlPmin(vl.vlPmin), vlLayerType(vl.vlLayerType),
311 vlPCrit(vl.vlPCrit), vlDistCrit(vl.vlDistCrit),
312 vlSplitLayer(vl.vlSplitLayer), vlVTurn(vl.vlVTurn),
313 vlPassingRay(vl.vlPassingRay),
314 vlTurningRay(vl.vlTurningRay), vlLayerName(vl.vlLayerName),
315 vlPhase(vl.vlPhase), vlPhaseUpper(vl.vlPhaseUpper),
316 vlPhaseLower(vl.vlPhaseLower), vlPhaseType(vl.vlPhaseType),
317 vlPhaseIUpper(vl.vlPhaseIUpper),
318 vlPhaseUpperIDef(vl.vlPhaseUpperIDef),
319 vlPhaseLowerIDef(vl.vlPhaseLowerIDef),
320 vlPhaseILower(vl.vlPhaseILower)
321 {};
322
324 virtual ~TPVelocityLayer() {};
325
326 // **** _PUBLIC OPERATORS_ *************************************************
327
329 TPVelocityLayer& operator=(const TPVelocityLayer& vl)
330 {
331 vlRt = vl.vlRt;
332 vlRb = vl.vlRb;
333 vlVt = vl.vlVt;
334 vlVb = vl.vlVb;
335 vlPt = vl.vlPt;
336 vlPb = vl.vlPb;
337 vlRTurn = vl.vlRTurn;
338 vlVTurn = vl.vlVTurn;
339
340 vlLayerName = vl.vlLayerName;
341 vlPhaseType = vl.vlPhaseType;
342 vlPhase = vl.vlPhase;
343 vlPhaseUpper = vl.vlPhaseUpper;
344 vlPhaseLower = vl.vlPhaseLower;
345 vlPhaseIUpper = vl.vlPhaseIUpper;
346 vlPhaseILower = vl.vlPhaseILower;
347 vlPhaseUpperIDef = vl.vlPhaseUpperIDef;
348 vlPhaseLowerIDef = vl.vlPhaseLowerIDef;
349
350 vlIRt = vl.vlIRt;
351 vlIRb = vl.vlIRb;
352 vlRLast = vl.vlRLast;
353 vlDistT = vl.vlDistT;
354 vlDistB = vl.vlDistB;
355 vldDistdP_T = vl.vldDistdP_T;
356 vldDistdP_B = vl.vldDistdP_B;
357
358 vlPmin = vl.vlPmin;
359 vlLayerType = vl.vlLayerType;
360
361 vlPCrit = vl.vlPCrit;
362 vlDistCrit = vl.vlDistCrit;
363 vlSplitLayer = vl.vlSplitLayer;
364
365 vlPassingRay = vl.vlPassingRay;
366 vlTurningRay = vl.vlTurningRay;
367 vlInvalidRay = vl.vlInvalidRay;
368
369 return *this;
370 };
371
374 virtual double operator()(double r) = ABSTRACT;
375
376 // **** _PUBLIC METHODS_ ***************************************************
377
379 void init()
380 {
381 vlVt = operator()(vlRt);
382 vlVb = operator()(vlRb);
383 vlPt = pAtR(vlRt);
384 vlPb = pAtR(vlRb);
385 };
386
389 static TPVelocityLayer* newModelCopy(TPVelocityLayer* tpvl);
390
395 static TPVelocityLayer* newModelCopy(const string& cnam,
396 DataBuffer& buffer);
397
400 virtual void writeNormRadius(ostream& os) const {};
401
404 virtual void writeVelocity(ostream& os) const = ABSTRACT;
405
409 virtual double rAtP(double p) = ABSTRACT;
410
414 double pAtR(double r) {return r / operator()(r);};
415
420 double integDistance(double p, double r = -1.0)
421 {
422 double dist = 0.0;
423
424 // set ray and integrate if valid
425
426 setRay(p);
427 if (!vlInvalidRay)
428 {
429 // use the turning depth (or bottom of the layer) vlRTurn if
430 // r is not defined (-1.0) or is smaller than vlRTurn. Otherwise,
431 // integrate from r to the top of the layer.
432
433 double rb = vlRTurn;
434 bool tflg = vlTurningRay;
435 if ((r != -1.0) && (r > vlRTurn))
436 {
437 rb = r;
438 tflg = false;
439 }
440
441 // assign integration parameters and perform integration
442
443 vlRLast = rb;
444 dist = integrateDistance(p, rb, tflg);
445 }
446
447 // return distance
448
449 return dist;
450 };
451
456 double integDistance(double p, double r1, double r2)
457 {
458 double dist = 0.0;
459
460 // set updown ray flags and integrate if valid or turning
461
462 setUpDownRay(p, r1, r2);
463 if (!vlInvalidRay)
464 dist = integrateDistance(p, vlIRb, vlIRt, vlTurningRay);
465 else if (vlTurningRay)
466 dist = integrateDistance(p, vlRTurn, vlIRt, true);
467
468 // return distance
469
470 return dist;
471 };
472
477 double integTime(double p, double r = -1.0)
478 {
479 double tim = 0.0;
480
481 // get distance component and integrate Tau if valid
482
483 double d = integDistance(p, r);
484 if (!vlInvalidRay)
485 {
486 // ray is valid calculate time from tau or straight-away
487
488 tim = integrateTime(p, vlRLast);
489 if (isTimeIntegralTau()) tim += p * d;
490 }
491
492 return tim;
493 };
494
499 double integTime(double p, double r1, double r2)
500 {
501 double tim = 0.0;
502
503 // set updown ray flags and integrate if valid or turning
504
505 setUpDownRay(p, r1, r2);
506 double r;
507 if (!vlInvalidRay)
508 r = vlIRb;
509 else if (vlTurningRay)
510 r = vlRTurn;
511 else
512 return tim;
513
514 tim = integrateTime(p, r, vlIRt);
515 if (isTimeIntegralTau()) tim += p * integrateDistance(p, r, vlIRt);
516
517 return tim;
518 };
519
524 //
530 virtual double integrateDistance(double p, double ra,
531 bool r_open = false) = ABSTRACT;
532
537 //
543 virtual double integrateDistance(double p, double ra, double rb,
544 bool r_open = false) = ABSTRACT;
545
550 virtual double integrateTime(double p, double ra) = ABSTRACT;
551
556 virtual double integrateTime(double p, double ra,
557 double rb) = ABSTRACT;
558
562 virtual bool isTimeIntegralTau() const {return true;};
563
565 double getRt() const {return vlRt;};
566
568 double getRb() const {return vlRb;};
569
571 double getVt() const {return vlVt;};
572
574 double getVb() const {return vlVb;};
575
577 double getPt() const {return vlPt;};
578
580 double getPb() const {return vlPb;};
581
586 double getTurningRadius() const {return vlRTurn;};
587
592 double getTurningVelocity() const {return vlVTurn;};
593
596 void setPmin(double pmin) {vlPmin = pmin;};
597
600 double getPmin() const {return vlPmin;};
601
605 void setDistT(double d) {vlDistT = d;};
606
610 double getDistT() const {return vlDistT;};
611
615 void setDistB(double d) {vlDistB = d;};
616
620 double getDistB() const {return vlDistB;};
621
624 void setdDistdPT(double dDdP) {vldDistdP_T = dDdP;};
625
628 double getdDistdPT() const {return vldDistdP_T;};
629
632 void setdDistdPB(double dDdP) {vldDistdP_B = dDdP;};
633
636 double getdDistdPB() const {return vldDistdP_B;};
637
643 void setLayerType(int lt) {vlLayerType = lt;};
644
650 int getLayerType() const {return vlLayerType;};
651
653 const string& getLayerName() const {return vlLayerName;};
654
656 void setPhaseTypeP() {vlPhaseType = "P";};
657
659 void setPhaseTypeS() {vlPhaseType = "S";};
660
662 void setPhaseType(const string& phtype)
663 {vlPhaseType = phtype;};
664
666 const string& getPhaseType() const {return vlPhaseType;};
667
669 void setPhaseName(const string& name) {vlPhase = name;};
670
672 const string& getPhaseName() const {return vlPhase;};
673
675 void setPhaseNameUpper(const string& name)
676 {vlPhaseUpper = name;};
677
679 const string& getPhaseNameUpper() const {return vlPhaseUpper;};
680
682 void setPhaseNameLower(const string& name)
683 {vlPhaseLower = name;};
684
686 const string& getPhaseNameLower() const {return vlPhaseLower;};
687
689 void setPhaseNameDiff(const string& name)
690 {vlPhaseIUpper = name;};
691
693 const string& getPhaseNameDiff() const {return vlPhaseIUpper;};
694
696 void setPhaseNameDiffLower(const string& name)
697 {vlPhaseILower = name;};
698
700 const string& getPhaseNameDiffLower() const {return vlPhaseILower;};
701
706 void setPhaseDiffDef(bool def)
707 {vlPhaseUpperIDef = def;};
708
713 void setPhaseDiffLowerDef(bool def)
714 {vlPhaseLowerIDef = def;};
715
717 bool isPhaseDiffDefined() const
718 {return vlPhaseUpperIDef;};
719
721 bool isPhaseDiffLowerDefined() const
722 {return vlPhaseLowerIDef;};
723
727 double getPCrit() const {return vlPCrit;};
728
731 double getDistCrit() const {return vlDistCrit;};
732
734 bool isSplitLayer() const {return vlSplitLayer;};
735
738 void setSplitLayer(double pcrit, double dcrit)
739 {
740 vlPCrit = pcrit;
741 vlDistCrit = dcrit;
742 vlSplitLayer = true;
743 };
744
747 bool invalidRay() const {return vlInvalidRay;};
748
751 bool passingRay() const {return vlPassingRay;};
752
755 bool turningRay() const {return vlTurningRay;};
756
758 string toString() const;
759
761 virtual void toStream(ostream& os, string indent) const;
762
764 static string class_name() {return "TPVelocityLayer";};
765
767 virtual string get_class_name() const {return class_name();};
768
770 virtual int classSize() const
771 {return (int) sizeof(TPVelocityLayer);};
772
775 virtual bool isVelocityConstant() const {return false;};
776 virtual bool isVelocityPowerLaw() const {return false;};
777 virtual bool isVelocityLinear() const {return false;};
778 virtual bool isVelocityQuadratic() const {return false;};
779 virtual bool isVelocityCubic() const {return false;};
780
783 virtual int bufferSize() const
784 {
785 int bs = (int) vlLayerName.size() + (int) vlPhaseType.size() +
786 (int) vlPhase.size() + (int) vlPhaseUpper.size() +
787 (int) vlPhaseLower.size() + (int) vlPhaseIUpper.size() +
788 (int) vlPhaseILower.size() + 14 * sizeof(int);
789 bs += 2 * sizeof(int) + 3 * sizeof(char) + 16 * sizeof(double);
790
791 return bs;
792 };
793
796 virtual void serialize(DataBuffer& buffer)
797 {
798 buffer.writeString(vlLayerName);
799 buffer.writeString(vlPhaseType);
800 buffer.writeString(vlPhase);
801 buffer.writeString(vlPhaseUpper);
802 buffer.writeString(vlPhaseLower);
803 buffer.writeString(vlPhaseIUpper);
804 buffer.writeString(vlPhaseILower);
805
806 buffer.writeInt32(vlLayerType);
807
808 buffer.writeByte(vlSplitLayer);
809 buffer.writeByte(vlPhaseUpperIDef);
810 buffer.writeByte(vlPhaseLowerIDef);
811
812 buffer.writeDouble(vlRt);
813 buffer.writeRawDouble(vlRb);
814 buffer.writeRawDouble(vlVt);
815 buffer.writeRawDouble(vlVb);
816 buffer.writeRawDouble(vlPt);
817 buffer.writeRawDouble(vlPb);
818 buffer.writeRawDouble(vlRTurn);
819 buffer.writeRawDouble(vlVTurn);
820 buffer.writeRawDouble(vlDistT);
821 buffer.writeRawDouble(vlDistB);
822 buffer.writeRawDouble(vldDistdP_T);
823 buffer.writeRawDouble(vldDistdP_B);
824 buffer.writeRawDouble(vlPmin);
825 buffer.writeRawDouble(vlPCrit);
826 buffer.writeRawDouble(vlDistCrit);
827 };
828
831 virtual void deserialize(DataBuffer& buffer)
832 {
833 vlLayerName = buffer.readString();
834 vlPhaseType = buffer.readString();
835 vlPhase = buffer.readString();
836 vlPhaseUpper = buffer.readString();
837 vlPhaseLower = buffer.readString();
838 vlPhaseIUpper = buffer.readString();
839 vlPhaseILower = buffer.readString();
840
841 vlLayerType = buffer.readInt32();
842
843 vlSplitLayer = buffer.readByte();
844 vlPhaseUpperIDef = buffer.readByte();
845 vlPhaseLowerIDef = buffer.readByte();
846
847 vlRt = buffer.readDouble();
848 vlRb = buffer.readRawDouble();
849 vlVt = buffer.readRawDouble();
850 vlVb = buffer.readRawDouble();
851 vlPt = buffer.readRawDouble();
852 vlPb = buffer.readRawDouble();
853 vlRTurn = buffer.readRawDouble();
854 vlVTurn = buffer.readRawDouble();
855 vlDistT = buffer.readRawDouble();
856 vlDistB = buffer.readRawDouble();
857 vldDistdP_T = buffer.readRawDouble();
858 vldDistdP_B = buffer.readRawDouble();
859 vlPmin = buffer.readRawDouble();
860 vlPCrit = buffer.readRawDouble();
861 vlDistCrit = buffer.readRawDouble();
862 };
863
864 protected:
865
869 void setRay(double p)
870 {
871 vlInvalidRay = vlPassingRay = vlTurningRay = false;
872
873 // determine limits of integration
874
875 if (p < vlPt)
876 {
877 // valid integral determine bottom limit
878
879 if (p < vlPb)
880 {
881 // ray passes through layer
882
883 vlRTurn = vlRb;
884 vlVTurn = vlVb;
885 vlPassingRay = true;
886 }
887 else if (p == vlPb)
888 {
889 // ray turns in layer at bottom
890
891 vlRTurn = vlRb;
892 vlVTurn = vlVb;
893 vlTurningRay = true;
894 }
895 else
896 {
897 // ray turns in layer
898
899 vlRTurn = rAtP(p);
900 vlVTurn = operator()(vlRTurn);
901 vlTurningRay = true;
902 }
903 }
904 else
905 {
906 // invalid ray
907
908 vlInvalidRay = true;
909 }
910 };
911
917 void setUpDownRay(double p, double r1, double r2)
918 {
919 vlPassingRay = vlTurningRay = false;
920 vlInvalidRay = true;
921
922 // ensure validity of radial bounds r1 and r2
923
924 if ((r2 < vlRt) && (r1 > vlRb))
925 {
926 // set top radius to the smaller of vlRt and r1
927
928 double rtt = vlRt;
929 if (r1 < vlRt) rtt = r1;
930
931 // set bottom radius to the larger of vlRb and r2
932
933 double rbb = vlRb;
934 if (r2 > vlRb) rbb = r2;
935
936 // find minimum and maximum ray paramameter at rtt and rbb
937
938 double ptt = pAtR(rtt);
939 double pbb = pAtR(rbb);
940 double pmin = pbb;
941 double pmax = ptt;
942 if (ptt < pbb)
943 {
944 pmin = ptt;
945 pmax = pbb;
946 }
947
948 // if p > pmax ray is invalid so just return 0 ... otherwise
949
950 if (p < pmin)
951 {
952 //valid up/down
953
954 vlRLast = rbb;
955 vlIRt = rtt;
956 vlIRb = rbb;
957 vlPassingRay = true;
958 vlInvalidRay = false;
959 }
960 else if (p < pmax)
961 {
962 //valid turning ray
963
964 vlRTurn = rAtP(p);
965 vlVTurn = operator()(vlRTurn);
966 vlRLast = vlRTurn;
967 vlIRt = rtt;
968 vlIRb = vlRTurn;
969 vlTurningRay = true;
970 if (p == pmin) vlInvalidRay = false;
971 }
972 }
973 };
974
976 string vlLayerName;
977
979 string vlPhaseType;
980
984 string vlPhase;
985
989 string vlPhaseUpper;
990
994 string vlPhaseLower;
995
1000 string vlPhaseIUpper;
1001
1006 string vlPhaseILower;
1007
1009 //
1021 int vlLayerType;
1022
1025 bool vlSplitLayer;
1026
1029 bool vlInvalidRay;
1030
1033 bool vlPassingRay;
1034
1037 bool vlTurningRay;
1038
1041 bool vlPhaseUpperIDef;
1042
1045 bool vlPhaseLowerIDef;
1046
1048 double vlRt;
1049
1051 double vlRb;
1052
1054 double vlIRt;
1055
1057 double vlIRb;
1058
1060 double vlVt;
1061
1063 double vlVb;
1064
1066 double vlPt;
1067
1069 double vlPb;
1070
1071 // Turning radius or bottom of layer if this is a passing ray
1072 double vlRTurn;
1073
1074 // Turning velocity or layer bottom velocity if this is a passing ray
1075 double vlVTurn;
1076
1078 double vlRLast;
1079
1083 double vlDistT;
1084
1088 double vlDistB;
1089
1092 double vldDistdP_T;
1093
1096 double vldDistdP_B;
1097
1104 double vlPmin;
1105
1109 double vlPCrit;
1110
1113 double vlDistCrit;
1114
1115 private:
1116};
1117
1118// *****************************************************************************
1119//
1123//
1147//
1148// *****************************************************************************
1149 template<class V>
1150 class TAUP_EXP VelocityIntegrate : public TPVelocityLayer
1151{
1152 public:
1153
1154 // **** _PUBLIC LIFCYCLES_ *************************************************
1155
1157 VelocityIntegrate() : vmDist(NULL), vmTau(NULL),
1158 vmDistNI(NULL), vmTauNI(NULL), TPVelocityLayer() {};
1159
1161 VelocityIntegrate(double rt, double rb, const string& layrnam) :
1162 vmDist(NULL), vmTau(NULL),
1163 vmDistNI(NULL), vmTauNI(NULL),
1164 TPVelocityLayer(rt, rb, layrnam) {};
1165
1167 VelocityIntegrate(const VelocityIntegrate& vi) :
1168 vmDist(NULL), vmTau(NULL),
1169 vmDistNI(NULL), vmTauNI(NULL), TPVelocityLayer(vi) {};
1170
1172 virtual ~VelocityIntegrate()
1173 {
1174 // Delete integrand and integration function objects if they were
1175 // defined.
1176
1177 if (vmDist)
1178 {
1179 delete vmDist;
1180 delete vmTau;
1181 delete vmDistNI;
1182 delete vmTauNI;
1183 }
1184 };
1185
1186 // **** _PUBLIC OPERATORS_ *************************************************
1187
1189 VelocityIntegrate& operator=(const VelocityIntegrate& vi)
1190 {
1191 // delete old definitions and create new ones if they were defined
1192
1193 if (vmDist)
1194 {
1195 delete vmDist;
1196 vmDist = (TPdDistdr<V>*) NULL;
1197 delete vmTau;
1198 vmTau = (TPdTaudr<V>*) NULL;
1199 delete vmDistNI;
1200 vmDistNI = (util::IntegrateFunction<TPdDistdr<V> >*) NULL;
1201 delete vmTauNI;
1202 vmTauNI = (util::IntegrateFunction<TPdTaudr<V> >*) NULL;
1203 }
1204
1205 TPVelocityLayer::operator=(vi);
1206
1207 return *this;
1208 };
1209
1210 // **** _PUBLIC METHODS_ ***************************************************
1211
1217 //
1221 virtual double integrateDistance(double p, double ra, double rb,
1222 bool r_open = false)
1223 {
1224 // create the numerical integration objects if they do not yet exist
1225
1226 if (!vmDist) createNumericObjects(*((V*) this));
1227
1228 // set p and integrate distance
1229
1230 vmDist->setP(p);
1231 if (r_open)
1232 return vmDistNI->integrateAOpenS(ra, rb);
1233 else
1234 return vmDistNI->integrateClosed(ra, rb);
1235 };
1236
1242 //
1246 virtual double integrateDistance(double p, double ra,
1247 bool r_open = false)
1248 {
1249 return integrateDistance(p, ra, vlRt, r_open);
1250 };
1251
1257 virtual double integrateTime(double p, double ra, double rb)
1258 {
1259 // create the numerical integration objects if they do not yet exist
1260
1261 if (!vmTau) createNumericObjects(*((V*) this));
1262
1263 // set p and integrate time
1264
1265 vmTau->setP(p);
1266 if (ra == 0.0)
1267 return vmTauNI->integrateAOpenS(ra, rb);
1268 else
1269 return vmTauNI->integrateClosed(ra, rb);
1270 };
1271
1277 virtual double integrateTime(double p, double ra)
1278 {
1279 return integrateTime(p, ra, vlRt);
1280 };
1281
1285 void setIntegTolerance(double tol)
1286 {
1287 // create the numerical integration objects if they do not yet exist
1288
1289 if (!vmDist) createNumericObjects(*((V*) this));
1290
1291 // set tolerance
1292
1293 vmDistNI->setTolerance(tol);
1294 vmTauNI->setTolerance(tol);
1295 };
1296
1297 protected:
1298
1302 virtual void createNumericObjects(V& v);
1303
1305 static const double vmIntegTol;
1306
1308 TPdDistdr<V>* vmDist;
1309
1311 TPdTaudr<V>* vmTau;
1312
1314 util::IntegrateFunction<TPdDistdr<V> >* vmDistNI;
1315
1317 util::IntegrateFunction<TPdTaudr<V> >* vmTauNI;
1318};
1319
1320// *****************************************************************************
1321//
1325//
1326// *****************************************************************************
1327 class TAUP_EXP VelocityConst : public VelocityIntegrate<VelocityConst>
1328{
1329 public:
1330
1331 // **** _PUBLIC LIFCYCLES_ *************************************************
1332
1334 VelocityConst() : vc(0.0), VelocityIntegrate<VelocityConst>() {};
1335
1337 VelocityConst(double c, double rt, double rb, const string& layrnam = "") :
1338 vc(c), VelocityIntegrate<VelocityConst>(rt, rb, layrnam) {init();};
1339
1341 VelocityConst(const VelocityConst& vcst) : vc(vcst.vc),
1342 VelocityIntegrate<VelocityConst>(vcst) {};
1343
1345 VelocityConst(DataBuffer& buffer) {deserialize(buffer);};
1346
1348 virtual ~VelocityConst() {};
1349
1350 // **** _PUBLIC OPERATORS_ *************************************************
1351
1353 VelocityConst& operator=(const VelocityConst& vcst)
1354 {
1355 VelocityIntegrate<VelocityConst>::operator=(vcst);
1356
1357 vc = vcst.vc;
1358 return *this;
1359 };
1360
1364 virtual double operator()(double r) {return vc;};
1365
1366 // **** _PUBLIC METHODS_ ***************************************************
1367
1371 virtual double rAtP(double p) {return p * vc;};
1372
1376 //
1379 virtual double integrateDistance(double p, double ra,
1380 bool r_open = false)
1381 {
1382 return integrateDistance(p, ra, vlRt, r_open);
1383 };
1384
1388 //
1391 virtual double integrateDistance(double p, double ra, double rb,
1392 bool r_open = false)
1393 {
1394 if (vc == 0.0) return 0.0;
1395 double pv = p * vc;
1396
1397 double prt = pv / rb;
1398 double prb = pv / ra;
1399
1400 return asin(min(prb, 1.0)) - asin(min(prt, 1.0));
1401 };
1402
1406 //
1408 virtual double integrateTime(double p, double ra)
1409 {
1410 return integrateTime(p, ra, vlRt);
1411 };
1412
1416 //
1418 virtual double integrateTime(double p, double ra, double rb)
1419 {
1420 if (vc == 0.0) return 0.0;
1421 double pt = rb / vc;
1422 double pr = ra / vc;
1423 return sqrt(fabs(pt - p) * (pt + p)) - sqrt(fabs(pr - p) * (pr + p));
1424 };
1425
1427 virtual bool isTimeIntegralTau() const {return false;};
1428
1430 virtual void writeVelocity(ostream& os) const;
1431
1433 virtual void toStream(ostream& os, string indent) const;
1434
1436 static string class_name() {return "VelocityConst";};
1437
1439 virtual string get_class_name() const {return class_name();};
1440
1442 virtual int classSize() const
1443 {return (int) sizeof(VelocityConst);};
1444
1446 virtual bool isVelocityConstant() const {return true;};
1447
1450 virtual int bufferSize() const
1451 {
1452 return 2 * sizeof(double) + TPVelocityLayer::bufferSize();
1453 };
1454
1457 virtual void serialize(DataBuffer& buffer)
1458 {
1459 buffer.writeDouble(vc);
1460 TPVelocityLayer::serialize(buffer);
1461 };
1462
1465 virtual void deserialize(DataBuffer& buffer)
1466 {
1467 vc = buffer.readDouble();
1468 TPVelocityLayer::deserialize(buffer);
1469 };
1470
1471 private:
1472
1473 // **** _PRIVATE DATA_ *****************************************************
1474
1476 double vc;
1477};
1478
1479// *****************************************************************************
1480//
1485//
1486// *****************************************************************************
1487 class TAUP_EXP VelocityPower : public VelocityIntegrate<VelocityPower>
1488{
1489 public:
1490
1491 // **** _PUBLIC LIFCYCLES_ *************************************************
1492
1494 VelocityPower() : vp0(0.0), vp1(0.0), vpB(0.0),
1495 VelocityIntegrate<VelocityPower>() {};
1496
1498 VelocityPower(double vt, double vb, double rt, double rb,
1499 const string& layrnam = "") :
1500 vp0(vt), vp1(vb),
1501 VelocityIntegrate<VelocityPower>(rt, rb, layrnam)
1502 {
1503 vpB = log(vb / vt) / log(vlRb / vlRt);
1504 vp1_B = 1.0 - vpB;
1505 init();
1506 };
1507
1509 VelocityPower(const VelocityPower& vp) :
1510 vp0(vp.vp0), vp1(vp.vp1), vp1_B(vp.vp1_B),
1511 vpB(vp.vpB), VelocityIntegrate<VelocityPower>(vp) {};
1512
1514 VelocityPower(DataBuffer& buffer) {deserialize(buffer);};
1515
1517 virtual ~VelocityPower() {};
1518
1519 // **** _PUBLIC OPERATORS_ *************************************************
1520
1522 VelocityPower& operator=(const VelocityPower& vp)
1523 {
1524 VelocityIntegrate<VelocityPower>::operator=(vp);
1525
1526 vp0 = vp.vp0;
1527 vp1 = vp.vp1;
1528 vpB = vp.vpB;
1529 vp1_B = vp.vp1_B;
1530
1531 return *this;
1532 };
1533
1536 virtual double operator()(double r)
1537 {
1538 return vp0 * pow(r / vlRt, vpB);
1539 };
1540
1541 // **** _PUBLIC METHODS_ ***************************************************
1542
1546 virtual double rAtP(double p)
1547 {
1548 return pow(p * vp0 * pow(1.0 / vlRt, vpB), 1.0 / vp1_B);
1549 };
1550
1552 double B() const {return vpB;};
1553
1557 //
1560 virtual double integrateDistance(double p, double ra,
1561 bool r_open = false)
1562 {
1563 double pva = p * operator()(ra);
1564 double pvb = p * vlVt;
1565 return (asin(min(pva / ra, 1.0)) - asin(min(pvb / vlRt, 1.0))) / vp1_B;
1566 };
1567
1571 //
1574 virtual double integrateDistance(double p, double ra, double rb,
1575 bool r_open = false)
1576 {
1577 double pva = p * operator()(ra);
1578 double pvb = p * operator()(rb);
1579 return (asin(min(pva / ra, 1.0)) - asin(min(pvb / rb, 1.0))) / vp1_B;
1580 };
1581
1585 //
1587 virtual double integrateTime(double p, double ra)
1588 {
1589 double prb = vlRt / vlVt;
1590 double pra = ra / operator()(ra);
1591 return (sqrt(fabs(prb - p) * (prb + p)) -
1592 sqrt(fabs(pra - p) * (pra + p))) / vp1_B;
1593 };
1594
1598 //
1600 virtual double integrateTime(double p, double ra, double rb)
1601 {
1602 double pra = ra / operator()(ra);
1603 double prb = rb / operator()(rb);
1604 //double p2 = p * p;
1605 return (sqrt(fabs(pra - p) * (pra + p)) -
1606 sqrt(fabs(prb - p) * (prb + p))) / vp1_B;
1607 };
1608
1610 virtual bool isTimeIntegralTau() const {return false;};
1611
1613 virtual void writeVelocity(ostream& os) const;
1614
1616 virtual void toStream(ostream& os, string indent) const;
1617
1619 static string class_name() {return "VelocityPower";};
1620
1622 virtual string get_class_name() const {return class_name();};
1623
1625 virtual int classSize() const
1626 {return (int) sizeof(VelocityPower);};
1627
1629 virtual bool isVelocityPowerLaw() const {return true;};
1630
1633 virtual int bufferSize() const
1634 {
1635 return 5 * sizeof(double) + TPVelocityLayer::bufferSize();
1636 };
1637
1640 virtual void serialize(DataBuffer& buffer)
1641 {
1642 buffer.writeDouble(vp0);
1643 buffer.writeRawDouble(vp1);
1644 buffer.writeRawDouble(vpB);
1645 buffer.writeRawDouble(vp1_B);
1646 TPVelocityLayer::serialize(buffer);
1647 };
1648
1651 virtual void deserialize(DataBuffer& buffer)
1652 {
1653 vp0 = buffer.readDouble();
1654 vp1 = buffer.readRawDouble();
1655 vpB = buffer.readRawDouble();
1656 vp1_B = buffer.readRawDouble();
1657 TPVelocityLayer::deserialize(buffer);
1658 };
1659
1660 private:
1661
1662 // **** _PRIVATE DATA_ *****************************************************
1663
1666 double vp0;
1667
1670 double vp1;
1671
1673 double vpB;
1674
1676 double vp1_B;
1677};
1678
1679// *****************************************************************************
1680//
1685//
1686// *****************************************************************************
1687 class TAUP_EXP VelocityLinear : public VelocityIntegrate<VelocityLinear>
1688{
1689 public:
1690
1691 // **** _PUBLIC LIFCYCLES_ *************************************************
1692
1694 VelocityLinear() : va0(0.0), va1(0.0), VelocityIntegrate<VelocityLinear>(){};
1695
1697 VelocityLinear(double a0, double a1, double rt, double rb,
1698 const string& layrnam = "", double normradius = 1.0) :
1699 va0(a0), va1(a1), vNormRadius(normradius),
1700 VelocityIntegrate<VelocityLinear>(rt, rb, layrnam) {init();};
1701
1703 VelocityLinear(const VelocityLinear& vl) : va0(vl.va0), va1(vl.va1),
1704 vNormRadius(vl.vNormRadius), VelocityIntegrate<VelocityLinear>(vl) {};
1705
1707 VelocityLinear(DataBuffer& buffer) {deserialize(buffer);};
1708
1710 virtual ~VelocityLinear() {};
1711
1712 // **** _PUBLIC OPERATORS_ *************************************************
1713
1715 VelocityLinear& operator=(const VelocityLinear& vl)
1716 {
1717 VelocityIntegrate<VelocityLinear>::operator=(vl);
1718
1719 va0 = vl.va0;
1720 va1 = vl.va1;
1721 vNormRadius = vl.vNormRadius;
1722
1723 return *this;
1724 };
1725
1728 virtual double operator()(double r)
1729 {
1730 double rn = r / vNormRadius;
1731 return va1 * rn + va0;
1732 };
1733
1734 // **** _PUBLIC METHODS_ ***************************************************
1735
1739 virtual double rAtP(double p)
1740 {
1741 return (p * va0) / (1 - p * va1 / vNormRadius);
1742 };
1743
1747 //
1750 virtual double integrateDistance(double p, double r,
1751 bool r_open = false)
1752 {
1753 double v1, pv, pv1, pv0, rslt, a, b, c;
1754
1755 // first set result to analytic solution from the constant coefficient
1756 // component
1757
1758 v1 = va1 / vNormRadius;
1759 pv = p * (va0 + v1 * r) / r;
1760 if (pv >= 1.0)
1761 rslt = PI / 2.0;
1762 else
1763 rslt = asin(pv);
1764 pv = p * vlVt / vlRt;
1765 rslt -= asin(pv);
1766
1767 // next add to the result the analytic solution from the gradient
1768 // component ... note: that the additive component depends on the
1769 // value of c
1770
1771 pv0 = p * va0;
1772 pv1 = p * v1;
1773 pv = pv1 * pv1;
1774 c = 1.0 - pv;
1775 if (c < 0.0)
1776 {
1777 b = - pv0 * pv1;
1778 double arg = (c * r + b) / pv0;
1779 if (arg >= 1.0)
1780 rslt += pv1 * (PI / 2.0 - asin((c * vlRt + b) / pv0)) / sqrt(-c);
1781 else
1782 rslt += pv1 * (asin(arg) - asin((c * vlRt + b) / pv0)) / sqrt(-c);
1783 }
1784 else if (c == 0.0)
1785 {
1786 rslt += sqrt(-2.0 * v1 * r / va0 - 1.0) -
1787 sqrt(-2.0 * v1 * vlRt / va0 - 1.0);
1788 }
1789 else // (c > 0.0)
1790 {
1791 b = - 2.0 * pv0 * pv1;
1792 a = - pv0 * pv0;
1793
1794 double sc = sqrt(c);
1795 double Rrt = a + vlRt * (b + c * vlRt);
1796 double Rr = a + r * (b + c * r);
1797 rslt += pv1 * (log(2.0 * sc * sqrt(fabs(Rrt)) + 2.0 * c * vlRt + b) -
1798 log(2.0 * sc * sqrt(fabs(Rr)) + 2.0 * c * r + b)) / sc;
1799 }
1800
1801 // return the result
1802
1803 return rslt;
1804 };
1805
1809 //
1812 virtual double integrateDistance(double p, double ra, double rb,
1813 bool r_open = false)
1814 {
1815 double v1, pv, pv1, pv0, rslt, a, b, c;
1816
1817 // first set result to analytic solution from the constant coefficient
1818 // component
1819
1820 v1 = va1 / vNormRadius;
1821 pv = p * (va0 + v1 * ra) / ra;
1822 if (pv >= 1.0)
1823 rslt = PI / 2.0;
1824 else
1825 rslt = asin(pv);
1826
1827 pv = p * (va0 + v1 * rb) / rb;
1828 if (pv >= 1.0)
1829 rslt -= PI / 2.0;
1830 else
1831 rslt -= asin(pv);
1832
1833 // next add to the result the analytic solution from the gradient
1834 // component ... note: that the additive component depends on the
1835 // value of c
1836
1837 pv0 = p * va0;
1838 pv1 = p * v1;
1839 pv = pv1 * pv1;
1840 c = 1.0 - pv;
1841 if (c < 0.0)
1842 {
1843 b = - pv0 * pv1;
1844 double arg = (c * ra + b) / pv0;
1845 if (arg >= 1.0)
1846 rslt += pv1 * (PI / 2.0 - asin((c * rb + b) / pv0)) / sqrt(-c);
1847 else
1848 rslt += pv1 * (asin(arg) - asin((c * rb + b) / pv0)) / sqrt(-c);
1849 }
1850 else if (c == 0.0)
1851 {
1852 rslt += sqrt(-2.0 * v1 * ra / va0 - 1.0) -
1853 sqrt(-2.0 * v1 * rb / va0 - 1.0);
1854 }
1855 else // (c > 0.0)
1856 {
1857 b = - 2.0 * pv0 * pv1;
1858 a = - pv0 * pv0;
1859
1860 double sc = sqrt(c);
1861 double Rrb = a + rb * (b + c * rb);
1862 double Rra = a + ra * (b + c * ra);
1863 rslt += pv1 * (log(2.0 * sc * sqrt(fabs(Rrb)) + 2.0 * c * rb + b) -
1864 log(2.0 * sc * sqrt(fabs(Rra)) + 2.0 * c * ra + b)) / sc;
1865 }
1866
1867 // return the result
1868
1869 return rslt;
1870 };
1871
1873 virtual void writeNormRadius(ostream& os) const;
1874
1876 virtual void writeVelocity(ostream& os) const;
1877
1879 virtual void toStream(ostream& os, string indent) const;
1880
1882 static string class_name() {return "VelocityLinear";};
1883
1885 virtual string get_class_name() const {return class_name();};
1886
1888 virtual int classSize() const
1889 {return (int) sizeof(VelocityLinear);};
1890
1892 virtual bool isVelocityLinear() const {return true;};
1893
1896 virtual int bufferSize() const
1897 {
1898 return 4 * sizeof(double) + TPVelocityLayer::bufferSize();
1899 };
1900
1903 virtual void serialize(DataBuffer& buffer)
1904 {
1905 buffer.writeDouble(va0);
1906 buffer.writeRawDouble(va1);
1907 buffer.writeRawDouble(vNormRadius);
1908 TPVelocityLayer::serialize(buffer);
1909 };
1910
1913 virtual void deserialize(DataBuffer& buffer)
1914 {
1915 va0 = buffer.readDouble();
1916 va1 = buffer.readRawDouble();
1917 vNormRadius = buffer.readRawDouble();
1918 TPVelocityLayer::deserialize(buffer);
1919 };
1920 private:
1921
1922 // **** _PRIVATE DATA_ *****************************************************
1923
1926 double vNormRadius;
1927
1929 double va0;
1930
1933 double va1;
1934};
1935
1936// *****************************************************************************
1937//
1940//
1941// *****************************************************************************
1942 class TAUP_EXP VelocityQuadratic : public VelocityIntegrate<VelocityQuadratic>
1943{
1944 public:
1945
1946 // **** _PUBLIC LIFCYCLES_ *************************************************
1947
1949 VelocityQuadratic() : va0(0.0), va1(0.0), va2(0.0),
1950 VelocityIntegrate<VelocityQuadratic>() {};
1951
1953 VelocityQuadratic(double a0, double a1, double a2, double rt, double rb,
1954 const string& layrnam = "", double normradius = 1.0) :
1955 va0(a0), va1(a1), va2(a2), vNormRadius(normradius),
1956 VelocityIntegrate<VelocityQuadratic>(rt, rb, layrnam) {init();};
1957
1959 VelocityQuadratic(const VelocityQuadratic& vq) :
1960 va0(vq.va0), va1(vq.va1), va2(vq.va2),
1961 vNormRadius(vq.vNormRadius), VelocityIntegrate<VelocityQuadratic>(vq) {};
1962
1964 VelocityQuadratic(DataBuffer& buffer) {deserialize(buffer);};
1965
1967 virtual ~VelocityQuadratic() {};
1968
1969 // **** _PUBLIC OPERATORS_ *************************************************
1970
1972 VelocityQuadratic& operator=(const VelocityQuadratic& vq)
1973 {
1974 VelocityIntegrate<VelocityQuadratic>::operator=(vq);
1975
1976 va0 = vq.va0;
1977 va1 = vq.va1;
1978 va2 = vq.va2;
1979 vNormRadius = vq.vNormRadius;
1980
1981 return *this;
1982 };
1983
1986 virtual double operator()(double r)
1987 {
1988 double rn = r / vNormRadius;
1989 return va0 + rn * (va1 + rn * va2);
1990 };
1991
1992 // **** _PUBLIC METHODS_ ***************************************************
1993
1997 virtual double rAtP(double p)
1998 {
1999 // return 0 if p = 0
2000
2001 if (p == 0.0) return 0.0;
2002
2003 // calculate quadratic coefficient (a +- sqrt(a*a - c)) / b
2004 // calculate quadratic solution from ar^2 + br + c = 0 where
2005
2006 double a = p * va2 / vNormRadius / vNormRadius;
2007 double b = p * va1 / vNormRadius - 1.0;
2008 double c = p * va0;
2009
2010 // solution is r = (-b +- sqrt(b^2 - 4ac)) / 2a
2011 // first check for error
2012
2013 double sqarg = b * b - 4.0 * a * c;
2014 if (sqarg < 0.0)
2015 {
2016 // error: p is not a valid ray parameter to calculate r
2017 return 0.0;
2018 }
2019 else if (sqarg == 0.0)
2020 {
2021 // one root ... return result
2022
2023 return -b / 2.0 / a;
2024 }
2025 else
2026 {
2027 // two roots ... get both parts
2028
2029 double cc = 2.0 * a;
2030 double aa = -b / cc;
2031 double sq = sqrt(sqarg) / cc;
2032 double r1 = aa - sq;
2033 if ((r1 <= vlRt) && (r1 >= vlRb))
2034 return r1;
2035 else
2036 return aa + sq;
2037 }
2038 };
2039
2041 virtual void writeNormRadius(ostream& os) const;
2042
2044 virtual void writeVelocity(ostream& os) const;
2045
2047 virtual void toStream(ostream& os, string indent) const;
2048
2050 static string class_name() {return "VelocityQuadratic";};
2051
2053 virtual string get_class_name() const {return class_name();};
2054
2056 virtual int classSize() const
2057 {return (int) sizeof(VelocityQuadratic);};
2058
2060 virtual bool isVelocityQuadratic() const {return true;};
2061
2064 virtual int bufferSize() const
2065 {
2066 return 5 * sizeof(double) + TPVelocityLayer::bufferSize();
2067 };
2068
2071 virtual void serialize(DataBuffer& buffer)
2072 {
2073 buffer.writeDouble(va0);
2074 buffer.writeRawDouble(va1);
2075 buffer.writeRawDouble(va2);
2076 buffer.writeRawDouble(vNormRadius);
2077 TPVelocityLayer::serialize(buffer);
2078 };
2079
2082 virtual void deserialize(DataBuffer& buffer)
2083 {
2084 va0 = buffer.readDouble();
2085 va1 = buffer.readRawDouble();
2086 va2 = buffer.readRawDouble();
2087 vNormRadius = buffer.readRawDouble();
2088 TPVelocityLayer::deserialize(buffer);
2089 };
2090
2091 private:
2092
2093 // **** _PRIVATE DATA_ *****************************************************
2094
2097 double vNormRadius;
2098
2100 double va0;
2101
2104 double va1;
2105
2108 double va2;
2109};
2110
2111// *****************************************************************************
2112//
2115//
2116// *****************************************************************************
2117 class TAUP_EXP VelocityCubic : public VelocityIntegrate<VelocityCubic>
2118{
2119 public:
2120
2121 // **** _PUBLIC LIFCYCLES_ *************************************************
2122
2124 VelocityCubic() : va0(0.0), va1(0.0), va2(0.0), va3(0.0), vNormRadius(1.0),
2125 VelocityIntegrate<VelocityCubic>() {};
2126
2128 VelocityCubic(double a0, double a1, double a2, double a3,
2129 double rt, double rb, const string& layrnam = "",
2130 double normradius = 1.0) :
2131 va0(a0), va1(a1), va2(a2), va3(a3), vNormRadius(normradius),
2132 VelocityIntegrate<VelocityCubic>(rt, rb, layrnam) {init();};
2133
2135 VelocityCubic(const VelocityCubic& vc) :
2136 va0(vc.va0), va1(vc.va1), va2(vc.va2), va3(vc.va3),
2137 vNormRadius(vc.vNormRadius), VelocityIntegrate<VelocityCubic>(vc) {};
2138
2140 VelocityCubic(DataBuffer& buffer) {deserialize(buffer);};
2141
2143 virtual ~VelocityCubic() {};
2144
2145 // **** _PUBLIC OPERATORS_ *************************************************
2146
2148 VelocityCubic& operator=(const VelocityCubic& vc)
2149 {
2150 VelocityIntegrate<VelocityCubic>::operator=(vc);
2151
2152 va0 = vc.va0;
2153 va1 = vc.va1;
2154 va2 = vc.va2;
2155 va3 = vc.va3;
2156 vNormRadius = vc.vNormRadius;
2157
2158 return *this;
2159 };
2160
2163 virtual double operator()(double r)
2164 {
2165 double rn = r / vNormRadius;
2166 return va0 + rn * (va1 + rn * (va2 + rn * va3));
2167 };
2168
2169 // **** _PUBLIC METHODS_ ***************************************************
2170
2174 virtual double rAtP(double p);
2175
2177 virtual void writeNormRadius(ostream& os) const;
2178
2180 virtual void writeVelocity(ostream& os) const;
2181
2183 virtual void toStream(ostream& os, string indent) const;
2184
2186 static string class_name() {return "VelocityCubic";};
2187
2189 virtual string get_class_name() const {return class_name();};
2190
2192 virtual int classSize() const
2193 {return (int) sizeof(VelocityCubic);};
2194
2196 virtual bool isVelocityCubic() const {return true;};
2197
2200 virtual int bufferSize() const
2201 {
2202 return 6 * sizeof(double) + TPVelocityLayer::bufferSize();
2203 };
2204
2207 virtual void serialize(DataBuffer& buffer)
2208 {
2209 buffer.writeDouble(va0);
2210 buffer.writeRawDouble(va1);
2211 buffer.writeRawDouble(va2);
2212 buffer.writeRawDouble(va3);
2213 buffer.writeRawDouble(vNormRadius);
2214 TPVelocityLayer::serialize(buffer);
2215 };
2216
2219 virtual void deserialize(DataBuffer& buffer)
2220 {
2221 va0 = buffer.readDouble();
2222 va1 = buffer.readRawDouble();
2223 va2 = buffer.readRawDouble();
2224 va3 = buffer.readRawDouble();
2225 vNormRadius = buffer.readRawDouble();
2226 TPVelocityLayer::deserialize(buffer);
2227 };
2228
2229 private:
2230
2231 // **** _PRIVATE DATA_ *****************************************************
2232
2235 double vNormRadius;
2236
2238 double va0;
2239
2242 double va1;
2243
2246 double va2;
2247
2250 double va3;
2251};
2252
2253// *****************************************************************************
2254//
2259//
2260// *****************************************************************************
2261 template<class V>
2262 class VZero
2263{
2264 public:
2265
2266 // **** _PUBLIC LIFCYCLES_ *************************************************
2267
2269 //
2272 VZero(double p, V& v) : vzP(p), vzV(v) {};
2273
2275 VZero(const VZero& vz) : vzP(vz.vzP), vzV(vz.vzV) {};
2276
2278 virtual ~VZero() {};
2279
2280 // **** _PUBLIC OPERATORS_ *************************************************
2281
2283 VZero& operator=(const VZero& vz)
2284 {
2285 vzP = vz.vzP;
2286 return *this;
2287 };
2288
2292 double operator()(double r) {return r - vzP * vzV(r);};
2293
2294 private:
2295
2298 double vzP;
2299
2301 V& vzV;
2302};
2303
2304} // end namespace taup
2305
2306#endif // TPVelocityModels.h
DataBuffer.h
IntegrateFunction.h
TauPGlobals.h
TAUP_EXP
#define TAUP_EXP
Definition TauPGlobals.h:69
taup::TPVelocityLayer
Abstract base class velocity layer model inherited by all concrete velocity layer classes....
Definition TPVelocityModels.h:265
taup::TPVelocityLayer::setdDistdPT
void setdDistdPT(double dDdP)
Sets the derivative of the distance wrt. the ray parameter at the top of the layer.
Definition TPVelocityModels.h:624
taup::TPVelocityLayer::vldDistdP_B
double vldDistdP_B
The derivative of distance wrt. the ray parameter at the bottom of the layer.
Definition TPVelocityModels.h:1096
taup::TPVelocityLayer::setPhaseDiffDef
void setPhaseDiffDef(bool def)
Sets the upper diffracted wave phase for this layer to true even if it has no formal phase name defin...
Definition TPVelocityModels.h:706
taup::TPVelocityLayer::getDistT
double getDistT() const
Returns the accumulated distance through all layers upto the top of this layer given a ray parameter ...
Definition TPVelocityModels.h:610
taup::TPVelocityLayer::setPhaseNameDiffLower
void setPhaseNameDiffLower(const string &name)
Sets the lower interface phase name.
Definition TPVelocityModels.h:696
taup::TPVelocityLayer::classSize
virtual int classSize() const
Returns the class size.
Definition TPVelocityModels.h:770
taup::TPVelocityLayer::passingRay
bool passingRay() const
Returns true if the last evaluated ray parameter passed through this layer.
Definition TPVelocityModels.h:751
taup::TPVelocityLayer::setDistB
void setDistB(double d)
Sets the accumulated distance through all layers including this one given a ray parameter of vlPb() o...
Definition TPVelocityModels.h:615
taup::TPVelocityLayer::integTime
double integTime(double p, double r=-1.0)
The time integration function which gives the time of the ray travel from the surface of the Earth to...
Definition TPVelocityModels.h:477
taup::TPVelocityLayer::setPhaseNameLower
void setPhaseNameLower(const string &name)
Sets the lower phase name if the layer is a retrograde layer.
Definition TPVelocityModels.h:682
taup::TPVelocityLayer::vlPhaseIUpper
string vlPhaseIUpper
The name of the diffracted phase for a ray that bottoms in the layer and uses the layers bottom veloc...
Definition TPVelocityModels.h:1000
taup::TPVelocityLayer::isVelocityConstant
virtual bool isVelocityConstant() const
Definition TPVelocityModels.h:775
taup::TPVelocityLayer::getTurningVelocity
double getTurningVelocity() const
Definition TPVelocityModels.h:592
taup::TPVelocityLayer::getDistCrit
double getDistCrit() const
Definition TPVelocityModels.h:731
taup::TPVelocityLayer::integDistance
double integDistance(double p, double r1, double r2)
The distance integration function which gives the distance of the ray travel from radius r1 to radius...
Definition TPVelocityModels.h:456
taup::TPVelocityLayer::vlVTurn
double vlVTurn
Definition TPVelocityModels.h:1075
taup::TPVelocityLayer::vldDistdP_T
double vldDistdP_T
The derivative of distance wrt. the ray parameter at the top of the layer.
Definition TPVelocityModels.h:1092
taup::TPVelocityLayer::integrateDistance
virtual double integrateDistance(double p, double ra, double rb, bool r_open=false)
The distance integration function that calculates the ray travel distance from the start of the layer...
taup::TPVelocityLayer::getPhaseType
const string & getPhaseType() const
Returns the layer phase type string.
Definition TPVelocityModels.h:666
taup::TPVelocityLayer::init
void init()
Initializes the velocity layer evaluating vlVt, vlVb, vlPt, and vlPb;.
Definition TPVelocityModels.h:379
taup::TPVelocityLayer::pAtR
double pAtR(double r)
Definition TPVelocityModels.h:414
taup::TPVelocityLayer::setPhaseNameDiff
void setPhaseNameDiff(const string &name)
Sets the upper interface phase name.
Definition TPVelocityModels.h:689
taup::TPVelocityLayer::setPhaseTypeS
void setPhaseTypeS()
Sets the layer phase type to "S".
Definition TPVelocityModels.h:659
taup::TPVelocityLayer::getRb
double getRb() const
Returns the bottom of the layer radius.
Definition TPVelocityModels.h:568
taup::TPVelocityLayer::integrateTime
virtual double integrateTime(double p, double ra)
The time (or tau) integration function that calculates the ray travel time from the start of the laye...
taup::TPVelocityLayer::vlPhaseType
string vlPhaseType
The phase type name ... either "P" or "S".
Definition TPVelocityModels.h:979
taup::TPVelocityLayer::newModelCopy
static TPVelocityLayer * newModelCopy(const string &cnam, DataBuffer &buffer)
TPVelocityLayer factory method that returns a new TPVelocityLayer object of derived type name,...
taup::TPVelocityLayer::getPb
double getPb() const
Returns the bottom of the layer ray parameter (slowness).
Definition TPVelocityModels.h:580
taup::TPVelocityLayer::vlLayerType
int vlLayerType
An integer value that describes the layer type.
Definition TPVelocityModels.h:1021
taup::TPVelocityLayer::serialize
virtual void serialize(DataBuffer &buffer)
Definition TPVelocityModels.h:796
taup::TPVelocityLayer::getPmin
double getPmin() const
Returns the minimum passing ray parameter for the layer. if less than getPt() then the top half of th...
Definition TPVelocityModels.h:600
taup::TPVelocityLayer::setUpDownRay
void setUpDownRay(double p, double r1, double r2)
Sets the upgoing / downgoing flags for an integration between r1 and r2 for the input ray parameter p...
Definition TPVelocityModels.h:917
taup::TPVelocityLayer::setdDistdPB
void setdDistdPB(double dDdP)
Sets the derivative of the distance wrt. the ray parameter at the bottom of the layer.
Definition TPVelocityModels.h:632
taup::TPVelocityLayer::vlPt
double vlPt
The layer top ray parameter (vlRt / vlVt).
Definition TPVelocityModels.h:1066
taup::TPVelocityLayer::rAtP
virtual double rAtP(double p)
taup::TPVelocityLayer::vlLayerName
string vlLayerName
The descriptive name of the velocity layer.
Definition TPVelocityModels.h:976
taup::TPVelocityLayer::integrateTime
virtual double integrateTime(double p, double ra, double rb)
The time (or tau) integration function that calculates the ray travel time from the start of the laye...
taup::TPVelocityLayer::getPhaseNameLower
const string & getPhaseNameLower() const
Returns the lower phase name if the layer is a retrograde layer.
Definition TPVelocityModels.h:686
taup::TPVelocityLayer::vlPhaseUpperIDef
bool vlPhaseUpperIDef
Set to true if the upper diffracted phase for this layer is to be evaluated.
Definition TPVelocityModels.h:1041
taup::TPVelocityLayer::operator()
virtual double operator()(double r)
taup::TPVelocityLayer::getLayerName
const string & getLayerName() const
Returns the descriptive layer name.
Definition TPVelocityModels.h:653
taup::TPVelocityLayer::vlSplitLayer
bool vlSplitLayer
Boolean flag that is true if the velocity layer is a retrograde layer.
Definition TPVelocityModels.h:1025
taup::TPVelocityLayer::~TPVelocityLayer
virtual ~TPVelocityLayer()
Destructor.
Definition TPVelocityModels.h:324
taup::TPVelocityLayer::setPhaseName
void setPhaseName(const string &name)
Sets the layer default phase name.
Definition TPVelocityModels.h:669
taup::TPVelocityLayer::vlRb
double vlRb
The layer bottom radius.
Definition TPVelocityModels.h:1051
taup::TPVelocityLayer::vlPb
double vlPb
The layer bottom ray parameter (vlRb / vlVb).
Definition TPVelocityModels.h:1069
taup::TPVelocityLayer::operator=
TPVelocityLayer & operator=(const TPVelocityLayer &vl)
Assignment Operator.
Definition TPVelocityModels.h:329
taup::TPVelocityLayer::getTurningRadius
double getTurningRadius() const
Definition TPVelocityModels.h:586
taup::TPVelocityLayer::isPhaseDiffLowerDefined
bool isPhaseDiffLowerDefined() const
Returns true if the lower diffracted phase is defined for this layer.
Definition TPVelocityModels.h:721
taup::TPVelocityLayer::toStream
virtual void toStream(ostream &os, string indent) const
Print object data to input stream os.
taup::TPVelocityLayer::newModelCopy
static TPVelocityLayer * newModelCopy(TPVelocityLayer *tpvl)
TPVelocityLayer factory method that returns a new TPVelocityLayer object copied from the input object...
taup::TPVelocityLayer::setPhaseNameUpper
void setPhaseNameUpper(const string &name)
Sets the upper phase name if the layer is a retrograde layer.
Definition TPVelocityModels.h:675
taup::TPVelocityLayer::isVelocityQuadratic
virtual bool isVelocityQuadratic() const
Definition TPVelocityModels.h:778
taup::TPVelocityLayer::isVelocityPowerLaw
virtual bool isVelocityPowerLaw() const
Definition TPVelocityModels.h:776
taup::TPVelocityLayer::vlPhaseUpper
string vlPhaseUpper
The name of the phase for a ray that turns in the top half of a retro-grade layer....
Definition TPVelocityModels.h:989
taup::TPVelocityLayer::vlPmin
double vlPmin
The minimum allowed valid ray parameter that marks a passing limit in the layer. If vlPmin >= vlPt th...
Definition TPVelocityModels.h:1104
taup::TPVelocityLayer::getPt
double getPt() const
Returns the top of the layer ray parameter (slowness).
Definition TPVelocityModels.h:577
taup::TPVelocityLayer::getPhaseNameDiffLower
const string & getPhaseNameDiffLower() const
Returns the lower interface phase name if assigned.
Definition TPVelocityModels.h:700
taup::TPVelocityLayer::vlPassingRay
bool vlPassingRay
Boolean flag that is true if the last distance / time evaluation for this velocity layer was a passin...
Definition TPVelocityModels.h:1033
taup::TPVelocityLayer::vlIRt
double vlIRt
The last integration top radius for this layer.
Definition TPVelocityModels.h:1054
taup::TPVelocityLayer::vlPhase
string vlPhase
The phase name of a ray that turns in the layer. This name is optional and used to define the phase u...
Definition TPVelocityModels.h:984
taup::TPVelocityLayer::integDistance
double integDistance(double p, double r=-1.0)
The distance integration function which gives the distance of the ray travel from the surface of the ...
Definition TPVelocityModels.h:420
taup::TPVelocityLayer::TPVelocityLayer
TPVelocityLayer()
Default constructor. Sets top and bottom layer radius to zero.
Definition TPVelocityModels.h:271
taup::TPVelocityLayer::setPhaseTypeP
void setPhaseTypeP()
Sets the layer phase type to "P".
Definition TPVelocityModels.h:656
taup::TPVelocityLayer::TPVelocityLayer
TPVelocityLayer(const TPVelocityLayer &vl)
Copy constructor.
Definition TPVelocityModels.h:304
taup::TPVelocityLayer::deserialize
virtual void deserialize(DataBuffer &buffer)
Definition TPVelocityModels.h:831
taup::TPVelocityLayer::bufferSize
virtual int bufferSize() const
Definition TPVelocityModels.h:783
taup::TPVelocityLayer::setPmin
void setPmin(double pmin)
Sets the minimum ray parameter for the layer. If less than getPt() then the top half of the layer is ...
Definition TPVelocityModels.h:596
taup::TPVelocityLayer::getVb
double getVb() const
Returns the bottom of the layer velocity.
Definition TPVelocityModels.h:574
taup::TPVelocityLayer::turningRay
bool turningRay() const
Returns true if the last evaluated ray parameter produced a turning ray in this layer.
Definition TPVelocityModels.h:755
taup::TPVelocityLayer::vlDistCrit
double vlDistCrit
The distance to the minimum of the retrograde layer if the layer is retrograde. Otherwise ignored.
Definition TPVelocityModels.h:1113
taup::TPVelocityLayer::vlPhaseILower
string vlPhaseILower
The name of the diffracted phase of a ray that bottoms in the layer and uses the next layers top velo...
Definition TPVelocityModels.h:1006
taup::TPVelocityLayer::vlTurningRay
bool vlTurningRay
Boolean flag that is true if the last distance / time evaluation for this velocity layer was a turnin...
Definition TPVelocityModels.h:1037
taup::TPVelocityLayer::setRay
void setRay(double p)
Sets the ray as invalid, passing, or turning given an input ray parameter p. This function also sets ...
Definition TPVelocityModels.h:869
taup::TPVelocityLayer::vlInvalidRay
bool vlInvalidRay
Boolean flag that is true if the last distance / time evaluation for this velocity layer was invalid.
Definition TPVelocityModels.h:1029
taup::TPVelocityLayer::writeVelocity
virtual void writeVelocity(ostream &os) const
Used to write the CLR formatted velocity profile to the input output stream os.
taup::TPVelocityLayer::class_name
static string class_name()
Static function that returns the class name.
Definition TPVelocityModels.h:764
taup::TPVelocityLayer::getPhaseName
const string & getPhaseName() const
Returns the layer default phase name.
Definition TPVelocityModels.h:672
taup::TPVelocityLayer::vlPhaseLowerIDef
bool vlPhaseLowerIDef
Set to true if the lower diffracted phase for this layer is to be evaluated.
Definition TPVelocityModels.h:1045
taup::TPVelocityLayer::isVelocityCubic
virtual bool isVelocityCubic() const
Definition TPVelocityModels.h:779
taup::TPVelocityLayer::getPhaseNameUpper
const string & getPhaseNameUpper() const
Returns the upper phase name if the layer is a retrograde layer.
Definition TPVelocityModels.h:679
taup::TPVelocityLayer::vlDistT
double vlDistT
The integrated distance to the top of the layer using the top ray parameter (vlPt or vlPmin if the la...
Definition TPVelocityModels.h:1083
taup::TPVelocityLayer::getLayerType
int getLayerType() const
Definition TPVelocityModels.h:650
taup::TPVelocityLayer::invalidRay
bool invalidRay() const
Returns true if the last evaluated ray parameter was unable to pass through this layer.
Definition TPVelocityModels.h:747
taup::TPVelocityLayer::setDistT
void setDistT(double d)
Sets the accumulated distance through all layers upto the top of this layer given a ray parameter of ...
Definition TPVelocityModels.h:605
taup::TPVelocityLayer::isTimeIntegralTau
virtual bool isTimeIntegralTau() const
The Default time integral is really Tau function which must be added to p * distance....
Definition TPVelocityModels.h:562
taup::TPVelocityLayer::vlPhaseLower
string vlPhaseLower
The name of the phase for a ray that turns in the bottom half of a retro-grade layer....
Definition TPVelocityModels.h:994
taup::TPVelocityLayer::writeNormRadius
virtual void writeNormRadius(ostream &os) const
Used to write the normalized radius parameter (if defined) to a CLR output stream os.
Definition TPVelocityModels.h:400
taup::TPVelocityLayer::vlPCrit
double vlPCrit
The ray parameter that gives the distance minimum of a retrograde layer. If the layer is not retrogra...
Definition TPVelocityModels.h:1109
taup::TPVelocityLayer::vlRt
double vlRt
The layer top radius.
Definition TPVelocityModels.h:1048
taup::TPVelocityLayer::getdDistdPB
double getdDistdPB() const
Returns the derivative of the distance wrt. the ray parameter at the bottom of the layer.
Definition TPVelocityModels.h:636
taup::TPVelocityLayer::setSplitLayer
void setSplitLayer(double pcrit, double dcrit)
Sets the layers retrograde parameters if the layer was found to contain a retrograde minimum.
Definition TPVelocityModels.h:738
taup::TPVelocityLayer::setPhaseDiffLowerDef
void setPhaseDiffLowerDef(bool def)
Sets the lower diffracted wave phase for this layer to true even if it has no formal phase name defin...
Definition TPVelocityModels.h:713
taup::TPVelocityLayer::isPhaseDiffDefined
bool isPhaseDiffDefined() const
Returns true if the upper diffracted phase is defined for this layer.
Definition TPVelocityModels.h:717
taup::TPVelocityLayer::integTime
double integTime(double p, double r1, double r2)
The time integration function which gives the time of the ray travel from radius r1 to radius r2 as a...
Definition TPVelocityModels.h:499
taup::TPVelocityLayer::get_class_name
virtual string get_class_name() const
Virtual function that returns the class name.
Definition TPVelocityModels.h:767
taup::TPVelocityLayer::toString
string toString() const
Print object data to string.
taup::TPVelocityLayer::integrateDistance
virtual double integrateDistance(double p, double ra, bool r_open=false)
The distance integration function that calculates the ray travel distance from the start of the layer...
taup::TPVelocityLayer::getDistB
double getDistB() const
Returns the accumulated distance through all layers including this one given a ray parameter of vlPb(...
Definition TPVelocityModels.h:620
taup::TPVelocityLayer::getPhaseNameDiff
const string & getPhaseNameDiff() const
Returns the upper interface phase name if assigned.
Definition TPVelocityModels.h:693
taup::TPVelocityLayer::vlVt
double vlVt
The layer top velocity.
Definition TPVelocityModels.h:1060
taup::TPVelocityLayer::setPhaseType
void setPhaseType(const string &phtype)
Sets the layer phase type to phtype.
Definition TPVelocityModels.h:662
taup::TPVelocityLayer::getVt
double getVt() const
Returns the top of the layer velocity.
Definition TPVelocityModels.h:571
taup::TPVelocityLayer::vlRTurn
double vlRTurn
Definition TPVelocityModels.h:1072
taup::TPVelocityLayer::vlVb
double vlVb
The layer bottom velocity.
Definition TPVelocityModels.h:1063
taup::TPVelocityLayer::vlIRb
double vlIRb
The last integration bottom radius for this layer.
Definition TPVelocityModels.h:1057
taup::TPVelocityLayer::getRt
double getRt() const
Returns the top of the layer radius.
Definition TPVelocityModels.h:565
taup::TPVelocityLayer::getPCrit
double getPCrit() const
Definition TPVelocityModels.h:727
taup::TPVelocityLayer::isVelocityLinear
virtual bool isVelocityLinear() const
Definition TPVelocityModels.h:777
taup::TPVelocityLayer::TPVelocityLayer
TPVelocityLayer(double rt, double rb, const string &layrnam)
Definition TPVelocityModels.h:288
taup::TPVelocityLayer::getdDistdPT
double getdDistdPT() const
Returns the derivative of the distance wrt. the ray parameter at the top of the layer.
Definition TPVelocityModels.h:628
taup::TPVelocityLayer::vlRLast
double vlRLast
Contains the last evaluated turning depth (or vlRb).
Definition TPVelocityModels.h:1078
taup::TPVelocityLayer::setLayerType
void setLayerType(int lt)
Definition TPVelocityModels.h:643
taup::TPVelocityLayer::vlDistB
double vlDistB
The integrated distance to the bottom of the layer using the bottom ray parameter (vlPb or vlPmin if ...
Definition TPVelocityModels.h:1088
taup::TPVelocityLayer::isSplitLayer
bool isSplitLayer() const
Returns true if the layer is a retrograde layer.
Definition TPVelocityModels.h:734
taup::TPdDistdr
Distance Integrand. Integrating this function over radius yields distance.
Definition TPVelocityModels.h:101
taup::TPdDistdr::~TPdDistdr
virtual ~TPdDistdr()
Destructor.
Definition TPVelocityModels.h:114
taup::TPdDistdr::TPdDistdr
TPdDistdr(const TPdDistdr< V > &di)
Copy constructor.
Definition TPVelocityModels.h:111
taup::TPdDistdr::operator()
double operator()(double r)
Function operator that returns the result of the distance integrand evaluated at the input radius r.
Definition TPVelocityModels.h:129
taup::TPdDistdr::setP
void setP(double p)
Sets the ray parameter to the input value p.
Definition TPVelocityModels.h:140
taup::TPdDistdr::TPdDistdr
TPdDistdr(V &v)
Standard constructor.
Definition TPVelocityModels.h:108
taup::TPdDistdr::operator=
TPdDistdr & operator=(const TPdDistdr< V > &di)
Assignment Operator.
Definition TPVelocityModels.h:121
taup::TPdTaudr
Definition TPVelocityModels.h:173
taup::TPdTaudr::~TPdTaudr
virtual ~TPdTaudr()
Destructor.
Definition TPVelocityModels.h:186
taup::TPdTaudr::operator()
double operator()(double r)
Function operator that returns the result of the tau integrand evaluated at the input radius r.
Definition TPVelocityModels.h:201
taup::TPdTaudr::operator=
TPdTaudr & operator=(const TPdTaudr &ti)
Assignment Operator.
Definition TPVelocityModels.h:193
taup::TPdTaudr::TPdTaudr
TPdTaudr(V &v)
Standard constructor.
Definition TPVelocityModels.h:180
taup::TPdTaudr::setP
void setP(double p)
Sets the ray parameter to the input value p.
Definition TPVelocityModels.h:210
taup::TPdTaudr::TPdTaudr
TPdTaudr(const TPdTaudr &ti)
Copy constructor.
Definition TPVelocityModels.h:183
taup::VZero::~VZero
virtual ~VZero()
Destructor.
Definition TPVelocityModels.h:2278
taup::VZero::VZero
VZero(const VZero &vz)
Copy constructor.
Definition TPVelocityModels.h:2275
taup::VZero::operator=
VZero & operator=(const VZero &vz)
Assignment operator.
Definition TPVelocityModels.h:2283
taup::VZero::operator()
double operator()(double r)
Definition TPVelocityModels.h:2292
taup::VZero::VZero
VZero(double p, V &v)
Standard constructor.
Definition TPVelocityModels.h:2272
taup::VelocityConst
Constant velocity model returns a single value for velocity irregardless of the input radius value....
Definition TPVelocityModels.h:1328
taup::VelocityConst::toStream
virtual void toStream(ostream &os, string indent) const
Print object data to input stream os.
taup::VelocityConst::isTimeIntegralTau
virtual bool isTimeIntegralTau() const
The constant velocity time integral returns time and not tau.
Definition TPVelocityModels.h:1427
taup::VelocityConst::VelocityConst
VelocityConst()
Default constructor. Sets velocity to zero.
Definition TPVelocityModels.h:1334
taup::VelocityConst::bufferSize
virtual int bufferSize() const
Returns the size of a DataBuffer required to contain all serialized information for a VelocityConst o...
Definition TPVelocityModels.h:1450
taup::VelocityConst::VelocityConst
VelocityConst(const VelocityConst &vcst)
Copy constructor.
Definition TPVelocityModels.h:1341
taup::VelocityConst::rAtP
virtual double rAtP(double p)
Definition TPVelocityModels.h:1371
taup::VelocityConst::operator=
VelocityConst & operator=(const VelocityConst &vcst)
Assignment Operator.
Definition TPVelocityModels.h:1353
taup::VelocityConst::integrateTime
virtual double integrateTime(double p, double ra)
The analytic constant velocity time integration function that calculates the ray travel time from the...
Definition TPVelocityModels.h:1408
taup::VelocityConst::integrateDistance
virtual double integrateDistance(double p, double ra, bool r_open=false)
The analytic constant velocity distance integration function that calculates the ray travel distance ...
Definition TPVelocityModels.h:1379
taup::VelocityConst::writeVelocity
virtual void writeVelocity(ostream &os) const
Writes the velocity definition to the input stream os.
taup::VelocityConst::isVelocityConstant
virtual bool isVelocityConstant() const
Virtual function that returns true for a Constant model.
Definition TPVelocityModels.h:1446
taup::VelocityConst::integrateTime
virtual double integrateTime(double p, double ra, double rb)
The analytic constant velocity time integration function that calculates the ray travel time from the...
Definition TPVelocityModels.h:1418
taup::VelocityConst::~VelocityConst
virtual ~VelocityConst()
Destructor.
Definition TPVelocityModels.h:1348
taup::VelocityConst::deserialize
virtual void deserialize(DataBuffer &buffer)
Reads the content of the VelocityConst object from the input DataBuffer buffer.
Definition TPVelocityModels.h:1465
taup::VelocityConst::VelocityConst
VelocityConst(double c, double rt, double rb, const string &layrnam="")
Standard constructor. Sets velocity to c.
Definition TPVelocityModels.h:1337
taup::VelocityConst::operator()
virtual double operator()(double r)
Definition TPVelocityModels.h:1364
taup::VelocityConst::integrateDistance
virtual double integrateDistance(double p, double ra, double rb, bool r_open=false)
The analytic constant velocity distance integration function that calculates the ray travel distance ...
Definition TPVelocityModels.h:1391
taup::VelocityConst::get_class_name
virtual string get_class_name() const
Virtual function that returns the class name.
Definition TPVelocityModels.h:1439
taup::VelocityConst::classSize
virtual int classSize() const
Returns the class size.
Definition TPVelocityModels.h:1442
taup::VelocityConst::serialize
virtual void serialize(DataBuffer &buffer)
Writes the content of the VelocityConst object into the input DataBuffer buffer.
Definition TPVelocityModels.h:1457
taup::VelocityConst::VelocityConst
VelocityConst(DataBuffer &buffer)
DataBuffer constructor.
Definition TPVelocityModels.h:1345
taup::VelocityConst::class_name
static string class_name()
Static function that returns the class name.
Definition TPVelocityModels.h:1436
taup::VelocityCubic
Cubic velocity model returns a cubicly modeled velocity between the top and bottom of the layer as a ...
Definition TPVelocityModels.h:2118
taup::VelocityCubic::VelocityCubic
VelocityCubic(const VelocityCubic &vc)
Copy constructor.
Definition TPVelocityModels.h:2135
taup::VelocityCubic::get_class_name
virtual string get_class_name() const
Virtual function that returns the class name.
Definition TPVelocityModels.h:2189
taup::VelocityCubic::operator=
VelocityCubic & operator=(const VelocityCubic &vc)
Assignment operator.
Definition TPVelocityModels.h:2148
taup::VelocityCubic::writeVelocity
virtual void writeVelocity(ostream &os) const
Writes the velocity definition to the input stream os.
taup::VelocityCubic::VelocityCubic
VelocityCubic()
Default constructor. Sets velocity to zero.
Definition TPVelocityModels.h:2124
taup::VelocityCubic::VelocityCubic
VelocityCubic(DataBuffer &buffer)
DataBuffer constructor.
Definition TPVelocityModels.h:2140
taup::VelocityCubic::class_name
static string class_name()
Static function that returns the class name.
Definition TPVelocityModels.h:2186
taup::VelocityCubic::serialize
virtual void serialize(DataBuffer &buffer)
Writes the content of the VelocityCubic object into the input DataBuffer buffer.
Definition TPVelocityModels.h:2207
taup::VelocityCubic::~VelocityCubic
virtual ~VelocityCubic()
Destructor.
Definition TPVelocityModels.h:2143
taup::VelocityCubic::bufferSize
virtual int bufferSize() const
Returns the size of a DataBuffer required to contain all serialized information for a VelocityCubic o...
Definition TPVelocityModels.h:2200
taup::VelocityCubic::writeNormRadius
virtual void writeNormRadius(ostream &os) const
Writes the normalized radius definition to input stream os.
taup::VelocityCubic::operator()
virtual double operator()(double r)
Definition TPVelocityModels.h:2163
taup::VelocityCubic::rAtP
virtual double rAtP(double p)
taup::VelocityCubic::deserialize
virtual void deserialize(DataBuffer &buffer)
Reads the content of the VelocityCubic object from the input DataBuffer buffer.
Definition TPVelocityModels.h:2219
taup::VelocityCubic::VelocityCubic
VelocityCubic(double a0, double a1, double a2, double a3, double rt, double rb, const string &layrnam="", double normradius=1.0)
Standard constructor.
Definition TPVelocityModels.h:2128
taup::VelocityCubic::toStream
virtual void toStream(ostream &os, string indent) const
Print object data to input stream os.
taup::VelocityCubic::isVelocityCubic
virtual bool isVelocityCubic() const
Virtual function that returns true for a Cubic model.
Definition TPVelocityModels.h:2196
taup::VelocityCubic::classSize
virtual int classSize() const
Returns the class size.
Definition TPVelocityModels.h:2192
taup::VelocityIntegrate::integrateDistance
virtual double integrateDistance(double p, double ra, double rb, bool r_open=false)
The distance integration function that calculates the ray travel distance from the start of the layer...
Definition TPVelocityModels.h:1221
taup::VelocityIntegrate::vmDistNI
util::IntegrateFunction< TPdDistdr< V > > * vmDistNI
The numerical integration object templated on vmDist.
Definition TPVelocityModels.h:1314
taup::VelocityIntegrate::~VelocityIntegrate
virtual ~VelocityIntegrate()
Destructor.
Definition TPVelocityModels.h:1172
taup::VelocityIntegrate::vmDist
TPdDistdr< V > * vmDist
The distance integrand object templated on the velocity.
Definition TPVelocityModels.h:1308
taup::VelocityIntegrate::integrateTime
virtual double integrateTime(double p, double ra)
The time (or tau) integration function that calculates the ray travel time from the start of the laye...
Definition TPVelocityModels.h:1277
taup::VelocityIntegrate::vmTauNI
util::IntegrateFunction< TPdTaudr< V > > * vmTauNI
The numerical integration object templated on vmTau.
Definition TPVelocityModels.h:1317
taup::VelocityIntegrate::VelocityIntegrate
VelocityIntegrate(double rt, double rb, const string &layrnam)
Standard constructor. Sets top radius to rt.
Definition TPVelocityModels.h:1161
taup::VelocityIntegrate::integrateTime
virtual double integrateTime(double p, double ra, double rb)
The time (or tau) integration function that calculates the ray travel time from the start of the laye...
Definition TPVelocityModels.h:1257
taup::VelocityIntegrate::vmTau
TPdTaudr< V > * vmTau
The tau integrand object templated on the velocity.
Definition TPVelocityModels.h:1311
taup::VelocityIntegrate::operator=
VelocityIntegrate & operator=(const VelocityIntegrate &vi)
Assignment Operator.
Definition TPVelocityModels.h:1189
taup::VelocityIntegrate::VelocityIntegrate
VelocityIntegrate()
Default constructor. Sets top radius to zero.
Definition TPVelocityModels.h:1157
taup::VelocityIntegrate::vmIntegTol
static const double vmIntegTol
The default integration tolerance.
Definition TPVelocityModels.h:1305
taup::VelocityIntegrate::createNumericObjects
virtual void createNumericObjects(V &v)
Used to create the distance and tau integrand functions vmDist, and vmTau, and their associated integ...
taup::VelocityIntegrate::setIntegTolerance
void setIntegTolerance(double tol)
Sets the integration tolerance limit for this velocity layer. If the integration objects are not yet ...
Definition TPVelocityModels.h:1285
taup::VelocityIntegrate::integrateDistance
virtual double integrateDistance(double p, double ra, bool r_open=false)
The distance integration function that calculates the ray travel distance from the start of the layer...
Definition TPVelocityModels.h:1246
taup::VelocityIntegrate::VelocityIntegrate
VelocityIntegrate(const VelocityIntegrate &vi)
Copy constructor.
Definition TPVelocityModels.h:1167
taup::VelocityLinear
Linear velocity model returns a linearly modeled velocity between the top and bottom of the layer as ...
Definition TPVelocityModels.h:1688
taup::VelocityLinear::VelocityLinear
VelocityLinear(const VelocityLinear &vl)
Copy constructor.
Definition TPVelocityModels.h:1703
taup::VelocityLinear::serialize
virtual void serialize(DataBuffer &buffer)
Writes the content of the VelocityLinear object into the input DataBuffer buffer.
Definition TPVelocityModels.h:1903
taup::VelocityLinear::get_class_name
virtual string get_class_name() const
Virtual function that returns the class name.
Definition TPVelocityModels.h:1885
taup::VelocityLinear::toStream
virtual void toStream(ostream &os, string indent) const
Print object data to input stream os.
taup::VelocityLinear::rAtP
virtual double rAtP(double p)
Definition TPVelocityModels.h:1739
taup::VelocityLinear::writeNormRadius
virtual void writeNormRadius(ostream &os) const
Writes the normalized radius definition to input stream os.
taup::VelocityLinear::VelocityLinear
VelocityLinear()
Default constructor. Sets velocity to zero.
Definition TPVelocityModels.h:1694
taup::VelocityLinear::operator=
VelocityLinear & operator=(const VelocityLinear &vl)
Assignment operator.
Definition TPVelocityModels.h:1715
taup::VelocityLinear::deserialize
virtual void deserialize(DataBuffer &buffer)
Reads the content of the VelocityLinear object from the input DataBuffer buffer.
Definition TPVelocityModels.h:1913
taup::VelocityLinear::integrateDistance
virtual double integrateDistance(double p, double ra, double rb, bool r_open=false)
The analytic linear velocity distance integration function that calculates the ray travel distance fr...
Definition TPVelocityModels.h:1812
taup::VelocityLinear::VelocityLinear
VelocityLinear(double a0, double a1, double rt, double rb, const string &layrnam="", double normradius=1.0)
Standard constructor.
Definition TPVelocityModels.h:1697
taup::VelocityLinear::operator()
virtual double operator()(double r)
Definition TPVelocityModels.h:1728
taup::VelocityLinear::integrateDistance
virtual double integrateDistance(double p, double r, bool r_open=false)
The analytic linear velocity distance integration function that calculates the ray travel distance fr...
Definition TPVelocityModels.h:1750
taup::VelocityLinear::writeVelocity
virtual void writeVelocity(ostream &os) const
Writes the velocity definition to the input stream os.
taup::VelocityLinear::bufferSize
virtual int bufferSize() const
Returns the size of a DataBuffer required to contain all serialized information for a VelocityLinear ...
Definition TPVelocityModels.h:1896
taup::VelocityLinear::~VelocityLinear
virtual ~VelocityLinear()
Destructor.
Definition TPVelocityModels.h:1710
taup::VelocityLinear::isVelocityLinear
virtual bool isVelocityLinear() const
Virtual function that returns true for a Linear model.
Definition TPVelocityModels.h:1892
taup::VelocityLinear::class_name
static string class_name()
Static function that returns the class name.
Definition TPVelocityModels.h:1882
taup::VelocityLinear::VelocityLinear
VelocityLinear(DataBuffer &buffer)
DataBuffer constructor.
Definition TPVelocityModels.h:1707
taup::VelocityLinear::classSize
virtual int classSize() const
Returns the class size.
Definition TPVelocityModels.h:1888
taup::VelocityPower
Power Law velocity model returns a power law modeled velocity between the top and bottom of the layer...
Definition TPVelocityModels.h:1488
taup::VelocityPower::VelocityPower
VelocityPower()
Default constructor. Sets velocity to zero.
Definition TPVelocityModels.h:1494
taup::VelocityPower::get_class_name
virtual string get_class_name() const
Virtual function that returns the class name.
Definition TPVelocityModels.h:1622
taup::VelocityPower::deserialize
virtual void deserialize(DataBuffer &buffer)
Reads the content of the VelocityPower object from the input DataBuffer buffer.
Definition TPVelocityModels.h:1651
taup::VelocityPower::integrateDistance
virtual double integrateDistance(double p, double ra, bool r_open=false)
The analytic power law velocity distance integration function that calculates the ray travel distance...
Definition TPVelocityModels.h:1560
taup::VelocityPower::operator()
virtual double operator()(double r)
Definition TPVelocityModels.h:1536
taup::VelocityPower::integrateTime
virtual double integrateTime(double p, double ra, double rb)
The analytic power law velocity time integration function that calculates the ray travel time from th...
Definition TPVelocityModels.h:1600
taup::VelocityPower::integrateTime
virtual double integrateTime(double p, double ra)
The analytic power law velocity time integration function that calculates the ray travel time from th...
Definition TPVelocityModels.h:1587
taup::VelocityPower::rAtP
virtual double rAtP(double p)
Definition TPVelocityModels.h:1546
taup::VelocityPower::VelocityPower
VelocityPower(const VelocityPower &vp)
Copy constructor.
Definition TPVelocityModels.h:1509
taup::VelocityPower::serialize
virtual void serialize(DataBuffer &buffer)
Writes the content of the VelocityPower object into the input DataBuffer buffer.
Definition TPVelocityModels.h:1640
taup::VelocityPower::isVelocityPowerLaw
virtual bool isVelocityPowerLaw() const
Virtual function that returns true for a Power Law model.
Definition TPVelocityModels.h:1629
taup::VelocityPower::classSize
virtual int classSize() const
Returns the class size.
Definition TPVelocityModels.h:1625
taup::VelocityPower::integrateDistance
virtual double integrateDistance(double p, double ra, double rb, bool r_open=false)
The analytic power law velocity distance integration function that calculates the ray travel distance...
Definition TPVelocityModels.h:1574
taup::VelocityPower::bufferSize
virtual int bufferSize() const
Returns the size of a DataBuffer required to contain all serialized information for a VelocityPower o...
Definition TPVelocityModels.h:1633
taup::VelocityPower::isTimeIntegralTau
virtual bool isTimeIntegralTau() const
The power law velocity time integral returns time and not tau.
Definition TPVelocityModels.h:1610
taup::VelocityPower::B
double B() const
Returns the power law exponent.
Definition TPVelocityModels.h:1552
taup::VelocityPower::class_name
static string class_name()
Static function that returns the class name.
Definition TPVelocityModels.h:1619
taup::VelocityPower::writeVelocity
virtual void writeVelocity(ostream &os) const
Writes the velocity definition to the input stream os.
taup::VelocityPower::VelocityPower
VelocityPower(double vt, double vb, double rt, double rb, const string &layrnam="")
Standard constructor.
Definition TPVelocityModels.h:1498
taup::VelocityPower::operator=
VelocityPower & operator=(const VelocityPower &vp)
Assignment operator.
Definition TPVelocityModels.h:1522
taup::VelocityPower::~VelocityPower
virtual ~VelocityPower()
Destructor.
Definition TPVelocityModels.h:1517
taup::VelocityPower::toStream
virtual void toStream(ostream &os, string indent) const
Print object data to input stream os.
taup::VelocityPower::VelocityPower
VelocityPower(DataBuffer &buffer)
DataBuffer constructor.
Definition TPVelocityModels.h:1514
taup::VelocityQuadratic
Quadratic velocity model returns a quadraticly modeled velocity between the top and bottom of the lay...
Definition TPVelocityModels.h:1943
taup::VelocityQuadratic::isVelocityQuadratic
virtual bool isVelocityQuadratic() const
Virtual function that returns true for a Quadratic model.
Definition TPVelocityModels.h:2060
taup::VelocityQuadratic::operator=
VelocityQuadratic & operator=(const VelocityQuadratic &vq)
Assignment operator.
Definition TPVelocityModels.h:1972
taup::VelocityQuadratic::serialize
virtual void serialize(DataBuffer &buffer)
Writes the content of the VelocityQuadratic object into the input DataBuffer buffer.
Definition TPVelocityModels.h:2071
taup::VelocityQuadratic::operator()
virtual double operator()(double r)
Definition TPVelocityModels.h:1986
taup::VelocityQuadratic::toStream
virtual void toStream(ostream &os, string indent) const
Print object data to input stream os.
taup::VelocityQuadratic::writeVelocity
virtual void writeVelocity(ostream &os) const
Writes the velocity definition to the input stream os.
taup::VelocityQuadratic::rAtP
virtual double rAtP(double p)
Definition TPVelocityModels.h:1997
taup::VelocityQuadratic::VelocityQuadratic
VelocityQuadratic()
Default constructor. Sets velocity to zero.
Definition TPVelocityModels.h:1949
taup::VelocityQuadratic::VelocityQuadratic
VelocityQuadratic(DataBuffer &buffer)
DataBuffer constructor.
Definition TPVelocityModels.h:1964
taup::VelocityQuadratic::bufferSize
virtual int bufferSize() const
Returns the size of a DataBuffer required to contain all serialized information for a VelocityQuadrat...
Definition TPVelocityModels.h:2064
taup::VelocityQuadratic::VelocityQuadratic
VelocityQuadratic(double a0, double a1, double a2, double rt, double rb, const string &layrnam="", double normradius=1.0)
Standard constructor.
Definition TPVelocityModels.h:1953
taup::VelocityQuadratic::classSize
virtual int classSize() const
Returns the class size.
Definition TPVelocityModels.h:2056
taup::VelocityQuadratic::class_name
static string class_name()
Static function that returns the class name.
Definition TPVelocityModels.h:2050
taup::VelocityQuadratic::deserialize
virtual void deserialize(DataBuffer &buffer)
Reads the content of the VelocityQuadratic object from the input DataBuffer buffer.
Definition TPVelocityModels.h:2082
taup::VelocityQuadratic::writeNormRadius
virtual void writeNormRadius(ostream &os) const
Writes the normalized radius definition to input stream os.
taup::VelocityQuadratic::VelocityQuadratic
VelocityQuadratic(const VelocityQuadratic &vq)
Copy constructor.
Definition TPVelocityModels.h:1959
taup::VelocityQuadratic::~VelocityQuadratic
virtual ~VelocityQuadratic()
Destructor.
Definition TPVelocityModels.h:1967
taup::VelocityQuadratic::get_class_name
virtual string get_class_name() const
Virtual function that returns the class name.
Definition TPVelocityModels.h:2053
util::DataBuffer
A byte array container used to hold binary data in the same manner as disk based file system.
Definition DataBuffer.h:81
util::DataBuffer::writeDouble
void writeDouble(double d)
Write a double (d) to the DataBuffer. Make sure the buffer is 8byte alligned and sized appropriatly b...
Definition DataBuffer.h:1317
util::DataBuffer::readInt32
int readInt32()
Read an int from the buffer. Make sure the buffer is 4byte alligned before reading.
Definition DataBuffer.h:632
util::DataBuffer::writeByte
void writeByte(uByte b)
Write a byte (b) to the DataBuffer. Make sure the buffer is sized appropriately before writing.
Definition DataBuffer.h:968
util::DataBuffer::writeString
void writeString(const string &in_string)
Write the string in_string into 'this' DataBuffer.
Definition DataBuffer.h:906
util::DataBuffer::writeRawDouble
void writeRawDouble(double d)
Write a double (d) ... do not check for alignment or size ... fast but the client is responsible for ...
Definition DataBuffer.h:1353
util::DataBuffer::writeInt32
void writeInt32(int i)
Write an Int32 (i) to the DataBuffer. Make sure the buffer is 4byte alligned and sized appropriatly b...
Definition DataBuffer.h:1092
util::DataBuffer::readDouble
double readDouble()
Read a double from the buffer. Make sure the buffer is 8byte alligned before reading.
Definition DataBuffer.h:835
util::DataBuffer::readByte
uByte readByte()
Read a byte from the buffer and update the iterator.
Definition DataBuffer.h:549
util::DataBuffer::readString
const string & readString()
Read a string and return a reference to be assigned to another string in the client....
Definition DataBuffer.h:504
util::DataBuffer::readRawDouble
double readRawDouble()
Read a double ... don't check for alignment ... fast but client is responsible for alignment.
Definition DataBuffer.h:867
util::IntegrateFunction
Class supports numerical integration of an arbitrary function using a fourth order Simpsons rule for ...
Definition IntegrateFunction.h:113
taup
Definition TauPException.h:48