View Javadoc

1   /*
2     The TauP Toolkit: Flexible Seismic Travel-Time and Raypath Utilities.
3     Copyright (C) 1998-2000 University of South Carolina
4   
5     This program is free software; you can redistribute it and/or
6     modify it under the terms of the GNU General Public License
7     as published by the Free Software Foundation; either version 2
8     of the License, or (at your option) any later version.
9   
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14  
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, write to the Free Software
17    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18  
19    The current version can be found at 
20    <A HREF="www.seis.sc.edu">http://www.seis.sc.edu</A>
21  
22    Bug reports and comments should be directed to 
23    H. Philip Crotwell, crotwell@seis.sc.edu or
24    Tom Owens, owens@seis.sc.edu
25  
26  */
27  
28  
29  package edu.sc.seis.TauP;
30  
31  import java.io.Serializable;
32  
33  /*** Utility class to keep track of criticalpoints (discontinuities or
34   *  reversals in slowness gradient) within slowness and velocity models.
35   *
36   * @version 1.1.3 Wed Jul 18 15:00:35 GMT 2001
37  
38  
39  
40   * @author H. Philip Crotwell
41   */
42  public class CriticalDepth implements Cloneable, Serializable {
43  
44        /*** depth in kilometers at which there is a critical point. */
45     public double depth;
46  
47        /*** layer number within the velocity model with this depth at its top. */
48     public int velLayerNum;
49  
50        /*** slowness layer for P waves with this depth at its top. This can be PLayers.size() for
51         *  the last critical layer. */
52     public int PLayerNum;
53  
54        /*** slowness layer for S waves with this depth at its top. This can be SLayers.size() for
55         *  the last critical layer. */
56     public int SLayerNum;
57  
58  // Constructors
59  
60     public CriticalDepth() {
61     }
62  
63     public CriticalDepth(double depth, int velLayerNum, int PLayerNum, 
64     int SLayerNum) {
65        this.depth = depth;
66        this.velLayerNum = velLayerNum;
67        this.PLayerNum = PLayerNum;
68        this.SLayerNum = SLayerNum;
69     }
70  
71  // Accessor methods
72  
73     public void setVelLayerNum(int layerNum) {
74        velLayerNum = layerNum;
75     }
76  
77     public void setPLayerNum(int layerNum) {
78        PLayerNum = layerNum;
79     }
80  
81     public void setSLayerNum(int layerNum) {
82        SLayerNum = layerNum;
83     }
84  
85     public int getVelLayerNum() {
86        return velLayerNum;
87     }
88  
89     public int getPLayerNum() {
90        return PLayerNum;
91     }
92  
93     public int getSLayerNum() {
94        return SLayerNum;
95     }
96  
97        /*** sets slowness layer for waveType waves with this depth at its top.
98         */
99     public void setLayerNum(int layerNum, boolean isPWave) {
100       if (isPWave) {
101          PLayerNum = layerNum;
102       } else {
103          SLayerNum = layerNum;
104       }
105    }
106 
107       /*** @returns slowness layer for waveType waves with this depth at its top.
108        */
109    public int getLayerNum(boolean isPWave) {
110       if (isPWave) {
111          return PLayerNum;
112       } else {
113          return SLayerNum;
114       }
115    }
116    
117    
118    public Object clone() {
119       CriticalDepth newObject;
120       try {
121          newObject = (CriticalDepth)super.clone();
122          return newObject;
123       } catch (CloneNotSupportedException e) {
124          // Can't happen, but...
125          System.err.println("Caught CloneNotSupportedException: "+
126             e.getMessage());
127          throw new InternalError(e.toString());
128       }
129    }
130 }