コード例 #1
0
 /**
  * Reads rupture depth distribution data (rupture magnitude vs. rupture depth) and returns an
  * {@link ArbitrarilyDiscretizedFunc}
  */
 private ArbitrarilyDiscretizedFunc getRuptureDepthDistribution(Element ruptureDepthDist) {
   ArbitrarilyDiscretizedFunc rupDepthDist = new ArbitrarilyDiscretizedFunc();
   String xVals = (String) ruptureDepthDist.element(MAGNITUDE).getData();
   String yVals = (String) ruptureDepthDist.element(DEPTH).getData();
   StringTokenizer xVal = new StringTokenizer(xVals);
   StringTokenizer yVal = new StringTokenizer(yVals);
   while (xVal.hasMoreTokens())
     rupDepthDist.set(Double.valueOf(xVal.nextToken()), Double.valueOf(yVal.nextToken()));
   return rupDepthDist;
 }
コード例 #2
0
 /**
  * set x values back from the log space to the original linear values for Hazard Function after
  * completion of the Hazard Calculations if the selected IMT are SA , PGA or PGV It accepts 1
  * parameters
  *
  * @param hazFunction : this is the function with X values set
  */
 private ArbitrarilyDiscretizedFunc toggleHazFuncLogValues(
     ArbitrarilyDiscretizedFunc hazFunc, double[] xValues) {
   int numPoints = hazFunc.getNum();
   DiscretizedFuncAPI tempFunc = hazFunc.deepClone();
   hazFunc = new ArbitrarilyDiscretizedFunc();
   // take log only if it is PGA, PGV or SA
   if (this.xLogFlag) {
     for (int i = 0; i < numPoints; ++i) hazFunc.set(xValues[i], tempFunc.getY(i));
     return hazFunc;
   } else throw new RuntimeException("Unsupported IMT");
 }