view artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculationResult.java @ 8915:d9dbf0b74bc2

Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
author gernotbelger
date Wed, 28 Feb 2018 17:27:15 +0100
parents a66f2a7c4f84
children 82998242ba84
line wrap: on
line source
/* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
 * Software engineering by
 *  Björnsen Beratende Ingenieure GmbH
 *  Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
 *
 * This file is Free Software under the GNU AGPL (>=v3)
 * and comes with ABSOLUTELY NO WARRANTY! Check out the
 * documentation coming with Dive4Elements River for details.
 */
package org.dive4elements.river.artifacts.sinfo.flowdepth;

import java.util.Collection;

import org.dive4elements.river.artifacts.sinfo.common.AbstractSInfoCalculationResult;
import org.dive4elements.river.artifacts.sinfo.util.BedHeightInfo;
import org.dive4elements.river.artifacts.sinfo.util.WstInfo;

import gnu.trove.TDoubleArrayList;

/**
 * Contains the results of a {@link FlowDepthCalculation}.
 *
 * @author Gernot Belger
 */
final class FlowDepthCalculationResult extends AbstractSInfoCalculationResult<FlowDepthRow> {

    private static final long serialVersionUID = 1L;

    private final BedHeightInfo sounding;

    public FlowDepthCalculationResult(final String label, final WstInfo wst, final BedHeightInfo sounding, final boolean hasTkh,
            final Collection<FlowDepthRow> rows) {
        super(label, wst, hasTkh, rows);

        this.sounding = sounding;
    }

    public BedHeightInfo getSounding() {
        return this.sounding;
    }

    public double[][] getFlowDepthPoints() {

        final Collection<FlowDepthRow> rows = getRows();

        final TDoubleArrayList xPoints = new TDoubleArrayList(rows.size());
        final TDoubleArrayList yPoints = new TDoubleArrayList(rows.size());

        for (final FlowDepthRow row : rows) {
            xPoints.add(row.getStation());
            yPoints.add(row.getFlowDepth());
        }

        return new double[][] { xPoints.toNativeArray(), yPoints.toNativeArray() };
    }

    public double[][] getFlowDepthTkhPoints() {

        final Collection<FlowDepthRow> rows = getRows();

        final TDoubleArrayList xPoints = new TDoubleArrayList(rows.size());
        final TDoubleArrayList yPoints = new TDoubleArrayList(rows.size());

        for (final FlowDepthRow row : rows) {
            xPoints.add(row.getStation());
            yPoints.add(row.getFlowDepthWithTkh());
        }

        return new double[][] { xPoints.toNativeArray(), yPoints.toNativeArray() };
    }
}

http://dive4elements.wald.intevation.org