Commit 6685b649 authored by Piotr Wendykier's avatar Piotr Wendykier

Merge develop into feature/InstallBuilder2

parents 83046414 ddf35735
This diff is collapsed.
......@@ -321,9 +321,9 @@ public final class TextureVolumeRenderer extends OpenBranchGroup
//create normal vectors for flipping planes
//cross product / norm
float[] cross12 = VectorMath.vectorNormalize(VectorMath.crossProduct(sourceAffine[0], sourceAffine[1], false), false);
float[] cross23 = VectorMath.vectorNormalize(VectorMath.crossProduct(sourceAffine[1], sourceAffine[2], false), false);
float[] cross31 = VectorMath.vectorNormalize(VectorMath.crossProduct(sourceAffine[2], sourceAffine[0], false), false);
float[] cross12 = VectorMath.vectorNormalize(VectorMath.crossProduct(sourceAffine[0], sourceAffine[1]), false);
float[] cross23 = VectorMath.vectorNormalize(VectorMath.crossProduct(sourceAffine[1], sourceAffine[2]), false);
float[] cross31 = VectorMath.vectorNormalize(VectorMath.crossProduct(sourceAffine[2], sourceAffine[0]), false);
float[] dirs = new float[3];
Arrays.fill(dirs, 0);
for (int j = 0; j < 3; j++) {
......
......@@ -172,7 +172,7 @@ public class AddMargins extends OutFieldVisualizationModule
}
if (dims.length <= 2 && outDims.length == 3) {
outAffine[2] = VectorMath.crossProduct(outAffine[0], outAffine[1], false);
outAffine[2] = VectorMath.crossProduct(outAffine[0], outAffine[1]);
outAffine[2] = VectorMath.vectorMultiplyScalar(VectorMath.vectorNormalize(outAffine[2], false), VectorMath.vectorNorm(outAffine[0]), false);
}
......
......@@ -137,7 +137,7 @@ public class GaussianFilter extends OutFieldVisualizationModule
int[] dims = inField.getDims();
radius = (int) Math.ceil(3 * p.get(SIGMA));
radius = Math.min(VectorMath.vectorMin(dims) - 1, radius * 2) / 2;
radius = Math.min(VectorMath.vectorElementsMin(dims) - 1, radius * 2) / 2;
outRegularField = new RegularField(dims);
outRegularField.setAffine(inField.getAffine());
if (inField.getCoords() != null)
......@@ -145,17 +145,17 @@ public class GaussianFilter extends OutFieldVisualizationModule
kernel = new float[2 * radius + 1];
float r = 1.0f / (2.0f * p.get(SIGMA) * p.get(SIGMA));
for (int i = 0; i <= radius; i++) kernel[radius + i] = kernel[radius - i] = (float) exp(-i * i * r);
VectorMath.vectorMultiplyScalar(kernel, 1.0f / VectorMath.vectorSum(kernel), false);
VectorMath.vectorMultiplyScalar(kernel, 1.0f / VectorMath.vectorElementsSum(kernel), false);
kernelDistribution = VectorMath.vectorCumulativeSum(kernel, false);
if (p.get(BAND_PASS)) {
radius1 = Math.max(1, (int) (3 * p.get(SIGMA1)));
radius1 = Math.min(VectorMath.vectorMin(dims) - 1, radius1 * 2) / 2;
radius1 = Math.min(VectorMath.vectorElementsMin(dims) - 1, radius1 * 2) / 2;
kernel1 = new float[2 * radius1 + 1];
r = 1.0f / (2.0f * p.get(SIGMA1) * p.get(SIGMA1));
for (int i = 0; i <= radius1; i++)
kernel1[radius1 + i] = kernel1[radius1 - i] = (float) exp(-i * i * r);
VectorMath.vectorMultiplyScalar(kernel1, 1.0f / VectorMath.vectorSum(kernel1), false);
VectorMath.vectorMultiplyScalar(kernel1, 1.0f / VectorMath.vectorElementsSum(kernel1), false);
kernel1Distribution = VectorMath.vectorCumulativeSum(kernel1, false);
}
......
......@@ -228,7 +228,7 @@ public class Graph3D extends OutFieldVisualizationModule
//find which axis is "3D"?
float[] v0 = inField.getAffine()[0];
float[] v1 = inField.getAffine()[1];
float[] v2 = VectorMath.crossProduct(v0, v1, false);
float[] v2 = VectorMath.crossProduct(v0, v1);
float ax = VectorMath.vectorAngle(v2, new float[]{1.0f, 0.0f, 0.0f}, false);
if (ax >= Math.PI / 2.0) {
ax = (float) (ax - Math.PI);
......
......@@ -45,8 +45,6 @@ import pl.edu.icm.visnow.engine.core.ParameterChangeListener;
import pl.edu.icm.visnow.engine.core.Parameters;
import pl.edu.icm.visnow.engine.core.ProgressAgent;
import static pl.edu.icm.visnow.lib.basic.readers.ReadCSV.ReadCSVShared.*;
import pl.edu.icm.visnow.lib.grid.gridftp.GridFTPException;
import pl.edu.icm.visnow.lib.grid.gridftp.GridFTPLocalUtils;
import pl.edu.icm.visnow.lib.templates.visualization.modules.OutFieldVisualizationModule;
import pl.edu.icm.visnow.lib.types.VNRegularField;
import pl.edu.icm.visnow.lib.utils.SwingInstancer;
......@@ -60,6 +58,7 @@ import pl.edu.icm.visnow.system.utils.usermessage.Level;
*/
public class ReadCSV extends OutFieldVisualizationModule
{
private static final Logger LOGGER = Logger.getLogger(ReadCSV.class);
public static OutputEgg[] outputEggs = null;
private ReadCSVGUI computeUI = null;
......@@ -109,25 +108,25 @@ public class ReadCSV extends OutFieldVisualizationModule
{
Parameters p = parameters.getReadOnlyClone();
notifyGUIs(p, isFromVNA(), false);
if (p.get(FILENAME).isEmpty()) outRegularField = null;
else {
ProgressAgent progressAgent = getProgressAgent(140); //20 for download from gsiftp, 100 for read, 20 for geometry
File f;
try {
f = GridFTPLocalUtils.getFileOrLocalGSIFTPCopy(p.get(ReadCSVShared.FILENAME), progressAgent.getSubAgent(20));
outRegularField = CsvFieldReader.readCsvField1D(f, p.get(FIELD_SEPARATOR), p.get(HAS_HEADER_LINE));
} catch (GridFTPException ex) {
LOGGER.error("Error while reading file " + p.get(ReadCSVShared.FILENAME), ex);
VisNow.get().userMessageSend(this, "Error reading file: " + p.get(ReadCSVShared.FILENAME), "See log for details", Level.ERROR);
}
ProgressAgent progressAgent = getProgressAgent(120); //100 for read, 20 for geometry
if (p.get(FILENAME).isEmpty()) {
outRegularField = null;
} else {
File f = new File(p.get(ReadCSVShared.FILENAME));
outRegularField = CsvFieldReader.readCsvField1D(f, p.get(FIELD_SEPARATOR), p.get(HAS_HEADER_LINE));
}
outField = outRegularField;
if (outRegularField == null) {
setOutputValue("outField", null);
}
else {
setOutputValue("outField", new VNRegularField(outRegularField));
}
progressAgent.setProgressStep(100);
prepareOutputGeometry();
show();
if (outRegularField == null) setOutputValue("outField", null);
else setOutputValue("outField", new VNRegularField(outRegularField));
}
@Override
......
......@@ -46,7 +46,6 @@ import pl.edu.icm.visnow.engine.core.Parameters;
import pl.edu.icm.visnow.gui.swingwrappers.TextField;
import static pl.edu.icm.visnow.lib.basic.readers.ReadEnSightGoldCase.ReadEnSightGoldCaseShared.*;
import pl.edu.icm.visnow.lib.gui.Browser;
import pl.edu.icm.visnow.lib.gui.grid.GridFrame;
import pl.edu.icm.visnow.lib.utils.io.InputSource;
import pl.edu.icm.visnow.system.main.VisNow;
......@@ -58,7 +57,6 @@ public class GUI extends javax.swing.JPanel
{
private JFileChooser dataFileChooser = new JFileChooser();
private GridFrame gridFrame = new GridFrame();
private FileNameExtensionFilter dataFilter;
private Parameters parameters;
private String lastPath = null;
......@@ -82,17 +80,6 @@ public class GUI extends javax.swing.JPanel
parameters.set(INPUT_SOURCE, InputSource.URL, FILENAME, browser.getCurrentURL());
}
});
gridFrame.setVisible(false);
gridFrame.setFileExtensions(extensions);
gridFrame.setSingleFile(true);
gridFrame.addChangeListener(new ChangeListener()
{
public void stateChanged(ChangeEvent e)
{
parameters.set(INPUT_SOURCE, InputSource.GRID, FILENAME, VisNow.getTmpDirPath() + File.separator + gridFrame.getTransferredFileNames()[0]);
}
});
}
public GUI(String title, String dataFileDesc, String[] extensions)
......@@ -125,17 +112,6 @@ public class GUI extends javax.swing.JPanel
parameters.set(INPUT_SOURCE, InputSource.URL, FILENAME, browser.getCurrentURL());
}
});
gridFrame.setVisible(false);
gridFrame.setFileExtensions(extensions);
gridFrame.setSingleFile(true);
gridFrame.addChangeListener(new ChangeListener()
{
public void stateChanged(ChangeEvent e)
{
parameters.set(INPUT_SOURCE, InputSource.GRID, FILENAME, VisNow.getTmpDirPath() + File.separator + gridFrame.getTransferredFileNames()[0]);
}
});
}
/**
......
......@@ -58,8 +58,6 @@ import pl.edu.icm.visnow.engine.core.ParameterChangeListener;
import pl.edu.icm.visnow.engine.core.Parameters;
import pl.edu.icm.visnow.engine.core.ProgressAgent;
import static pl.edu.icm.visnow.lib.basic.readers.ReadSTL.ReadSTLShared.PATH;
import pl.edu.icm.visnow.lib.grid.gridftp.GridFTPException;
import pl.edu.icm.visnow.lib.grid.gridftp.GridFTPLocalUtils;
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;
......@@ -104,16 +102,17 @@ public class ReadSTL extends OutFieldVisualizationModule {
notifyGUIs(parametersClone, false, false);
String path = parametersClone.get(PATH);
ProgressAgent progressAgent = getProgressAgent(120); //100 for read, 20 for geometry
if (path.isEmpty()) {
outIrregularField = null;
} else {
try {
ProgressAgent progressAgent = getProgressAgent(140); //20 for download from gsiftp, 100 for read, 20 for geometry
File f = GridFTPLocalUtils.getFileOrLocalGSIFTPCopy(path, progressAgent.getSubAgent(20));
File f = new File(path);
outIrregularField = readSTL(f, progressAgent);
if (outIrregularField != null)
VisNow.get().userMessageSend(this, "Successfully read: " + path, "", Level.INFO);
} catch (IOException | GridFTPException ex) {
} catch (IOException ex) {
outIrregularField = null;
LOGGER.error("", ex);
VisNow.get().userMessageSend(this, "Error reading file: " + path, "See log for details", Level.ERROR);
......@@ -126,6 +125,7 @@ public class ReadSTL extends OutFieldVisualizationModule {
} else {
setOutputValue("outField", null);
}
progressAgent.setProgressStep(100);
prepareOutputGeometry();
show();
}
......@@ -133,7 +133,7 @@ public class ReadSTL extends OutFieldVisualizationModule {
@Override
protected Parameter[] createDefaultParameters() {
return new Parameter[]{
new Parameter<>(PATH, new String()),};
new Parameter<>(PATH, new String())};
}
@Override
......@@ -177,7 +177,7 @@ public class ReadSTL extends OutFieldVisualizationModule {
int[][] cellsIndices = new int[nObjects][];
HashMap<Node, Integer> vertexMap = new HashMap<Node, Integer>();
int progressTotalSteps = VectorMath.vectorSum(nFacets);
int progressTotalSteps = VectorMath.vectorElementsSum(nFacets);
int progressStep = 0;
int progressMod = progressTotalSteps / 100;
......
......@@ -179,19 +179,6 @@
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JRadioButton" name="gridButton">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroup1"/>
</Property>
<Property name="text" type="java.lang.String" value="grid"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="2" gridY="1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JCheckBox" name="materialAsSetsCheckBox">
<Properties>
<Property name="text" type="java.lang.String" value="materials as cell sets"/>
......
......@@ -44,7 +44,6 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.filechooser.FileNameExtensionFilter;
import pl.edu.icm.visnow.lib.gui.Browser;
import pl.edu.icm.visnow.lib.gui.grid.GridFrame;
import pl.edu.icm.visnow.lib.utils.io.InputSource;
import pl.edu.icm.visnow.system.main.VisNow;
......@@ -56,7 +55,6 @@ public class GUI extends javax.swing.JPanel
{
private JFileChooser dataFileChooser = new JFileChooser();
private GridFrame gridFrame = new GridFrame();
private FileNameExtensionFilter dataFilter;
private Params params = new Params();
private String lastPath = null;
......@@ -85,22 +83,6 @@ public class GUI extends javax.swing.JPanel
params.fireStateChanged();
}
});
gridFrame.setVisible(false);
gridFrame.setFileExtensions(dataFilter.getExtensions());
gridFrame.setSingleFile(true);
gridFrame.addChangeListener(new ChangeListener()
{
@Override
public void stateChanged(ChangeEvent e)
{
params.setSource(InputSource.GRID);
params.setFileName(VisNow.getTmpDirPath() + File.separator + gridFrame.getTransferredFileNames()[0]);
fileNameField.setText(params.getFileName());
params.setMaterialsAsSets(materialAsSetsCheckBox.isSelected());
params.fireStateChanged();
}
});
}
/**
......@@ -123,7 +105,6 @@ public class GUI extends javax.swing.JPanel
fieldDescription = new javax.swing.JLabel();
fileButton = new javax.swing.JRadioButton();
urlButton = new javax.swing.JRadioButton();
gridButton = new javax.swing.JRadioButton();
materialAsSetsCheckBox = new javax.swing.JCheckBox();
setBorder(javax.swing.BorderFactory.createTitledBorder(""));
......@@ -206,7 +187,7 @@ public class GUI extends javax.swing.JPanel
add(displayBox, gridBagConstraints);
fieldDescription.setFont(new java.awt.Font("Dialog", 0, 12)); // NOI18N
fieldDescription.setText(null);
fieldDescription.setText("null");
fieldDescription.setVerticalAlignment(javax.swing.SwingConstants.TOP);
fieldDescription.setMaximumSize(new java.awt.Dimension(700, 250));
fieldDescription.setMinimumSize(new java.awt.Dimension(400, 170));
......@@ -241,15 +222,6 @@ public class GUI extends javax.swing.JPanel
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
add(urlButton, gridBagConstraints);
buttonGroup1.add(gridButton);
gridButton.setText("grid");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
add(gridButton, gridBagConstraints);
materialAsSetsCheckBox.setText("materials as cell sets");
materialAsSetsCheckBox.setEnabled(false);
gridBagConstraints = new java.awt.GridBagConstraints();
......@@ -283,9 +255,7 @@ public class GUI extends javax.swing.JPanel
}
} else if (urlButton.isSelected()) {
browser.setVisible(true);
} else if (gridButton.isSelected()) {
gridFrame.setVisible(true);
}
}
}//GEN-LAST:event_selectButtonActionPerformed
private void rereadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rereadButtonActionPerformed
......@@ -313,14 +283,12 @@ public class GUI extends javax.swing.JPanel
private javax.swing.JLabel fieldDescription;
private javax.swing.JRadioButton fileButton;
private javax.swing.JTextField fileNameField;
private javax.swing.JRadioButton gridButton;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JCheckBox materialAsSetsCheckBox;
private javax.swing.JLabel moduleLabel;
private javax.swing.JButton rereadButton;
private javax.swing.JButton selectButton;
private javax.swing.JRadioButton urlButton;
// End of variables declaration//GEN-END:variables
/**
* @param params the params to set
......
......@@ -128,19 +128,6 @@
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JRadioButton" name="gridButton">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroup1"/>
</Property>
<Property name="text" type="java.lang.String" value="grid"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="2" gridY="1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="1.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JCheckBox" name="materialAsSetsCheckBox">
<Properties>
<Property name="text" type="java.lang.String" value="materials as cell sets"/>
......
......@@ -46,7 +46,6 @@ import pl.edu.icm.visnow.engine.core.Parameters;
import pl.edu.icm.visnow.gui.swingwrappers.TextField;
import static pl.edu.icm.visnow.lib.basic.readers.ReadUCD.ReadUCDShared.*;
import pl.edu.icm.visnow.lib.gui.Browser;
import pl.edu.icm.visnow.lib.gui.grid.GridFrame;
import pl.edu.icm.visnow.lib.utils.io.InputSource;
import pl.edu.icm.visnow.system.main.VisNow;
......@@ -58,7 +57,6 @@ public class GUI extends javax.swing.JPanel
{
private JFileChooser dataFileChooser = new JFileChooser();
private GridFrame gridFrame = new GridFrame();
private FileNameExtensionFilter dataFilter;
private Parameters parameters;
private String lastPath = null;
......@@ -83,18 +81,6 @@ public class GUI extends javax.swing.JPanel
parameters.set(INPUT_SOURCE, InputSource.URL, FILENAME, browser.getCurrentURL(), MATERIAL_AS_SETS, materialAsSetsCheckBox.isSelected());
}
});
gridFrame.setVisible(false);
gridFrame.setFileExtensions(dataFilter.getExtensions());
gridFrame.setSingleFile(true);
gridFrame.addChangeListener(new ChangeListener()
{
@Override
public void stateChanged(ChangeEvent e)
{
parameters.set(INPUT_SOURCE, InputSource.GRID, FILENAME, VisNow.getTmpDirPath() + File.separator + gridFrame.getTransferredFileNames()[0], MATERIAL_AS_SETS, materialAsSetsCheckBox.isSelected());
}
});
}
/**
......@@ -114,7 +100,6 @@ public class GUI extends javax.swing.JPanel
fieldDescription = new javax.swing.JLabel();
fileButton = new javax.swing.JRadioButton();
urlButton = new javax.swing.JRadioButton();
gridButton = new javax.swing.JRadioButton();
materialAsSetsCheckBox = new javax.swing.JCheckBox();
indicesBox = new javax.swing.JCheckBox();
fileNameField = new pl.edu.icm.visnow.gui.swingwrappers.TextField();
......@@ -193,16 +178,6 @@ public class GUI extends javax.swing.JPanel
gridBagConstraints.weightx = 1.0;
add(urlButton, gridBagConstraints);
buttonGroup1.add(gridButton);
gridButton.setText("grid");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.weightx = 1.0;
add(gridButton, gridBagConstraints);
materialAsSetsCheckBox.setText("materials as cell sets");
materialAsSetsCheckBox.setEnabled(false);
gridBagConstraints = new java.awt.GridBagConstraints();
......@@ -229,12 +204,12 @@ public class GUI extends javax.swing.JPanel
fileNameField.addUserActionListener(new pl.edu.icm.visnow.gui.swingwrappers.UserActionListener()
{
public void userAction(pl.edu.icm.visnow.gui.swingwrappers.UserEvent evt)
public void userChangeAction(pl.edu.icm.visnow.gui.swingwrappers.UserEvent evt)
{
fileNameFieldUserAction(evt);
}
public void userChangeAction(pl.edu.icm.visnow.gui.swingwrappers.UserEvent evt)
public void userAction(pl.edu.icm.visnow.gui.swingwrappers.UserEvent evt)
{
fileNameFieldUserAction(evt);
}
});
fileNameField.addFocusListener(new java.awt.event.FocusAdapter()
......@@ -304,8 +279,6 @@ public class GUI extends javax.swing.JPanel
}
} else if (urlButton.isSelected()) {
browser.setVisible(true);
} else if (gridButton.isSelected()) {
gridFrame.setVisible(true);
}
}//GEN-LAST:event_selectButtonActionPerformed
......@@ -350,7 +323,6 @@ public class GUI extends javax.swing.JPanel
private javax.swing.JLabel fieldDescription;
private javax.swing.JRadioButton fileButton;
private pl.edu.icm.visnow.gui.swingwrappers.TextField fileNameField;
private javax.swing.JRadioButton gridButton;
private javax.swing.JCheckBox indicesBox;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JCheckBox materialAsSetsCheckBox;
......@@ -384,6 +356,5 @@ public class GUI extends javax.swing.JPanel
fileButton.setSelected(input_type == 0);
urlButton.setSelected(input_type == 1);
gridButton.setSelected(input_type == 2);
}
}
......@@ -38,7 +38,6 @@ package pl.edu.icm.visnow.lib.basic.readers.ReadVTK;
import java.io.File;
import java.nio.ByteOrder;
import java.util.logging.Logger;
import pl.edu.icm.jscic.IrregularField;
import pl.edu.icm.jscic.RegularField;
import pl.edu.icm.visnow.engine.core.OutputEgg;
......@@ -47,8 +46,6 @@ import pl.edu.icm.visnow.engine.core.ParameterChangeListener;
import pl.edu.icm.visnow.engine.core.Parameters;
import pl.edu.icm.visnow.engine.core.ProgressAgent;
import static pl.edu.icm.visnow.lib.basic.readers.ReadVTK.ReadVTKShared.*;
import pl.edu.icm.visnow.lib.grid.gridftp.GridFTPException;
import pl.edu.icm.visnow.lib.grid.gridftp.GridFTPLocalUtils;
import pl.edu.icm.visnow.lib.templates.visualization.modules.OutFieldVisualizationModule;
import pl.edu.icm.visnow.lib.types.VNIrregularField;
import pl.edu.icm.visnow.lib.types.VNRegularField;
......@@ -63,6 +60,7 @@ import pl.edu.icm.visnow.system.utils.usermessage.Level;
*/
public class ReadVTK extends OutFieldVisualizationModule
{
private static final org.apache.log4j.Logger LOGGER = org.apache.log4j.Logger.getLogger(ReadVTK.class);
private GUI computeUI = null;
......@@ -128,43 +126,34 @@ public class ReadVTK extends OutFieldVisualizationModule
setOutputValue("outRegularField", null);
setOutputValue("outIrregularField", null);
} else {
ProgressAgent progressAgent = getProgressAgent(140); //20 for download from gsiftp, 100 for read, 20 for geometry
ProgressAgent progressAgent = getProgressAgent(120); //100 for read, 20 for geometry
File f;
try {
f = GridFTPLocalUtils.getFileOrLocalGSIFTPCopy(p.get(FILENAME), progressAgent.getSubAgent(20));
outField = core.readVTK(f, p.get(BIG_ENDIAN) == true ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN);
if (outField == null) {
VisNow.get().userMessageSend(this, "Error loading file.", "Cannot read file " + p.get(FILENAME), Level.ERROR);
}
if (outField != null && outField instanceof RegularField) {
outRegularField = (RegularField) outField;
outIrregularField = null;
setOutputValue("outRegularField", new VNRegularField(outRegularField));
setOutputValue("outIrregularField", null);
VisNow.get().userMessageSend(this, "<html>File successfully loaded", outRegularField.toMultilineString(), Level.INFO);
} else if (outField != null && outField instanceof IrregularField) {
outRegularField = null;
outIrregularField = (IrregularField) outField;
setOutputValue("outRegularField", null);
setOutputValue("outIrregularField", new VNIrregularField(outIrregularField));
VisNow.get().userMessageSend(this, "<html>File successfully loaded.", outIrregularField.toMultilineString(), Level.INFO);
} else {
outRegularField = null;
outIrregularField = null;
setOutputValue("outRegularField", null);
setOutputValue("outIrregularField", null);
}
} catch (GridFTPException ex) {
f = new File(p.get(FILENAME));
outField = core.readVTK(f, p.get(BIG_ENDIAN) == true ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN);
if (outField == null) {
VisNow.get().userMessageSend(this, "Error loading file.", "Cannot read file " + p.get(FILENAME), Level.ERROR);
}
if (outField != null && outField instanceof RegularField) {
outRegularField = (RegularField) outField;
outIrregularField = null;
setOutputValue("outRegularField", new VNRegularField(outRegularField));
setOutputValue("outIrregularField", null);
VisNow.get().userMessageSend(this, "<html>File successfully loaded", outRegularField.toMultilineString(), Level.INFO);
} else if (outField != null && outField instanceof IrregularField) {
outRegularField = null;
outIrregularField = (IrregularField) outField;
setOutputValue("outRegularField", null);
setOutputValue("outIrregularField", new VNIrregularField(outIrregularField));
VisNow.get().userMessageSend(this, "<html>File successfully loaded.", outIrregularField.toMultilineString(), Level.INFO);
} else {
outRegularField = null;
outIrregularField = null;
setOutputValue("outRegularField", null);
setOutputValue("outIrregularField", null);
VisNow.get().userMessageSend(this, "Error loading file " + p.get(FILENAME), "See log for details", Level.ERROR);
LOGGER.error("Error while loading file " + p.get(FILENAME), ex);
}
progressAgent.setProgressStep(120);
progressAgent.setProgressStep(100);
prepareOutputGeometry();
show();
}
......
......@@ -64,8 +64,6 @@ import pl.edu.icm.visnow.engine.core.ParameterChangeListener;
import pl.edu.icm.visnow.engine.core.Parameters;
import pl.edu.icm.visnow.engine.core.ProgressAgent;
import static pl.edu.icm.visnow.lib.basic.readers.material_science.ReadVASP.ReadVASPShared.*;
import pl.edu.icm.visnow.lib.grid.gridftp.GridFTPException;
import pl.edu.icm.visnow.lib.grid.gridftp.GridFTPLocalUtils;
import pl.edu.icm.visnow.lib.templates.visualization.modules.OutFieldVisualizationModule;
import pl.edu.icm.visnow.lib.types.VNIrregularField;
import pl.edu.icm.visnow.lib.types.VNRegularField;
......@@ -80,6 +78,7 @@ import pl.edu.icm.visnow.system.utils.usermessage.Level;
*/
public class ReadVASP extends OutFieldVisualizationModule
{
private static final org.apache.log4j.Logger LOGGER = org.apache.log4j.Logger.getLogger(ReadVASP.class);
protected GUI computeUI = null;
protected boolean fromGUI = false;
......@@ -104,7 +103,7 @@ public class ReadVASP extends OutFieldVisualizationModule
startAction();
}
});
SwingInstancer.swingRunAndWait(new Runnable()
{
@Override
......@@ -117,7 +116,7 @@ public class ReadVASP extends OutFieldVisualizationModule
}
});
}
@Override
protected Parameter[] createDefaultParameters()
{
......@@ -206,7 +205,7 @@ public class ReadVASP extends OutFieldVisualizationModule
for (int i = 0, k = 0; i < nAtomsOfType.length; i++)
for (int j = 0; j < nAtomsOfType[i]; j++, k++)
typesInCell[k] = AtomGeometryTemplates.getTemplateIndex(atomNames[i]);
FloatLargeArray coords = new FloatLargeArray(3 * (long)gMult * nAtoms, false);
FloatLargeArray coords = new FloatLargeArray(3 * (long) gMult * nAtoms, false);
int[] types = new int[gMult * nAtoms];
VisualAtomTemplate[] atoms = new VisualAtomTemplate[gMult * nAtoms];
for (int i = 0, n = 0, na = 0; i < mult[2]; i++)
......@@ -328,7 +327,7 @@ public class ReadVASP extends OutFieldVisualizationModule
}
return null;
}
@Override
protected void notifySwingGUIs(final pl.edu.icm.visnow.engine.core.ParameterProxy clonedParameterProxy, boolean resetFully, boolean setRunButtonPending)
{
......@@ -340,21 +339,17 @@ public class ReadVASP extends OutFieldVisualizationModule
{
Parameters p = parameters.getReadOnlyClone();
notifyGUIs(p, isFromVNA(), false);
if (p.get(FILENAME) == null || p.get(FILENAME).isEmpty())
return;
ProgressAgent progressAgent = getProgressAgent(140); //20 for download from gsiftp, 100 for read, 20 for geometry
String userFileName = p.get(FILENAME);
try {
if (!GridFTPLocalUtils.isGSIUri(userFileName));
{
File potCarFile = new File(new File(userFileName).getParentFile().getCanonicalPath() + File.separator + "POTCAR");
if (potCarFile.canRead())
templates = getAtoms(potCarFile);
}
File densityFile = GridFTPLocalUtils.getFileOrLocalGSIFTPCopy(userFileName, progressAgent.getSubAgent(20));
File potCarFile = new File(new File(userFileName).getParentFile().getCanonicalPath() + File.separator + "POTCAR");
if (potCarFile.canRead())
templates = getAtoms(potCarFile);
File densityFile = new File(userFileName);
readVASP(densityFile.getAbsolutePath(), p);
} catch (GridFTPException | IOException ex) {
} catch (IOException ex) {
LOGGER.error("Error while reading file " + userFileName, ex);
VisNow.get().userMessageSend(this, "Error reading file: " + userFileName, "See log for details", Level.ERROR);
}
......
......@@ -148,7 +148,7 @@ public class Plane3D
public void setPlaneParams(float[] p, float[] v, float[][] b)
{
float[] vb = VectorMath.crossProduct(b[0], b[1], false);
float[] vb = VectorMath.crossProduct(b[0], b[1]);
for (int i = 0; i < 3; i++) {
vect[i] = vb[i];
......