use of cbit.vcell.solvers.mb.MovingBoundarySolverOptions.RedistributionMode in project vcell by virtualcell.
the class XmlReader method getMovingBoundarySolverOptions.
private MovingBoundarySolverOptions getMovingBoundarySolverOptions(SolverTaskDescription solverTaskDesc, Element mbElement) {
double frontToNodeRatio = parseDoubleWithDefault(mbElement, XMLTags.FrontToNodeRatioTag, MovingBoundarySolverOptions.DEFAULT_FRONT_TO_NODE_RATIO);
int redistributionFrequency = parseIntWithDefault(mbElement, XMLTags.RedistributionFrequencyTag, MovingBoundarySolverOptions.DEFAULT_REDISTRIBUTION_FREQUENCY);
RedistributionMode redistributionMode = RedistributionMode.FULL_REDIST;
Element child = mbElement.getChild(XMLTags.RedistributionModeTag, vcNamespace);
if (child != null) {
String text = child.getText();
redistributionMode = RedistributionMode.valueOf(text);
}
RedistributionVersion redistributionVersion = RedistributionVersion.EQUI_BOND_REDISTRIBUTE;
child = mbElement.getChild(XMLTags.RedistributionVersionTag, vcNamespace);
if (child != null) {
String text = child.getText();
redistributionVersion = RedistributionVersion.valueOf(text);
}
ExtrapolationMethod extrapolationMethod = ExtrapolationMethod.NEAREST_NEIGHBOR;
child = mbElement.getChild(XMLTags.ExtrapolationMethodTag, vcNamespace);
if (child != null) {
String text = child.getText();
extrapolationMethod = ExtrapolationMethod.valueOf(text);
}
MovingBoundarySolverOptions mb = new MovingBoundarySolverOptions(frontToNodeRatio, redistributionMode, redistributionVersion, redistributionFrequency, extrapolationMethod);
return mb;
}
use of cbit.vcell.solvers.mb.MovingBoundarySolverOptions.RedistributionMode in project vcell by virtualcell.
the class MovingBoundarySolverOptionsPanel method getFrontTrackingPanel.
private JPanel getFrontTrackingPanel() {
JPanel panel = new JPanel(new GridBagLayout());
panel.setBorder(BorderFactory.createTitledBorder(GuiConstants.TAB_PANEL_BORDER, "Front Tracking"));
int gridy = 0;
GridBagConstraints gbc = new java.awt.GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = gridy;
gbc.insets = new java.awt.Insets(4, 4, 4, 4);
gbc.anchor = GridBagConstraints.LINE_END;
panel.add(new JLabel("Front To Volume Nodes Ratio"), gbc);
textFieldFrontToNodeRatio = new JFormattedTextField(DecimalFormat.getInstance());
gbc = new java.awt.GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = gridy;
gbc.fill = java.awt.GridBagConstraints.HORIZONTAL;
gbc.weightx = 1.0;
gbc.insets = new java.awt.Insets(4, 4, 4, 4);
panel.add(textFieldFrontToNodeRatio, gbc);
++gridy;
gbc = new java.awt.GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = gridy;
gbc.insets = new java.awt.Insets(4, 4, 4, 4);
gbc.anchor = GridBagConstraints.LINE_END;
panel.add(new JLabel("Front Redistribution Method"), gbc);
gbc = new java.awt.GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = gridy;
gbc.fill = java.awt.GridBagConstraints.HORIZONTAL;
gbc.weightx = 1.0;
gbc.insets = new java.awt.Insets(4, 4, 4, 4);
panel.add(comboBoxRedistMode, gbc);
++gridy;
gbc = new java.awt.GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = gridy;
gbc.insets = new java.awt.Insets(4, 4, 4, 4);
gbc.anchor = GridBagConstraints.LINE_END;
panel.add(new JLabel("Full Redistribution Mode"), gbc);
gbc = new java.awt.GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = gridy;
gbc.fill = java.awt.GridBagConstraints.HORIZONTAL;
gbc.weightx = 1.0;
gbc.insets = new java.awt.Insets(4, 4, 4, 4);
panel.add(comboBoxRedistVersion, gbc);
++gridy;
gbc = new java.awt.GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = gridy;
gbc.insets = new java.awt.Insets(4, 4, 4, 4);
gbc.anchor = GridBagConstraints.LINE_END;
panel.add(new JLabel("Redistribution Frequency"), gbc);
NumberFormatter integerFormatter = new NumberFormatter(NumberFormat.getInstance());
integerFormatter.setValueClass(Integer.class);
integerFormatter.setMinimum(1);
integerFormatter.setMaximum(Integer.MAX_VALUE);
textFieldRedistributionFrequency = new JFormattedTextField(integerFormatter);
gbc = new java.awt.GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = gridy;
gbc.fill = java.awt.GridBagConstraints.HORIZONTAL;
gbc.weightx = 1.0;
gbc.insets = new java.awt.Insets(4, 4, 4, 4);
textFieldRedistributionFrequency.setToolTipText("integer only");
panel.add(textFieldRedistributionFrequency, gbc);
comboBoxRedistMode.setRenderer(new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
// TODO Auto-generated method stub
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (c instanceof JLabel) {
JLabel lbl = (JLabel) c;
lbl.setText(((RedistributionMode) value).getLabel());
}
return c;
}
});
comboBoxRedistVersion.setRenderer(new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
// TODO Auto-generated method stub
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (c instanceof JLabel) {
JLabel lbl = (JLabel) c;
lbl.setText(((RedistributionVersion) value).getLabel());
}
return c;
}
});
comboBoxExtrapolationMethod.setRenderer(new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
// TODO Auto-generated method stub
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (c instanceof JLabel) {
JLabel lbl = (JLabel) c;
lbl.setText(((ExtrapolationMethod) value).getLabel());
}
return c;
}
});
return panel;
}
use of cbit.vcell.solvers.mb.MovingBoundarySolverOptions.RedistributionMode in project vcell by virtualcell.
the class MovingBoundarySolverOptionsPanel method updateDisplay.
private void updateDisplay() {
if (solverTaskDescription != null && solverTaskDescription.getMovingBoundarySolverOptions() != null) {
setVisible(true);
textFieldFrontToNodeRatio.setValue(solverTaskDescription.getMovingBoundarySolverOptions().getFrontToNodeRatio());
RedistributionMode redistributionMode = solverTaskDescription.getMovingBoundarySolverOptions().getRedistributionMode();
comboBoxRedistMode.setSelectedItem(redistributionMode);
comboBoxRedistVersion.setSelectedItem(solverTaskDescription.getMovingBoundarySolverOptions().getRedistributionVersion());
comboBoxExtrapolationMethod.setSelectedItem(solverTaskDescription.getMovingBoundarySolverOptions().getExtrapolationMethod());
if (redistributionMode == RedistributionMode.NO_REDIST) {
textFieldRedistributionFrequency.setEnabled(false);
} else {
textFieldRedistributionFrequency.setValue(solverTaskDescription.getMovingBoundarySolverOptions().getRedistributionFrequency());
}
} else {
setVisible(false);
}
}
Aggregations