Search in sources :

Example 81 with Simulation

use of cbit.vcell.solver.Simulation in project vcell by virtualcell.

the class SimulationListPanel method editSimulation.

/**
 * Comment
 */
private void editSimulation() {
    // this should not be possible to call unless exactly one row is selected, but check anyway
    int[] selectedRows = getScrollPaneTable().getSelectedRows();
    if (selectedRows.length > 0) {
        // make sure something is selected...
        Simulation sim = (Simulation) (ivjSimulationListTableModel1.getValueAt(selectedRows[0]));
        SimulationStatus simStatus = getSimulationWorkspace().getSimulationStatus(sim);
        if (!simStatus.isRunning()) {
            // just the first one if more than one selected...
            SimulationWorkspace.editSimulation(this, getSimulationWorkspace().getSimulationOwner(), sim);
            // need to check if parallel option changed
            refreshButtonsLax();
        }
    }
}
Also used : Simulation(cbit.vcell.solver.Simulation) SimulationStatus(cbit.vcell.server.SimulationStatus)

Example 82 with Simulation

use of cbit.vcell.solver.Simulation in project vcell by virtualcell.

the class SimulationListPanel method quickRun.

/*
	private void particleView() {
		int row = getScrollPaneTable().getSelectedRow();
		if (row < 0) {
			return;
		}
		Simulation selectedSim = getSimulationListTableModel1().getValueAt(row);
		getSimulationWorkspace().getClientSimManager().runSmoldynParticleView(selectedSim);
	}
	*/
private void quickRun(ViewerType viewerType) {
    int row = getScrollPaneTable().getSelectedRow();
    if (row < 0) {
        return;
    }
    activateConsole();
    Simulation selectedSim = getSimulationListTableModel1().getValueAt(row);
    SolverDescription solverDescription = selectedSim.getSolverTaskDescription().getSolverDescription();
    if (solverDescription.equals(SolverDescription.FiniteVolume)) {
        if (getSimulationWorkspace().getSimulationOwner() instanceof SimulationContext) {
            String option = DialogUtils.showOKCancelWarningDialog(SimulationListPanel.this, "Deprecated Solver", VCellErrorMessages.getSemiFVSolverCompiledSolverDeprecated(selectedSim));
            if (option.equals(SimpleUserMessage.OPTION_CANCEL)) {
                return;
            }
            try {
                selectedSim.getSolverTaskDescription().setSolverDescription(SolverDescription.FiniteVolumeStandalone);
                selectedSim.setIsDirty(true);
            } catch (PropertyVetoException e) {
                e.printStackTrace();
            }
        }
    }
    getSimulationWorkspace().getClientSimManager().runQuickSimulation(selectedSim, viewerType);
}
Also used : PropertyVetoException(java.beans.PropertyVetoException) SolverDescription(cbit.vcell.solver.SolverDescription) Simulation(cbit.vcell.solver.Simulation) SimulationContext(cbit.vcell.mapping.SimulationContext)

Example 83 with Simulation

use of cbit.vcell.solver.Simulation in project vcell by virtualcell.

the class SimulationListPanel method runSimulations.

/**
 * Comment
 */
private void runSimulations() {
    final ArrayList<Simulation> simList = new ArrayList<Simulation>();
    int[] selections = getScrollPaneTable().getSelectedRows();
    for (int i = 0; i < selections.length; i++) {
        Simulation sim = (Simulation) (ivjSimulationListTableModel1.getValueAt(selections[i]));
        if (sim.getSolverTaskDescription().getSolverDescription().equals(SolverDescription.FiniteVolume)) {
            if (getSimulationWorkspace().getSimulationOwner() instanceof SimulationContext) {
                String option = DialogUtils.showOKCancelWarningDialog(SimulationListPanel.this, "Deprecated Solver", VCellErrorMessages.getSemiFVSolverCompiledSolverDeprecated(sim));
                if (option.equals(SimpleUserMessage.OPTION_CANCEL)) {
                    return;
                }
                try {
                    sim.getSolverTaskDescription().setSolverDescription(SolverDescription.FiniteVolumeStandalone);
                    sim.setIsDirty(true);
                } catch (PropertyVetoException e) {
                    e.printStackTrace();
                }
            }
        }
        simList.add(sim);
    }
    if (simList.size() > 0) {
        activateConsole();
        Simulation[] toRun = simList.toArray(new Simulation[0]);
        getSimulationWorkspace().runSimulations(toRun, this);
    }
}
Also used : PropertyVetoException(java.beans.PropertyVetoException) Simulation(cbit.vcell.solver.Simulation) ArrayList(java.util.ArrayList) SimulationContext(cbit.vcell.mapping.SimulationContext)

Example 84 with Simulation

use of cbit.vcell.solver.Simulation in project vcell by virtualcell.

the class SimulationStatusDetailsPanel method simulationStatusDetailsPanel_SimulationStatusDetails.

/**
 * Comment
 */
public void simulationStatusDetailsPanel_SimulationStatusDetails(cbit.vcell.client.desktop.simulation.SimulationStatusDetails simStatusDetails) {
    if (simStatusDetails == null) {
        return;
    }
    Simulation sim = simStatusDetails.getSimulation();
    getNameTextField().setText(sim.getName());
    getIDTextField().setText("" + (sim.getKey() != null ? sim.getKey().toString() : "") + (sim.getSimulationVersion() != null && sim.getSimulationVersion().getParentSimulationReference() != null ? " (parentSimRef=" + sim.getSimulationVersion().getParentSimulationReference().toString() + ")" : ""));
    getSolverTextField().setText(sim.getSolverTaskDescription().getSolverDescription().getDisplayLabel());
    return;
}
Also used : Simulation(cbit.vcell.solver.Simulation)

Example 85 with Simulation

use of cbit.vcell.solver.Simulation in project vcell by virtualcell.

the class SimulationWorkspace method getExpectedSizeBytes.

/**
 * Insert the method's description here.
 * Creation date: (6/12/2001 10:09:25 AM)
 * @return boolean
 * @param simulation cbit.vcell.solver.Simulation
 */
private static long getExpectedSizeBytes(SimulationSymbolTable simSymbolTable) {
    Simulation simulation = simSymbolTable.getSimulation();
    long numTimepoints;
    if (simulation.getMathDescription().isNonSpatialStoch()) {
        numTimepoints = getEstimatedNumTimePointsForStoch(simSymbolTable);
    } else {
        numTimepoints = getExpectedNumTimePoints(simulation);
    }
    int x, y, z;
    int numVariables = 0;
    if (simulation.isSpatial()) {
        x = simulation.getMeshSpecification().getSamplingSize().getX();
        y = simulation.getMeshSpecification().getSamplingSize().getY();
        z = simulation.getMeshSpecification().getSamplingSize().getZ();
        // 
        // compute number of volume variables only (they are multiplied by x*y*z)
        // 
        numVariables = 0;
        Enumeration<Variable> variables = simulation.getMathDescription().getVariables();
        while (variables.hasMoreElements()) {
            Variable var = variables.nextElement();
            if (var instanceof VolVariable) {
                numVariables++;
            }
        }
    } else {
        x = 1;
        y = 1;
        z = 1;
        numVariables = 0;
        Enumeration<Variable> variables = simulation.getMathDescription().getVariables();
        while (variables.hasMoreElements()) {
            Variable var = variables.nextElement();
            if ((var instanceof VolVariable) || (var instanceof Function)) {
                numVariables++;
            }
        }
    }
    // approximate, don't compute header size since it's negligible whenever we approach quota size anyway...
    // values are actually written as longs
    long expectedSize = numTimepoints * numVariables * x * y * z * 8;
    return expectedSize;
}
Also used : Function(cbit.vcell.math.Function) AnnotatedFunction(cbit.vcell.solver.AnnotatedFunction) Variable(cbit.vcell.math.Variable) VolVariable(cbit.vcell.math.VolVariable) Simulation(cbit.vcell.solver.Simulation) VolVariable(cbit.vcell.math.VolVariable)

Aggregations

Simulation (cbit.vcell.solver.Simulation)195 SimulationContext (cbit.vcell.mapping.SimulationContext)57 BioModel (cbit.vcell.biomodel.BioModel)53 MathDescription (cbit.vcell.math.MathDescription)48 KeyValue (org.vcell.util.document.KeyValue)33 Geometry (cbit.vcell.geometry.Geometry)29 MathModel (cbit.vcell.mathmodel.MathModel)27 Expression (cbit.vcell.parser.Expression)26 DataAccessException (org.vcell.util.DataAccessException)26 File (java.io.File)25 ExpressionException (cbit.vcell.parser.ExpressionException)24 IOException (java.io.IOException)24 SimulationJob (cbit.vcell.solver.SimulationJob)23 ArrayList (java.util.ArrayList)23 PropertyVetoException (java.beans.PropertyVetoException)20 UniformOutputTimeSpec (cbit.vcell.solver.UniformOutputTimeSpec)18 XMLSource (cbit.vcell.xml.XMLSource)18 SimulationTask (cbit.vcell.messaging.server.SimulationTask)17 TimeBounds (cbit.vcell.solver.TimeBounds)16 BigString (org.vcell.util.BigString)16