HyperbolicMeshing extends MeshingFunction { @Override public Double evaluate(Integer i) { Validate.isTrue(i >= 0 && i < getNumberOfPoints(), "i out of range"); if (i == 0) { return _l; } if (i == getNumberOfPoints() - 1) { return _r; } if (_fpValues != null) { int index = _um.getFixedPointIndex(i); if (index >= 0) { return _fpValues[index]; } } final double z = _um.evaluate(i); return _alpha + _beta * Math.sinh(_gamma * z + _delta); } HyperbolicMeshing(final double xMin, final double xMax, final double xCent, final int nPoints, final double beta);  HyperbolicMeshing(final double xMin, final double xMax, final double xCent, final int nPoints, final double beta, final double[] fixedPoints); @Override Double evaluate(Integer i);  }
@Test public void testEndPoints() { assertEquals(A, HYP_MESH.evaluate(0), 1e-10); assertEquals(B, HYP_MESH.evaluate(N - 1), 1e-10); }
@Test public void testSpacing() { double dx, oldDx; double x = A; oldDx = HYP_MESH.evaluate(1) - HYP_MESH.evaluate(0); int i = 2; while (x < K) { dx = HYP_MESH.evaluate(i) - HYP_MESH.evaluate(i - 1); assertTrue(dx < oldDx); oldDx = dx; i++; x = HYP_MESH.evaluate(i); } x = B; oldDx = HYP_MESH.evaluate(N - 1) - HYP_MESH.evaluate(N - 2); i = N - 2; while (x > K) { dx = HYP_MESH.evaluate(i) - HYP_MESH.evaluate(i - 1); assertTrue(dx < oldDx); oldDx = dx; i--; x = HYP_MESH.evaluate(i); } }