Search in sources :

Example 21 with MathModel

use of cbit.vcell.mathmodel.MathModel in project vcell by virtualcell.

the class RuleBasedTest method main.

public static void main(String[] args) {
    try {
        PropertyLoader.loadProperties();
    } catch (Exception e) {
        e.printStackTrace();
    }
    final int numTrials = 40;
    VCDatabaseVisitor vcDatabaseVisitor = new VCDatabaseVisitor() {

        @Override
        public void visitMathModel(MathModel mathModel, PrintStream logFilePrintStream) {
            throw new IllegalArgumentException("Not Implemented");
        }

        @Override
        public void visitGeometry(Geometry geometry, PrintStream logFilePrintStream) {
            throw new IllegalArgumentException("Not Implemented");
        }

        @Override
        public void visitBioModel(BioModel bioModel, PrintStream logFilePrintStream) {
            SimulationContext[] simulationContexts = bioModel.getSimulationContexts();
            for (SimulationContext simContext : simulationContexts) {
                if ((simContext.getApplicationType() == Application.NETWORK_STOCHASTIC) && simContext.getGeometry().getDimension() == 0) {
                    File baseDirectory = createDirFile(simContext);
                    try {
                        checkNonspatialStochasticSimContext(simContext, baseDirectory, numTrials);
                    } catch (Exception e) {
                        e.printStackTrace();
                        if (!e.getMessage().contains("Only Mass Action Kinetics supported ")) {
                            writeMessageTofile(baseDirectory, e.getMessage());
                        }
                    }
                }
            }
        }

        @Override
        public boolean filterMathModel(MathModelInfo mathModelInfo) {
            return false;
        }

        @Override
        public boolean filterGeometry(GeometryInfo geometryInfo) {
            return false;
        }

        @Override
        public boolean filterBioModel(BioModelInfo bioModelInfo) {
            return // bioModelInfo.getVersion().getName().equals("model");
            bioModelInfo.getVersion().getName().equals("simpleModel_Network_orig");
        }
    };
    String currentUserID = "schaff";
    String[] allUsers = new String[] { /*-all*/
    currentUserID, "-" };
    VCDatabaseScanner.scanBioModels(allUsers, vcDatabaseVisitor, false);
}
Also used : PrintStream(java.io.PrintStream) MathModel(cbit.vcell.mathmodel.MathModel) BioModelInfo(org.vcell.util.document.BioModelInfo) MathModelInfo(org.vcell.util.document.MathModelInfo) SimulationContext(cbit.vcell.mapping.SimulationContext) Geometry(cbit.vcell.geometry.Geometry) BioModel(cbit.vcell.biomodel.BioModel) GeometryInfo(cbit.vcell.geometry.GeometryInfo) VCDatabaseVisitor(cbit.vcell.modeldb.VCDatabaseVisitor) File(java.io.File)

Example 22 with MathModel

use of cbit.vcell.mathmodel.MathModel in project vcell by virtualcell.

the class MathGenerationDebugger method compareMath_4_8.

private void compareMath_4_8() {
    try {
        MathModel mathModel1 = new MathModel(null);
        MathModel mathModel2 = new MathModel(null);
        mathModel1.setMathDescription(mathGenerationResults.mathDesc_original);
        mathModel2.setMathDescription(mathGenerationResults.mathDesc_4_8);
        getMathDebuggerPanel().setMathModel1(mathModel1);
        getMathDebuggerPanel().setMathModel2(mathModel2);
    } catch (Exception e) {
        e.printStackTrace(System.out);
        DialogUtils.showErrorDialog(this, e.getMessage(), e);
    }
}
Also used : MathModel(cbit.vcell.mathmodel.MathModel)

Example 23 with MathModel

use of cbit.vcell.mathmodel.MathModel in project vcell by virtualcell.

the class MathModelEditorTreeCellRenderer method getTreeCellRendererComponent.

// public void setMathModel(MathModel mm) {
// mathModel = mm;
// }
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
    super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
    if (regularFont == null) {
        regularFont = getFont();
        boldFont = regularFont.deriveFont(Font.BOLD);
    }
    Font font = regularFont;
    Icon icon = null;
    String labelText = null;
    String toolTipPrefix = "";
    String toolTipSuffix = "";
    if (value instanceof BioModelNode) {
        BioModelNode node = (BioModelNode) value;
        if (node.getChildCount() > 0) {
            icon = getIcon();
        }
        Object userObj = node.getUserObject();
        if (userObj instanceof MathModel) {
            font = boldFont;
            icon = VCellIcons.documentIcon;
            labelText = ((MathModel) userObj).getName();
            toolTipPrefix = "MathModel: ";
        } else if (userObj instanceof DocumentEditorTreeFolderNode) {
            // --- 1st level folders
            DocumentEditorTreeFolderNode folder = (DocumentEditorTreeFolderNode) userObj;
            labelText = folder.getName();
            if (folder.isBold()) {
                font = boldFont;
            }
            DocumentEditorTreeFolderClass folderClass = folder.getFolderClass();
            switch(folderClass) {
                case MATH_VCML_NODE:
                    icon = VCellIcons.textNotesIcon;
                    break;
                case MATH_GEOMETRY_NODE:
                    icon = VCellIcons.geometryIcon;
                    break;
                case MATH_SIMULATIONS_NODE:
                    icon = VCellIcons.simulationIcon;
                    break;
                case MATH_OUTPUT_FUNCTIONS_NODE:
                    icon = VCellIcons.getOutputFunctionIcon();
                    break;
            }
        }
    }
    setIcon(icon);
    setFont(font);
    setText(labelText);
    if (toolTipSuffix.length() == 0) {
        toolTipSuffix = labelText;
    }
    setToolTipText(toolTipPrefix + toolTipSuffix);
    return this;
}
Also used : MathModel(cbit.vcell.mathmodel.MathModel) DocumentEditorTreeFolderNode(cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderNode) BioModelNode(cbit.vcell.desktop.BioModelNode) Icon(javax.swing.Icon) DocumentEditorTreeFolderClass(cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderClass) Font(java.awt.Font)

Example 24 with MathModel

use of cbit.vcell.mathmodel.MathModel in project vcell by virtualcell.

the class MathModelEditorTreeModel method setMathModel.

public void setMathModel(MathModel newValue) {
    if (mathModel == newValue) {
        return;
    }
    MathModel oldValue = this.mathModel;
    mathModel = newValue;
    populateRoot();
    if (oldValue != null) {
        oldValue.removePropertyChangeListener(this);
    }
    if (newValue != null) {
        newValue.addPropertyChangeListener(this);
    }
}
Also used : MathModel(cbit.vcell.mathmodel.MathModel)

Example 25 with MathModel

use of cbit.vcell.mathmodel.MathModel in project vcell by virtualcell.

the class VCMLEditorPanel method setMathModel.

/**
 * Sets the mathModel property (cbit.vcell.mathmodel.MathModel) value.
 * @param mathModel The new value for the property.
 * @see #getMathModel
 */
public void setMathModel(MathModel newValue) {
    if (fieldMathModel == newValue) {
        return;
    }
    MathModel oldValue = fieldMathModel;
    if (oldValue != null) {
        oldValue.removePropertyChangeListener(ivjEventHandler);
        if (oldValue.getGeometry() != null) {
            oldValue.getGeometry().getGeometrySpec().removePropertyChangeListener(ivjEventHandler);
        }
    }
    fieldMathModel = newValue;
    if (newValue != null) {
        newValue.addPropertyChangeListener(ivjEventHandler);
        if (newValue.getGeometry() != null) {
            newValue.getGeometry().getGeometrySpec().addPropertyChangeListener(ivjEventHandler);
        }
        getMathDescEditor().setMathDescription(fieldMathModel.getMathDescription());
    }
}
Also used : MathModel(cbit.vcell.mathmodel.MathModel)

Aggregations

MathModel (cbit.vcell.mathmodel.MathModel)70 BioModel (cbit.vcell.biomodel.BioModel)26 Simulation (cbit.vcell.solver.Simulation)24 DataAccessException (org.vcell.util.DataAccessException)21 Geometry (cbit.vcell.geometry.Geometry)20 MathDescription (cbit.vcell.math.MathDescription)20 SimulationContext (cbit.vcell.mapping.SimulationContext)19 XmlParseException (cbit.vcell.xml.XmlParseException)13 MathModelInfo (org.vcell.util.document.MathModelInfo)12 ObjectNotFoundException (org.vcell.util.ObjectNotFoundException)11 UserCancelException (org.vcell.util.UserCancelException)11 VCDocument (org.vcell.util.document.VCDocument)11 XMLSource (cbit.vcell.xml.XMLSource)10 ExpressionException (cbit.vcell.parser.ExpressionException)9 File (java.io.File)9 KeyValue (org.vcell.util.document.KeyValue)8 PropertyVetoException (java.beans.PropertyVetoException)7 IOException (java.io.IOException)7 BigString (org.vcell.util.BigString)7 BioModelInfo (org.vcell.util.document.BioModelInfo)7