org.opensha.sha.faultSurface
Class GriddedSubsetSurface

java.lang.Object
  extended by org.opensha.commons.data.ContainerSubset2D<Location>
      extended by org.opensha.sha.faultSurface.GriddedSubsetSurface
All Implemented Interfaces:
Serializable, Iterable<Location>, Container2D<Location>, Named, EvenlyGriddedSurface, RuptureSurface

public class GriddedSubsetSurface
extends ContainerSubset2D<Location>
implements EvenlyGriddedSurface

Title: GriddedSubsetSurface

Description: This represents a subset of an EvenlyGriddedSurface (as a pointer, not duplicated in memory) Note: This class is purely a convinience class that translates indexes so the user can deal with a smaller window than the full GriddedSurface. Think of this as a "ZOOM" function into a GriddedSurface.

Version:
1.0
Author:
Steven W. Rock & revised by Ned Field
See Also:
Window2D, Serialized Form

Field Summary
 
Fields inherited from class org.opensha.commons.data.ContainerSubset2D
C, D, data, name, oldWindow, window
 
Constructor Summary
GriddedSubsetSurface(int numRows, int numCols, int startRow, int startCol, EvenlyGriddedSurface data)
          Constructor for the GriddedSubsetSurface object
 
Method Summary
 double getArea()
          This returns the surface area in km-sq
 double getAveDip()
          Proxy method that returns the aveDip of the main GriddedSurface.
 double getAveDipDirection()
          Average dip direction (degrees) of rupture surface
 double getAveGridSpacing()
          This returns the average grid spacing used to define the discretization used in what's returned by the methods here that contain "Discretized" in their names.
 double getAveLength()
          This returns the average length of the surface in km
 double getAveRupTopDepth()
          Average depth (km) to top of rupture (always a positive number)
 double getAveStrike()
          Average strike (degrees) of rupture surface
 double getAveWidth()
          Average down-dip width (km) of rupture surface
 double getDistanceJB(Location siteLoc)
          This returns distance JB (shortest horz distance in km to surface projection of rupture), assuming the location has zero depth (for numerical expediency).
 double getDistanceRup(Location siteLoc)
          This returns rupture distance (kms to closest point on the rupture surface), assuming the location has zero depth (for numerical expediency).
 double getDistanceSeis(Location siteLoc)
          This returns "distance seis" (shortest distance in km to point on rupture deeper than 3 km), assuming the location has zero depth (for numerical expediency).
 double getDistanceX(Location siteLoc)
          This returns distance X (the shortest distance in km to the rupture trace extended to infinity), where values >= 0 are on the hanging wall and values < 0 are on the foot wall.
 LocationList getEvenlyDiscritizedListOfLocsOnSurface()
          This returns a list of locations that are evenly spread (at least approximately) over the rupture surface, with a spacing given by what's returned by the getGridSpacing() method.
 FaultTrace getEvenlyDiscritizedLowerEdge()
          This returns a list of locations that are evenly spread along the lower edge of the surface.
 LocationList getEvenlyDiscritizedPerimeter()
          This returns a list of locations that are evenly spread (at least approximately) over the surface perimeter, with a spacing given by what's returned by the getGridSpacing() method.
 FaultTrace getEvenlyDiscritizedUpperEdge()
          This returns a list of locations that are evenly spread along the upper edge of the surface.
 Location getFirstLocOnUpperEdge()
          This returns the first location on the upper edge of the surface
 double getFractionOfSurfaceInRegion(Region region)
          The is returns the fraction of this rupture surface that's inside the given region.
 double getGridSpacingAlongStrike()
          returns the grid spacing along strike
 double getGridSpacingDownDip()
          returns the grid spacing down dip
 String getInfo()
          This is a string giving brief info about the surface (e.g., used in GUIs)
 Location getLastLocOnUpperEdge()
          This returns the last location on the upper edge of the surface
 Location getLocation(int row, int column)
          gets the location from the 2D container
 ListIterator<Location> getLocationsIterator()
          This returns what's given by getEvenlyDiscritizedListOfLocsOnSurface() as an interator
 int getMainNumCols()
          Proxy method that returns the number of colums in the main GriddedSurface.
 int getMainNumRows()
          Proxy method that returns the number of rows in the main GriddedSurface.
 double getMinDistance(RuptureSurface surface)
          This returns the minimum distance as the minimum among all location pairs between the two surfaces
 EvenlyGriddedSurface getParentSurface()
          This returns the parent surface
 LocationList getPerimeter()
          Get a list of locations that constitutes the perimeter of the surface (not necessarily evenly spaced)
 FaultTrace getRowAsTrace(int row)
          Gets a specified row as a fault trace
 FaultTrace getUpperEdge()
          Returns same as getEvenlyDiscritizedUpperEdge()
 Boolean isGridSpacingSame()
          this tells whether along-strike and down-dip grid spacings are the same
 boolean isPointSurface()
          This indicates whether this is a point surface
 void setLocation(int row, int col, Location location)
          Add a Location to the grid.
 
Methods inherited from class org.opensha.commons.data.ContainerSubset2D
clear, commit, exist, get, getAllByColumnsIterator, getAllByRowsIterator, getColumnIterator, getContainer2D, getEndCol, getEndRow, getName, getNumCols, getNumRows, getRowIterator, getStartCol, getStartRow, initTransaction, iterator, listIterator, main, rollback, set, setContainer2D, setName, setStartCol, setStartRow, shiftCols, shiftRows, size, toJava2D, toString, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.opensha.commons.data.Container2D
clear, exist, get, getAllByColumnsIterator, getAllByRowsIterator, getColumnIterator, getNumCols, getNumRows, getRowIterator, listIterator, set, setName, size, toString
 
Methods inherited from interface org.opensha.commons.data.Named
getName
 
Methods inherited from interface java.lang.Iterable
iterator
 

Constructor Detail

GriddedSubsetSurface

public GriddedSubsetSurface(int numRows,
                            int numCols,
                            int startRow,
                            int startCol,
                            EvenlyGriddedSurface data)
                     throws ArrayIndexOutOfBoundsException
Constructor for the GriddedSubsetSurface object

Parameters:
numRows - Specifies the length of the window.
numCols - Specifies the height of the window
startRow - Start row into the main GriddedSurface.
startCol - Start column into the main GriddedSurface.
data - The main GriddedSurface this is a window into
Throws:
ArrayIndexOutOfBoundsException - Thrown if window indexes exceed the main GriddedSurface indexes.
Method Detail

setLocation

public void setLocation(int row,
                        int col,
                        Location location)
Add a Location to the grid. This method throws UnsupportedOperationException as it is disabled.


getMainNumRows

public int getMainNumRows()
Proxy method that returns the number of rows in the main GriddedSurface.


getMainNumCols

public int getMainNumCols()
Proxy method that returns the number of colums in the main GriddedSurface.


getAveStrike

public double getAveStrike()
Description copied from interface: RuptureSurface
Average strike (degrees) of rupture surface

Specified by:
getAveStrike in interface RuptureSurface
Returns:

getEvenlyDiscritizedListOfLocsOnSurface

public LocationList getEvenlyDiscritizedListOfLocsOnSurface()
Description copied from interface: RuptureSurface
This returns a list of locations that are evenly spread (at least approximately) over the rupture surface, with a spacing given by what's returned by the getGridSpacing() method. Further details are specified by the implementing class. Don't assume the locations are ordered as one reads the words on a page in a book (not the case for CompoundGriddedSurface).

Specified by:
getEvenlyDiscritizedListOfLocsOnSurface in interface RuptureSurface
Returns:

getAveDip

public double getAveDip()
Proxy method that returns the aveDip of the main GriddedSurface.

This should actually be recomputed if the main surface is a SimpleListricGriddedSurface.

Specified by:
getAveDip in interface RuptureSurface
Returns:

getAveLength

public double getAveLength()
Description copied from interface: RuptureSurface
This returns the average length of the surface in km

Specified by:
getAveLength in interface RuptureSurface
Returns:
double

getAveWidth

public double getAveWidth()
Description copied from interface: RuptureSurface
Average down-dip width (km) of rupture surface

Specified by:
getAveWidth in interface RuptureSurface
Returns:

getEvenlyDiscritizedPerimeter

public LocationList getEvenlyDiscritizedPerimeter()
Description copied from interface: RuptureSurface
This returns a list of locations that are evenly spread (at least approximately) over the surface perimeter, with a spacing given by what's returned by the getGridSpacing() method. Further details are specified by the implementing class. These locations should be ordered starting along the top and moving along following the Aki and Richards convention.

Specified by:
getEvenlyDiscritizedPerimeter in interface RuptureSurface
Returns:

getGridSpacingAlongStrike

public double getGridSpacingAlongStrike()
returns the grid spacing along strike

Specified by:
getGridSpacingAlongStrike in interface EvenlyGriddedSurface
Returns:

getGridSpacingDownDip

public double getGridSpacingDownDip()
returns the grid spacing down dip

Specified by:
getGridSpacingDownDip in interface EvenlyGriddedSurface
Returns:

isGridSpacingSame

public Boolean isGridSpacingSame()
this tells whether along-strike and down-dip grid spacings are the same

Specified by:
isGridSpacingSame in interface EvenlyGriddedSurface
Returns:

getArea

public double getArea()
Description copied from interface: RuptureSurface
This returns the surface area in km-sq

Specified by:
getArea in interface RuptureSurface
Returns:
double

getLocation

public Location getLocation(int row,
                            int column)
Description copied from interface: EvenlyGriddedSurface
gets the location from the 2D container

Specified by:
getLocation in interface EvenlyGriddedSurface
Returns:

getLocationsIterator

public ListIterator<Location> getLocationsIterator()
Description copied from interface: RuptureSurface
This returns what's given by getEvenlyDiscritizedListOfLocsOnSurface() as an interator

Specified by:
getLocationsIterator in interface RuptureSurface
Returns:

getRowAsTrace

public FaultTrace getRowAsTrace(int row)
Description copied from interface: EvenlyGriddedSurface
Gets a specified row as a fault trace

Specified by:
getRowAsTrace in interface EvenlyGriddedSurface
Returns:

getAveDipDirection

public double getAveDipDirection()
Description copied from interface: RuptureSurface
Average dip direction (degrees) of rupture surface

Specified by:
getAveDipDirection in interface RuptureSurface
Returns:

getAveGridSpacing

public double getAveGridSpacing()
Description copied from interface: RuptureSurface
This returns the average grid spacing used to define the discretization used in what's returned by the methods here that contain "Discretized" in their names.

Specified by:
getAveGridSpacing in interface RuptureSurface
Returns:

getEvenlyDiscritizedUpperEdge

public FaultTrace getEvenlyDiscritizedUpperEdge()
Description copied from interface: RuptureSurface
This returns a list of locations that are evenly spread along the upper edge of the surface. Further details are specified by the implementing class. These locations should be ordered along the fault following the Aki and Richards convention.

Specified by:
getEvenlyDiscritizedUpperEdge in interface RuptureSurface
Returns:

getEvenlyDiscritizedLowerEdge

public FaultTrace getEvenlyDiscritizedLowerEdge()
Description copied from interface: RuptureSurface
This returns a list of locations that are evenly spread along the lower edge of the surface. Further details are specified by the implementing class. These locations should be ordered along the fault following the Aki and Richards convention.

Specified by:
getEvenlyDiscritizedLowerEdge in interface RuptureSurface
Returns:

getFirstLocOnUpperEdge

public Location getFirstLocOnUpperEdge()
Description copied from interface: RuptureSurface
This returns the first location on the upper edge of the surface

Specified by:
getFirstLocOnUpperEdge in interface RuptureSurface
Returns:

getLastLocOnUpperEdge

public Location getLastLocOnUpperEdge()
Description copied from interface: RuptureSurface
This returns the last location on the upper edge of the surface

Specified by:
getLastLocOnUpperEdge in interface RuptureSurface
Returns:

getPerimeter

public LocationList getPerimeter()
Description copied from interface: RuptureSurface
Get a list of locations that constitutes the perimeter of the surface (not necessarily evenly spaced)

Specified by:
getPerimeter in interface RuptureSurface

getUpperEdge

public FaultTrace getUpperEdge()
Returns same as getEvenlyDiscritizedUpperEdge()

Specified by:
getUpperEdge in interface RuptureSurface
Returns:

getDistanceRup

public double getDistanceRup(Location siteLoc)
This returns rupture distance (kms to closest point on the rupture surface), assuming the location has zero depth (for numerical expediency).

Specified by:
getDistanceRup in interface RuptureSurface
Returns:

getDistanceJB

public double getDistanceJB(Location siteLoc)
This returns distance JB (shortest horz distance in km to surface projection of rupture), assuming the location has zero depth (for numerical expediency).

Specified by:
getDistanceJB in interface RuptureSurface
Returns:

getDistanceSeis

public double getDistanceSeis(Location siteLoc)
This returns "distance seis" (shortest distance in km to point on rupture deeper than 3 km), assuming the location has zero depth (for numerical expediency).

Specified by:
getDistanceSeis in interface RuptureSurface
Returns:

getDistanceX

public double getDistanceX(Location siteLoc)
This returns distance X (the shortest distance in km to the rupture trace extended to infinity), where values >= 0 are on the hanging wall and values < 0 are on the foot wall. The location is assumed to be at zero depth (for numerical expediency).

Specified by:
getDistanceX in interface RuptureSurface
Returns:

getAveRupTopDepth

public double getAveRupTopDepth()
Description copied from interface: RuptureSurface
Average depth (km) to top of rupture (always a positive number)

Specified by:
getAveRupTopDepth in interface RuptureSurface
Returns:

getFractionOfSurfaceInRegion

public double getFractionOfSurfaceInRegion(Region region)
Description copied from interface: RuptureSurface
The is returns the fraction of this rupture surface that's inside the given region.

Specified by:
getFractionOfSurfaceInRegion in interface RuptureSurface
Returns:

getInfo

public String getInfo()
Description copied from interface: RuptureSurface
This is a string giving brief info about the surface (e.g., used in GUIs)

Specified by:
getInfo in interface RuptureSurface

isPointSurface

public boolean isPointSurface()
Description copied from interface: RuptureSurface
This indicates whether this is a point surface

Specified by:
isPointSurface in interface RuptureSurface
Returns:

getParentSurface

public EvenlyGriddedSurface getParentSurface()
This returns the parent surface

Returns:

getMinDistance

public double getMinDistance(RuptureSurface surface)
This returns the minimum distance as the minimum among all location pairs between the two surfaces

Specified by:
getMinDistance in interface RuptureSurface
Parameters:
surface - RuptureSurface
Returns:
distance in km