public static void assignValuesToSubregions(List<Region> subregions, List regions, String feature_name)
      throws AuToBIException {
    // Constructs a single contour that spans the whole list of regions.
    // To hold every value, use the smallest time step and lowest start time.
    double x0 = Double.MAX_VALUE;
    double time_step = Double.MAX_VALUE;
    double max_time = 0.0;
    for (Region r : (List<Region>) regions) {
      if (r.hasAttribute(feature_name)) {
        Contour c = (Contour) r.getAttribute(feature_name);
        x0 = Math.min(x0, c.getStart());
        time_step = Math.min(time_step, c.getStep());
        max_time = Math.max(max_time, c.getStart() + c.size() * c.getStep());
      }
    }

    // Only bother with the assignment if there is a contour to process
    if (max_time - x0 > 0) {
      Contour contour = new Contour(x0, time_step, (int) Math.ceil((max_time - x0) / time_step));
      for (Region r : (List<Region>) regions) {
        Contour c = (Contour) r.getAttribute(feature_name);
        for (Pair<Double, Double> tvp : c) {
          contour.set(tvp.first, tvp.second);
        }
      }

      for (Region r : subregions) {
        Contour values_subset = ContourUtils.getSubContour(contour, r.getStart(), r.getEnd());
        r.setAttribute(feature_name, values_subset);
      }
    }
  }