Merge "Issue #2791 Fix streamlines that were broken in conversion to data source." into development
Former-commit-id:e0af16feed
[formerly609e574825
[formerly 045e498e5d6a47bc35fc7d26b8d8b431dcd4b492]] Former-commit-id:609e574825
Former-commit-id:584c8d2fc3
This commit is contained in:
commit
472d4a213f
2 changed files with 28 additions and 12 deletions
|
@ -1151,6 +1151,11 @@ public class ContourSupport {
|
|||
maxspc = 0.25f;
|
||||
}
|
||||
|
||||
if (minX != 0 || minY != 0) {
|
||||
uW = new OffsetDataSource(uW, minX, minY);
|
||||
vW = new OffsetDataSource(vW, minX, minY);
|
||||
}
|
||||
|
||||
StrmPakConfig config = new StrmPakConfig(arrowSize, minspc, maxspc,
|
||||
-1000000f, -999998f);
|
||||
StreamLineContainer container = StrmPak.strmpak(uW, vW,
|
||||
|
@ -1169,9 +1174,10 @@ public class ContourSupport {
|
|||
StreamLinePoint point = points.get(i);
|
||||
try {
|
||||
long tZ0 = System.currentTimeMillis();
|
||||
rastPosToWorldGrid.transform(new double[] {
|
||||
maxX - point.getX(), point.getY() + minY }, 0,
|
||||
valsArr[i], 0, 1);
|
||||
rastPosToWorldGrid.transform(
|
||||
new double[] { point.getX() + minX,
|
||||
point.getY() + minY }, 0, valsArr[i],
|
||||
0, 1);
|
||||
long tZ1 = System.currentTimeMillis();
|
||||
tAccum += (tZ1 - tZ0);
|
||||
} catch (TransformException e) {
|
||||
|
|
|
@ -25,8 +25,10 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.common.numeric.array.FloatArray2DWrapper;
|
||||
import com.raytheon.uf.common.numeric.filter.DataFilter;
|
||||
import com.raytheon.uf.common.numeric.source.AxisSwapDataSource;
|
||||
import com.raytheon.uf.common.numeric.source.DataSource;
|
||||
import com.raytheon.uf.common.numeric.source.FilteredDataSource;
|
||||
import com.raytheon.viz.core.contours.util.StreamLineContainer.StreamLinePoint;
|
||||
|
||||
/**
|
||||
|
@ -131,7 +133,8 @@ public final class StrmPak {
|
|||
private final PointValueBuffer<Float> JPnt;
|
||||
|
||||
/**
|
||||
* Generate streamlines using column major float data.
|
||||
* Generate streamlines using column major float data. The u component is
|
||||
* assumed to moving in the opposite direction of the x axis.
|
||||
*
|
||||
* @param uComp
|
||||
* data values for the u component of the vector
|
||||
|
@ -153,6 +156,13 @@ public final class StrmPak {
|
|||
DataSource vSource = new FloatArray2DWrapper(vComp, ny, nx);
|
||||
uSource = new AxisSwapDataSource(uSource);
|
||||
vSource = new AxisSwapDataSource(vSource);
|
||||
uSource = FilteredDataSource.addFilters(uSource, new DataFilter() {
|
||||
|
||||
@Override
|
||||
public double filter(double value) {
|
||||
return -value;
|
||||
}
|
||||
});
|
||||
return strmpak(uSource, vSource, nx, ny, config);
|
||||
}
|
||||
|
||||
|
@ -521,14 +531,14 @@ public final class StrmPak {
|
|||
influx = V.getDataValue(i, j) * (1.0f - x)
|
||||
+ V.getDataValue(ii, j) * x;
|
||||
} else if (side0 == 2) {
|
||||
influx = -(U.getDataValue(ii, j) * (1.0f - y) + U
|
||||
.getDataValue(ii, jj) * y);
|
||||
influx = U.getDataValue(ii, j) * (1.0f - y)
|
||||
+ U.getDataValue(ii, jj) * y;
|
||||
} else if (side0 == 3) {
|
||||
influx = -(V.getDataValue(i, jj) * (1.0f - x) + V
|
||||
.getDataValue(ii, jj) * x);
|
||||
} else {
|
||||
influx = U.getDataValue(i, j) * (1.0f - y)
|
||||
+ U.getDataValue(i, jj) * y;
|
||||
influx = -(U.getDataValue(i, j) * (1.0f - y) + U
|
||||
.getDataValue(i, jj) * y);
|
||||
}
|
||||
if (influx < 0.0f) {
|
||||
dirflg = -1.0f;
|
||||
|
@ -647,12 +657,12 @@ public final class StrmPak {
|
|||
float[] Flux = { Float.NaN,
|
||||
(-dirflg) * (float) V.getDataValue(i, j),
|
||||
(-dirflg) * (float) V.getDataValue(ii, j),
|
||||
dirflg * (float) U.getDataValue(ii, j),
|
||||
dirflg * (float) U.getDataValue(ii, jj),
|
||||
(-dirflg) * (float) U.getDataValue(ii, j),
|
||||
(-dirflg) * (float) U.getDataValue(ii, jj),
|
||||
dirflg * (float) V.getDataValue(ii, jj),
|
||||
dirflg * (float) V.getDataValue(i, jj),
|
||||
(-dirflg) * (float) U.getDataValue(i, jj),
|
||||
(-dirflg) * (float) U.getDataValue(i, j) };
|
||||
dirflg * (float) U.getDataValue(i, jj),
|
||||
dirflg * (float) U.getDataValue(i, j) };
|
||||
|
||||
// Count total number of in, out, and zero contributions
|
||||
// to net flux.
|
||||
|
|
Loading…
Add table
Reference in a new issue