Commit 07bda0ac authored by Piotr Wendykier's avatar Piotr Wendykier

Merge develop into feature/InstallBuilder2

Conflicts:
	src/pl/edu/icm/visnow/geometries/objects/ColormapLegend.java
parents b646d5cb b8ca6d75
......@@ -75,7 +75,7 @@
<core package="pl.edu.icm.visnow.lib.basic.filters.CropDown"/>
<core package="pl.edu.icm.visnow.lib.basic.filters.SimpleProjection"/>
<core package="pl.edu.icm.visnow.lib.basic.filters.AddMargins"/>
<core package="pl.edu.icm.visnow.lib.basic.filters.RegularFieldDifferentialOperations"/>
<core package="pl.edu.icm.visnow.lib.basic.filters.DifferentialOperations"/>
<core package="pl.edu.icm.visnow.lib.basic.filters.InterpolationToRegularField"/>
<core package="pl.edu.icm.visnow.lib.basic.filters.MulticomponentHistogram"/>
<core package="pl.edu.icm.visnow.lib.basic.filters.FFT"/>
......
......@@ -220,7 +220,9 @@ public class DataMappingGUI extends javax.swing.JPanel
blendingTypeComboBox.setEnabled(enabled);
blendingAlphaRatioLabel.setEnabled(enabled);
blendingAlphaRatioSlider.setEnabled(enabled);
blendingAlphaMapPanel.setVisible(enabled);
blendingAlphaMapPanel.setEnabled(enabled);
blendingSBColorComponentPanel.setVisible(enabled);
blendingSBColorComponentPanel.setEnabled(enabled);
}
......
......@@ -606,8 +606,8 @@ public class RegularField3DGeometry extends RegularFieldGeometry
orientation = det > 0;
}
for (int i = 0; i < 3; i++) {
faceFields[i][0] = SliceRegularField.sliceField(regularField, i, 0);
faceFields[i][1] = SliceRegularField.sliceField(regularField, i, dims[i] - 1);
faceFields[i][0] = SliceRegularField.sliceField(regularField, i, 0, true);
faceFields[i][1] = SliceRegularField.sliceField(regularField, i, dims[i] - 1, true);
if (content3DParams.getDataMap() != RegularField3DParams.SLICE) {
faceFields[i][0].removeComponents();
faceFields[i][1].removeComponents();
......
......@@ -353,7 +353,7 @@ public class AnisotropicDenoiser extends OutFieldVisualizationModule
presmoothedField = new RegularField(dims);
int nSlices = dims[dims.length - 1];
for (int sl = 0; sl < nSlices; sl++) {
RegularField slice = SliceRegularField.sliceField(inField, dims.length - 1, sl);
RegularField slice = SliceRegularField.sliceField(inField, dims.length - 1, sl, true);
RegularField presmoothedSlice
= p.get(PRESMOOTH_METHOD) == MEDIAN
? medianCompute.computePresmoothing(slice, pp)
......@@ -442,8 +442,8 @@ public class AnisotropicDenoiser extends OutFieldVisualizationModule
outArrays[component] = LargeArrayUtils.create(in.getType(), inField.getComponent(component).getRawArray().length(), false);
}
for (int sl = 0; sl < nSlices; sl++) {
RegularField slice = SliceRegularField.sliceField(inField, dims.length - 1, sl);
RegularField anisoSlice = SliceRegularField.sliceField(anisotropyField, dims.length - 1, sl);
RegularField slice = SliceRegularField.sliceField(inField, dims.length - 1, sl, true);
RegularField anisoSlice = SliceRegularField.sliceField(anisotropyField, dims.length - 1, sl, true);
RegularField smoothedSlice = anisotropicallySmooth(clonedParameters, slice, anisoSlice, progressAgent);
for (int component = 0, cmp = 0; component < components.size(); component++) {
if (inField.getComponent(component).isNumeric() && smoothedSlice != null) {
......
......@@ -36,7 +36,7 @@
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
//</editor-fold>
package pl.edu.icm.visnow.lib.basic.filters.RegularFieldDifferentialOperations;
package pl.edu.icm.visnow.lib.basic.filters.DifferentialOperations;
import pl.edu.icm.visnow.engine.core.ParameterName;
import pl.edu.icm.visnow.gui.widgets.RunButton.RunState;
......@@ -45,16 +45,23 @@ import pl.edu.icm.visnow.gui.widgets.RunButton.RunState;
*
* @author Marcin Szpak, University of Warsaw, ICM
*/
public class RegularFieldDifferentialOperationsShared
public class DifferentialOperationsShared
{
public enum ScalarOperation
{
GRADIENT, GRADIENT_NORM, GRADIENT_COMPONENTS, NORMALIZED_GRADIENT, LAPLACIAN, HESSIAN, HESSIAN_EIGEN
GRADIENT, GRADIENT_NORM, GRADIENT_COMPONENTS, NORMALIZED_GRADIENT,
LAPLACIAN, HESSIAN, HESSIAN_EIGEN
};
public enum VectorOperation
{
DERIV, DIV, ROT
DERIV, DERIV_COMPONENTS, DIV, ROT
};
public enum TimeOperation
{
D_DT, D2_DT2
};
//Parameter names + specification. SPECIFICATION CONSTRAINTS ARE NOT TESTED IN LOGIC!
......@@ -63,11 +70,18 @@ public class RegularFieldDifferentialOperationsShared
//not null array of arrays
//length == META_SCALAR_COMPONENT_NAMES.length
//each element is not null array of unique values
static final ParameterName<ScalarOperation[][]> SCALAR_OPERATIONS = new ParameterName<>("Operations for every scalar component");
static final ParameterName<ScalarOperation[][]> SCALAR_OPERATIONS =
new ParameterName<>("Operations for every scalar component");
//not null array of arrays
//length == META_VECTOR_COMPONENT_NAMES.length
//each element is not null array of unique values
static final ParameterName<VectorOperation[][]> VECTOR_OPERATIONS = new ParameterName<>("Operations for every vector component");
static final ParameterName<VectorOperation[][]> VECTOR_OPERATIONS =
new ParameterName<>("Operations for every vector component");
//not null array of arrays
//length == META_VECTOR_COMPONENT_NAMES.length
//each element is not null array of unique values
static final ParameterName<TimeOperation[][]> TIME_OPERATIONS =
new ParameterName<>("Time derivatives of components");
static final ParameterName<RunState> RUNNING_MESSAGE = new ParameterName<>("Running message");
......@@ -76,4 +90,7 @@ public class RegularFieldDifferentialOperationsShared
static final ParameterName<String[]> META_SCALAR_COMPONENT_NAMES = new ParameterName("META scalar component names");
//not null array of Strings, may be empty
static final ParameterName<String[]> META_VECTOR_COMPONENT_NAMES = new ParameterName("META vector component names");
//not null array of Strings, may be empty
static final ParameterName<String[]> META_TIME_COMPONENT_NAMES = new ParameterName("META time component names");
static final ParameterName<Boolean> COMPUTE_FULLY = new ParameterName("compute all timesteps");
}
<html><head><title>DifferentialOperations</title><style type="text/css">ol{margin:0;padding:0}.c4{max-width:468pt;background-color:#ffffff;padding:72pt 72pt 72pt 72pt}.c5{list-style-type:disc;margin:0;padding:0}.c2{padding-left:0pt;margin-left:36pt}.c3{height:11pt}.c1{direction:ltr}.c0{font-weight:bold}.title{padding-top:0pt;line-height:1.15;text-align:left;color:#000000;font-size:21pt;font-family:"Trebuchet MS";padding-bottom:0pt}.subtitle{padding-top:0pt;line-height:1.15;text-align:left;color:#666666;font-style:italic;font-size:13pt;font-family:"Trebuchet MS";padding-bottom:10pt}li{color:#000000;font-size:11pt;font-family:"Arial"}p{color:#000000;font-size:11pt;margin:0;font-family:"Arial"}h1{padding-top:10pt;line-height:1.15;text-align:left;color:#000000;font-size:16pt;font-family:"Trebuchet MS";padding-bottom:0pt}h2{padding-top:10pt;line-height:1.15;text-align:left;color:#000000;font-size:13pt;font-family:"Trebuchet MS";font-weight:bold;padding-bottom:0pt}h3{padding-top:8pt;line-height:1.15;text-align:left;color:#666666;font-size:12pt;font-family:"Trebuchet MS";font-weight:bold;padding-bottom:0pt}h4{padding-top:8pt;line-height:1.15;text-align:left;color:#666666;font-size:11pt;text-decoration:underline;font-family:"Trebuchet MS";padding-bottom:0pt}h5{padding-top:8pt;line-height:1.15;text-align:left;color:#666666;font-size:11pt;font-family:"Trebuchet MS";padding-bottom:0pt}h6{padding-top:8pt;line-height:1.15;text-align:left;color:#666666;font-style:italic;font-size:11pt;font-family:"Trebuchet MS";padding-bottom:0pt}</style></head><body class="c4"><hr><p class="c1"><span>&nbsp;</span></p><p class="c1"><span class="c0">DIFFERENTIAL OPERATIONS</span></p><hr><p class="c1"><span>&nbsp;</span></p><p class="c3 c1"><span class="c0"></span></p><p class="c1"><span>The module performs basic differential operations for regular fields applying central differences.</span></p><p class="c3 c1"><span></span></p><hr><p class="c1"><span>&nbsp;</span></p><p class="c1"><span class="c0">Input data</span></p><p class="c3 c1"><span class="c0"></span></p><p class="c1"><span>The input field is regular.</span></p><p class="c3 c1"><span></span></p><hr><p class="c1"><span>&nbsp;</span></p><p class="c1"><span class="c0">Output data</span></p><p class="c3 c1"><span class="c0"></span></p><p class="c1"><span>The output field is regular.</span></p><p class="c3 c1"><span></span></p><hr><p class="c1"><span>&nbsp;</span></p><p class="c1"><span class="c0">Computation parameters</span></p><p class="c3 c1"><span class="c0"></span></p><p class="c1"><img height="100" src="images/image02.jpg" width="282"></p><p class="c3 c1"><span class="c0"></span></p><p class="c1"><img height="66" src="images/image01.jpg" width="220"></p><p class="c1"><span>In the first table all scalar components of the input field are listed, in the second table all vector components.</span></p><p class="c1"><span>For scalar components the user can calculate:</span></p><ol class="c5" start="1"><li class="c2 c1"><span>gradient,</span></li><li class="c2 c1"><span>gradient norm, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></li><li class="c2 c1"><span>normalized gradient,</span></li><li class="c2 c1"><span>Laplace operation,</span></li><li class="c2 c1"><span>Hessian matrix,</span></li><li class="c1 c2"><span>eigenvalues for Hessian matrix.</span></li></ol><p class="c1 c3"><span></span></p><p class="c1"><span>For vector components the user can calculate:</span></p><ol class="c5" start="1"><li class="c2 c1"><span>Jacobian matrix, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></li><li class="c2 c1"><span>divergence,</span></li><li class="c2 c1"><span>rotation.</span></li></ol><p class="c3 c1"><span></span></p><p class="c1"><span>In order to carry out the operation the appropriate check box has to be switched on.</span></p><p class="c1"><img height="30" src="images/image00.jpg" width="220"></p><p class="c1"><span>The module is activated by clicking the </span><span class="c0">run</span><span>&nbsp;button, unless the </span><span class="c0">auto</span><span>&nbsp;check box on the right hand side of the run button is switched on.</span></p><p class="c3 c1"><span></span></p></body></html>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module name="differential operations" class="RegularFieldDifferentialOperations">
<module name="differential operations" class="DifferentialOperations">
<inputs>
<input name="inField" type="pl.edu.icm.visnow.lib.types.VNField" modifiers="NECESSARY:TRIGGERING">
<acceptor>
<param name="REGULAR" value="true"/>
<param name="NDIMS" value="3"/>
</acceptor>
<acceptor>
<param name="REGULAR" value="true"/>
<param name="NDIMS" value="2"/>
</acceptor>
</input>
</inputs>
<outputs>
<output name="outField" type="pl.edu.icm.visnow.lib.types.VNRegularField">
<output name="outRegularField" type="pl.edu.icm.visnow.lib.types.VNRegularField">
</output>
<output name="outIrregularField" type="pl.edu.icm.visnow.lib.types.VNIrregularField">
</output>
<geometryOutput/>
</outputs>
<description value="Differential operations (gradient, rot, div) computed for regular field by central differences"/>
<description value="Differential operations (gradient, rot, div) computed for regular field by central differences. Time derivatives for both regular and irregular fields"/>
</module>
......@@ -45,7 +45,6 @@ import pl.edu.icm.visnow.engine.core.OutputEgg;
import pl.edu.icm.visnow.engine.core.Parameter;
import pl.edu.icm.visnow.engine.core.ParameterChangeListener;
import pl.edu.icm.visnow.engine.core.Parameters;
import pl.edu.icm.visnow.lib.basic.filters.RegularFieldDifferentialOperations.RegularFieldDifferentialOperations;
import pl.edu.icm.visnow.lib.templates.visualization.modules.OutFieldVisualizationModule;
......
......@@ -392,7 +392,7 @@ public class Isolines extends OutFieldVisualizationModule
irregularFieldGeometry.getCellSetGeometry(0).getDataMappingParams().addRenderEventListener(renderEventListener);
irregularFieldGeometry.getCellSetGeometry(0).getParams().getRenderingParams().removeRenderEventListener(renderEventListener);
irregularFieldGeometry.getCellSetGeometry(0).getParams().getRenderingParams().addRenderEventListener(renderEventListener);
irregularFieldGeometry.getColormapLegend(0).setThrTable(params.getThresholds());
irregularFieldGeometry.getColormapLegend(0).setThrTable(params.getThresholds(), inField.getComponent(params.getComponent()).getName());
GeometryObject2DStruct isolinesStruct = new GeometryObject2DStruct(out2D);
irregularFieldGeometry.getGeometryObj2DStruct().removeAllChildren();
irregularFieldGeometry.getGeometryObj2DStruct().addChild(isolinesStruct);
......
......@@ -230,11 +230,11 @@ public class Isosurface extends OutFieldVisualizationModule
outIrregularField.setPreferredExtents(inField.getPreferredExtents(), inField.getPreferredPhysicalExtents());
outIrregularField.setName(inField.getName());
prepareOutputGeometry();
irregularFieldGeometry.getColormapLegend(0).
setThrTable(parameters.get(THRESHOLDS),
inField.getComponent(parameters.get(SELECTED_COMPONENT)).getName());
if (updateRenderingParams) {
renderingParams.setDisplayMode(RenderingParams.SURFACE);
// if (presentationParams.getChildrenParams() != null)
// for (PresentationParams pp : presentationParams.getChildrenParams())
// pp.getRenderingParams().setDisplayMode(RenderingParams.SURFACE);
}
show();
setOutputValue("isosurfaceField", new VNIrregularField(outIrregularField));
......
......@@ -40,7 +40,6 @@
package pl.edu.icm.visnow.lib.basic.mappers.RegularFieldSlice;
import java.util.Arrays;
import javax.swing.JPanel;
import org.apache.log4j.Logger;
import pl.edu.icm.jscic.RegularField;
import pl.edu.icm.visnow.engine.core.InputEgg;
......@@ -69,6 +68,9 @@ public class RegularFieldSlice extends OutFieldVisualizationModule
protected RegularField inField = null;
protected RegularFieldSliceGUI computeUI = null;
private boolean previousRecalculateMinMax = false;
public RegularFieldSlice()
{
parameters.addParameterChangelistener(new ParameterChangeListener()
......@@ -77,8 +79,19 @@ public class RegularFieldSlice extends OutFieldVisualizationModule
public void parameterChanged(String name)
{
if (parameters.get(ADJUSTING)) {
SliceRegularField.sliceUpdate(inField, parameters.get(SELECTED_AXIS), parameters.get(SLICE_INDEX), outRegularField);
SliceRegularField.sliceUpdate(inField, parameters.get(SELECTED_AXIS), parameters.get(SLICE_INDEX), !parameters.get(RECALCULATE_MIN_MAX), outRegularField);
updateMinMax();
if (parameters.get(RECALCULATE_MIN_MAX)) {
String componentName = dataMappingParams.getColorMap0().getDataComponentName();
if (outRegularField.getComponent(componentName) != null) {
dataMappingParams.getColorMap0().getComponentRange().setActive(false);
dataMappingParams.getColorMap0().getComponentRange().setLowUp(
(float) outRegularField.getComponent(componentName).getPreferredMinValue(),
(float) outRegularField.getComponent(componentName).getPreferredMaxValue());
dataMappingParams.getColorMap0().getComponentRange().restoreActive();
}
}
regularFieldGeometry.updateDataMap();
regularFieldGeometry.updateCoords();
} else
......@@ -107,8 +120,7 @@ public class RegularFieldSlice extends OutFieldVisualizationModule
new Parameter<>(SLICE_INDEX, 1),
new Parameter<>(ADJUSTING, false),
new Parameter<>(META_FIELD_DIMENSION_LENGTHS, new int[]{2, 2, 2})
};
};
}
private void validateParamsAndSetSmart(boolean resetParameters)
......@@ -131,12 +143,19 @@ public class RegularFieldSlice extends OutFieldVisualizationModule
private void updateMinMax()
{
if (parameters.get(RECALCULATE_MIN_MAX) && outField != null) {
if(outRegularField == null)
return;
if (parameters.get(RECALCULATE_MIN_MAX)) {
for (int i = 0; i < outRegularField.getNComponents(); i++) {
outRegularField.getComponent(i).recomputeStatistics();
}
}
if (parameters.get(RECALCULATE_MIN_MAX) != previousRecalculateMinMax) {
for (int i = 0; i < outField.getNComponents(); i++) {
outField.getComponent(i).recomputeStatistics();
outField.getComponent(i).setAutoResetMapRange(true);
}
ui.getPresentationGUI().getDataMappingGUI().getMap0Panel().updateComponent();
}
}
previousRecalculateMinMax = parameters.get(RECALCULATE_MIN_MAX);
}
/**
......@@ -165,12 +184,16 @@ public class RegularFieldSlice extends OutFieldVisualizationModule
notifyGUIs(p, isFromVNA() || isDifferentField, false);
int axis = parameters.get(SELECTED_AXIS);
outField = outRegularField = SliceRegularField.sliceField(inField, axis, parameters.get(SLICE_INDEX));
outField = outRegularField = SliceRegularField.sliceField(inField, axis, parameters.get(SLICE_INDEX), !parameters.get(RECALCULATE_MIN_MAX));
outField.setName(inField.getName());
updateMinMax();
setOutputValue("outField", new VNRegularField(outRegularField));
prepareOutputGeometry();
show();
for (int i = 0; i < outField.getNComponents(); i++) {
outRegularField.getComponent(i).setAutoResetMapRange(false);
}
}
}
}
package pl.edu.icm.visnow.lib.basic.readers.ReadFluent;
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.ByteOrder;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
/**
*
* @author babor
*/
public class MemoryFileImageInputStream {
private File file;
private byte[] data;
private ByteOrder byteOrder;
private int offset = 0;
public MemoryFileImageInputStream(File file) throws FileNotFoundException, IOException {
this.file = file;
final FileChannel channel = new FileInputStream(file).getChannel();
MappedByteBuffer buffer = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size());
int size = buffer.remaining();
data = new byte[size];
buffer.get(data);
channel.close();
}
public void setByteOrder(ByteOrder byteOrder) {
this.byteOrder = byteOrder;
}
public ByteOrder getByteOrder() {
return byteOrder;
}
public void close() {
data = null;
}
/**
* Reads a single byte from the min-memory array and returns it as an
* <code>int</code> between 0 and 255. If end of array is reached,
* <code>-1</code> is returned.
*
* @return the value of the next byte in the in-memory array, or <code>-1</code>
* if end of array is reached.
*
* @exception IOException if the array is null.
*/
public int read() throws IOException {
if(data == null)
throw new IOException("No data available. Stream either not opened or closed.");
if(offset < 0)
throw new IOException("ERROR stream size overflow.");
if(offset > data.length)
throw new EOFException();
if(offset == data.length)
return -1;
return 0xff&data[offset++];
}
/**
* Seeks to 0.
*
*/
public void reset() {
seek(0);
}
/**
* Sets the current stream position to the desired location. The
* next read will occur at this location.
*
* <p> An <code>IndexOutOfBoundsException</code> will be thrown if
* <code>pos</code> is smaller than 0.
*
* <p> It is legal to seek past the end of the file; an
* <code>java.io.EOFException</code> will be thrown only if a read is
* performed.
*
* @param pos an <code>int</code> containing the desired file
* pointer position.
*
* @exception IndexOutOfBoundsException if <code>pos</code> is smaller
* than 0.
*/
public void seek(int i) {
if(i < 0)
throw new IndexOutOfBoundsException();
offset = i;
}
}
......@@ -38,21 +38,27 @@
//</editor-fold>
package pl.edu.icm.visnow.lib.basic.readers.ReadFluent;
import java.util.ArrayList;
import pl.edu.icm.jlargearrays.FloatLargeArray;
import pl.edu.icm.jscic.CellSet;
import pl.edu.icm.jscic.cells.Cell;
import pl.edu.icm.jscic.cells.CellType;
import pl.edu.icm.jscic.IrregularField;
import pl.edu.icm.jscic.dataarrays.DataArray;
import pl.edu.icm.jlargearrays.UnsignedByteLargeArray;
import pl.edu.icm.jscic.dataarrays.DataArrayType;
import pl.edu.icm.visnow.engine.core.OutputEgg;
import pl.edu.icm.visnow.engine.core.Parameter;
import pl.edu.icm.visnow.engine.core.ParameterChangeListener;
import pl.edu.icm.visnow.engine.core.Parameters;
import pl.edu.icm.visnow.geometries.parameters.RenderingParams;
import pl.edu.icm.visnow.gui.events.FloatValueModificationEvent;
import pl.edu.icm.visnow.gui.events.FloatValueModificationListener;
import pl.edu.icm.visnow.lib.templates.visualization.modules.OutFieldVisualizationModule;
import pl.edu.icm.visnow.lib.types.VNIrregularField;
import pl.edu.icm.visnow.lib.utils.SwingInstancer;
import static pl.edu.icm.visnow.lib.basic.readers.ReadFluent.ReadFluentShared.*;
import static pl.edu.icm.visnow.lib.utils.field.CellToNode.*;
import pl.edu.icm.visnow.lib.utils.field.GeometricOrientation;
import pl.edu.icm.visnow.lib.utils.field.VectorComponentCombiner;
/**
* @author Bartosz Borucki (babor@icm.edu.pl) Warsaw University,
......@@ -65,8 +71,8 @@ public class ReadFluent extends OutFieldVisualizationModule
protected Cell[] stdCells = new Cell[Cell.getNProperCellTypes()];
protected boolean ignoreUI = false;
public ReadFluent()
{
for (int i = 0; i < stdCells.length; i++) {
......@@ -100,7 +106,10 @@ public class ReadFluent extends OutFieldVisualizationModule
new Parameter<>(CAS_FILE_PATH, ""),
new Parameter<>(DAT_FILE_PATHS, new String[0]),
new Parameter<>(SHOW, true),
new Parameter<>(SCALE, 1.0f)
new Parameter<>(SCALE, 1.0f),
new Parameter<>(CELL_TO_NODE, true),
new Parameter<>(DROP_CELL_DATA, true),
new Parameter<>(DROP_CONSTANT_DATA, true),
};
}
......@@ -131,13 +140,14 @@ public class ReadFluent extends OutFieldVisualizationModule
if (p.get(CAS_FILE_PATH) != null && !p.get(CAS_FILE_PATH).isEmpty()) {
this.setProgress(0.0f);
String datFilePath = null;
if(p.get(DAT_FILE_PATHS) != null && p.get(DAT_FILE_PATHS).length > 0) {
datFilePath = p.get(DAT_FILE_PATHS)[0];
}
FluentReader reader = new FluentReader(p.get(CAS_FILE_PATH), datFilePath);
nTasks = 3;
String casFilePath = p.get(CAS_FILE_PATH);
FluentReader reader = new FluentReader(casFilePath, datFilePath);
nTasks = 4;
iTask = 0;
reader.setFloatValueModificationListener(new FloatValueModificationListener()
{
......@@ -156,33 +166,65 @@ public class ReadFluent extends OutFieldVisualizationModule
this.setProgress(0.66f);
iTask = 2;
if (outIrregularField == null) {
return;
}
int n = outIrregularField.getNComponents();
for (int i = 0; i < outIrregularField.getNCellSets(); i++) {
n+=outIrregularField.getCellSet(i).getNComponents();
}
if(n == 0) {
UnsignedByteLargeArray dummy = new UnsignedByteLargeArray(outIrregularField.getNNodes(), true);
outIrregularField.addComponent(DataArray.create(dummy, 1, "dummy"));
}
if (outIrregularField != null) {
GeometricOrientation.recomputeOrientations(outIrregularField);
VectorComponentCombiner.combineVectors(outIrregularField);
if (parameters.get(CELL_TO_NODE)) {
IrregularField transientField = outIrregularField.cloneShallow();
convertCellDataToNodeData(parameters.get(DROP_CELL_DATA), outIrregularField, transientField);
outIrregularField = transientField;
}
if (parameters.get(DROP_CONSTANT_DATA)) {
for (int i = outIrregularField.getNComponents() - 1; i >= 0; i--) {
DataArray component = outIrregularField.getComponent(i);
if (component.getMinValue() == component.getMaxValue()) {
outIrregularField.removeComponent(i);
}
}
for (int c = 0; c < outIrregularField.getNCellSets(); c++) {
for (int i = outIrregularField.getCellSet(c).getNComponents() - 1; i >= 0; i--) {
DataArray component = outIrregularField.getCellSet(c).getComponent(i);
if (component.getMinValue() == component.getMaxValue()) {
outIrregularField.getCellSet(c).removeComponent(i);
}
}
}
}
if (outIrregularField.getNComponents() == 0) {
outIrregularField.addComponent(DataArray.createConstant(DataArrayType.FIELD_DATA_BYTE, outIrregularField.getNNodes(), 0, "dummy"));
}
FloatLargeArray coords = outIrregularField.getCurrentCoords();
for (CellSet cellSet : outIrregularField.getCellSets())
cellSet.generateDisplayData(coords);
}
}
this.setProgress(0.90f);
iTask = 3;
if(outIrregularField != null) {
computeUI.setFieldDescription(outIrregularField.description());
setOutputValue("outField", new VNIrregularField(outIrregularField));
outField = outIrregularField;
if (p.get(SHOW)) {
outField = outIrregularField;
prepareOutputGeometry();
irregularFieldGeometry.getFieldDisplayParams().getRenderingParams().setShadingMode(RenderingParams.FLAT_SHADED);
show();
}
else {
} else {
outField = null;
prepareOutputGeometry();
}
this.setProgress(1.0f);
} else {
computeUI.setFieldDescription("no data");
setOutputValue("outField", null);
outField = null;
prepareOutputGeometry();
}
this.setProgress(1.0f);
}
@Override
......@@ -200,7 +242,6 @@ public class ReadFluent extends OutFieldVisualizationModule
{
float ppt = 1.0f / (float) nTasks;
float p = (iTask + currentTaskProgress) * ppt;
//System.out.println("current task "+(iTask+1)+" of "+nTasks+" progress "+currentTaskProgress+" setting global progress to "+p);
setProgress(p);
}
......
......@@ -47,11 +47,11 @@ import pl.edu.icm.visnow.engine.core.ParameterName;
public class ReadFluentShared
{
static final ParameterName<String> CAS_FILE_PATH = new ParameterName("CAS file path");
static final ParameterName<String[]> DAT_FILE_PATHS = new ParameterName("DAT file paths");
static final ParameterName<Boolean> SHOW = new ParameterName("Show");
static final ParameterName<Float> SCALE = new ParameterName("Scale");
static final ParameterName<Boolean> CELL_TO_NODE = new ParameterName("Cell to node");
static final ParameterName<Boolean> DROP_CELL_DATA = new ParameterName("Drop cell data");
static final ParameterName<Boolean> DROP_CONSTANT_DATA = new ParameterName("Drop constant data");
}
......@@ -28,7 +28,7 @@
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,-12,0,0,0,-48"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,-12,0,0,1,81"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
......@@ -54,7 +54,7 @@
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="3" gridWidth="3" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="13" weightX="1.0" weightY="0.0"/>
<GridBagConstraints gridX="0" gridY="2" gridWidth="3" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="13" weightX="1.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
......@@ -68,24 +68,10 @@
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JCheckBox" name="displayBox">
<Properties>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" value="display"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="displayBoxActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="7" gridWidth="3" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="9" gridWidth="3" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/>
<GridBagConstraints gridX="0" gridY="8" gridWidth="3" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/>
</Constraint>
</Constraints>
......@@ -96,8 +82,12 @@
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Dialog" size="12" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="null"/>
<Property name="verticalAlignment" type="int" value="1"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>