Search in sources :

Example 1 with RedistributionMode

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;
}
Also used : RedistributionMode(cbit.vcell.solvers.mb.MovingBoundarySolverOptions.RedistributionMode) MovingBoundarySolverOptions(cbit.vcell.solvers.mb.MovingBoundarySolverOptions) RedistributionVersion(cbit.vcell.solvers.mb.MovingBoundarySolverOptions.RedistributionVersion) Element(org.jdom.Element) ExtrapolationMethod(cbit.vcell.solvers.mb.MovingBoundarySolverOptions.ExtrapolationMethod)

Example 2 with RedistributionMode

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;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) RedistributionMode(cbit.vcell.solvers.mb.MovingBoundarySolverOptions.RedistributionMode) GridBagLayout(java.awt.GridBagLayout) RedistributionVersion(cbit.vcell.solvers.mb.MovingBoundarySolverOptions.RedistributionVersion) JFormattedTextField(javax.swing.JFormattedTextField) JLabel(javax.swing.JLabel) GridBagConstraints(java.awt.GridBagConstraints) DefaultListCellRenderer(javax.swing.DefaultListCellRenderer) ExtrapolationMethod(cbit.vcell.solvers.mb.MovingBoundarySolverOptions.ExtrapolationMethod) Component(java.awt.Component) NumberFormatter(javax.swing.text.NumberFormatter)

Example 3 with RedistributionMode

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);
    }
}
Also used : RedistributionMode(cbit.vcell.solvers.mb.MovingBoundarySolverOptions.RedistributionMode)

Aggregations

RedistributionMode (cbit.vcell.solvers.mb.MovingBoundarySolverOptions.RedistributionMode)3 ExtrapolationMethod (cbit.vcell.solvers.mb.MovingBoundarySolverOptions.ExtrapolationMethod)2 RedistributionVersion (cbit.vcell.solvers.mb.MovingBoundarySolverOptions.RedistributionVersion)2 MovingBoundarySolverOptions (cbit.vcell.solvers.mb.MovingBoundarySolverOptions)1 Component (java.awt.Component)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 DefaultListCellRenderer (javax.swing.DefaultListCellRenderer)1 JFormattedTextField (javax.swing.JFormattedTextField)1 JLabel (javax.swing.JLabel)1 JPanel (javax.swing.JPanel)1 NumberFormatter (javax.swing.text.NumberFormatter)1 Element (org.jdom.Element)1