diff artifacts/src/main/java/org/dive4elements/river/utils/DoubleUtil.java @ 8587:07c9ac22f611

(issue1755) Generalise BedQuality result handling The bedquality calculation now produces a result for each time period which has BedQualityResultValues for each specific result type. Formally this was split up in density, porosity and diameter classes with some bedload diameter classes mixed in for extra fun. The intent of this commit is to allow more shared code and generic access patterns to the BedQuality results.
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 18 Mar 2015 18:42:08 +0100
parents 073ea4bcea58
children b486812f4f14
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/utils/DoubleUtil.java	Tue Mar 17 18:52:00 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/utils/DoubleUtil.java	Wed Mar 18 18:42:08 2015 +0100
@@ -316,10 +316,10 @@
     /** Convieniance function for results to get an interpolator.
      * This is basically a static wrapper to for LinearInterpolator.interpolate
      * with error handling. Returns null on error.*/
-    public static PolynomialSplineFunction getLinearInterpolator(TDoubleArrayList x, TDoubleArrayList y) {
+    public static PolynomialSplineFunction getLinearInterpolator(double[] x, double[] y) {
         LinearInterpolator lpol = new LinearInterpolator();
         try {
-            return lpol.interpolate(x.toNativeArray(), y.toNativeArray());
+            return lpol.interpolate(x, y);
         } catch (DimensionMismatchException e) {
             log.error("KMs and Result values have different sizes. Failed to interpolate: " +
                     e.getMessage());
@@ -330,5 +330,9 @@
         }
         return null;
     }
+
+    public static PolynomialSplineFunction getLinearInterpolator(TDoubleArrayList x, TDoubleArrayList y) {
+        return getLinearInterpolator(x.toNativeArray(), y.toNativeArray());
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org