Search in sources :

Example 6 with SmoldynSimulationOptions

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

the class SmoldynSimulationOptionsPanel method refresh.

private void refresh() {
    if (solverTaskDescription != null) {
        MathDescription mathDescription = solverTaskDescription.getSimulation().getMathDescription();
        if (!(mathDescription.isSpatialStoch() || mathDescription.isSpatialHybrid())) {
            setVisible(false);
            return;
        }
    }
    setVisible(true);
    SmoldynSimulationOptions smoldynSimulationOptions = solverTaskDescription.getSmoldynSimulationOptions();
    Integer randomSeed = (smoldynSimulationOptions == null ? null : smoldynSimulationOptions.getRandomSeed());
    if (randomSeed == null) {
        randomSeedTextField.setEditable(false);
        randomSeedCheckBox.setSelected(false);
    } else {
        randomSeedTextField.setEditable(true);
        randomSeedCheckBox.setSelected(true);
        randomSeedTextField.setText(randomSeed.toString());
        lastUserEnteredSeed = randomSeed;
    }
    if (smoldynSimulationOptions != null) {
        highResCheckBox.setSelected(smoldynSimulationOptions.isUseHighResolutionSample());
        saveParticleLocationsCheckBox.setSelected(smoldynSimulationOptions.isSaveParticleLocations());
        gaussianTableSizeTextField.setText("" + smoldynSimulationOptions.getGaussianTableSize());
        accuracyTextField.setText("" + smoldynSimulationOptions.getAccuracy());
        smoldynStepMultiplierTextField.setText("" + smoldynSimulationOptions.getSmoldynStepMultiplier());
    }
}
Also used : SmoldynSimulationOptions(cbit.vcell.solver.SmoldynSimulationOptions) MathDescription(cbit.vcell.math.MathDescription)

Example 7 with SmoldynSimulationOptions

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

the class XmlReader method getSolverTaskDescription.

/**
 * This method returns a SolverTaskDescription Object from a XML Element.
 * Creation date: (5/22/2001 10:51:23 AM)
 * @return cbit.vcell.solver.SolverTaskDescription
 * @param param org.jdom.Element
 * @param simulation cbit.vcell.solver.Simulation
 */
private SolverTaskDescription getSolverTaskDescription(Element param, Simulation simulation) throws XmlParseException {
    // *** create new SolverTaskDescription ***
    SolverTaskDescription solverTaskDesc = new SolverTaskDescription(simulation);
    // Added July 22nd, 2007, used as condition for stochSimOptions or stochHybridOprtions
    SolverDescription sd = null;
    // Retrieve attributes
    String taskType = param.getAttributeValue(XMLTags.TaskTypeTag);
    int keepEvery = -1;
    int keepAtMost = -1;
    if (param.getAttributeValue(XMLTags.KeepEveryTag) != null) {
        keepEvery = Integer.parseInt(param.getAttributeValue(XMLTags.KeepEveryTag));
        keepAtMost = Integer.parseInt(param.getAttributeValue(XMLTags.KeepAtMostTag));
    }
    boolean useSymJacob = new Boolean(param.getAttributeValue(XMLTags.UseSymbolicJacobianAttrTag)).booleanValue();
    String solverName = param.getAttributeValue(XMLTags.SolverNameTag);
    // get sentivity parameter
    Element sensparamElement = param.getChild(XMLTags.ConstantTag, vcNamespace);
    Constant sensitivityparam = null;
    if (sensparamElement != null) {
        sensitivityparam = getConstant(sensparamElement);
    }
    // set Attributes
    try {
        // set solver
        sd = SolverDescription.fromDatabaseName(solverName);
        if (sd == null) {
            System.err.println("====================================== couldn't find solver description name ==========================================");
        }
        solverTaskDesc.setSolverDescription(sd);
        if (taskType.equalsIgnoreCase(XMLTags.UnsteadyTag)) {
            solverTaskDesc.setTaskType(SolverTaskDescription.TASK_UNSTEADY);
        } else if (taskType.equalsIgnoreCase(XMLTags.SteadyTag)) {
            solverTaskDesc.setTaskType(SolverTaskDescription.TASK_STEADY);
        } else {
            throw new XmlParseException("Unexpected task type: " + taskType);
        }
    } catch (java.beans.PropertyVetoException e) {
        e.printStackTrace();
        throw new XmlParseException("A PropertyVetoException was fired when setting the taskType: " + taskType, e);
    }
    int numProcessors = parseIntWithDefault(param, XMLTags.NUM_PROCESSORS, 1);
    try {
        solverTaskDesc.setNumProcessors(numProcessors);
        solverTaskDesc.setUseSymbolicJacobian(useSymJacob);
        // get TimeBound
        solverTaskDesc.setTimeBounds(getTimeBounds(param.getChild(XMLTags.TimeBoundTag, vcNamespace)));
        // get TimeStep
        solverTaskDesc.setTimeStep(getTimeStep(param.getChild(XMLTags.TimeStepTag, vcNamespace)));
        // get ErrorTolerance
        solverTaskDesc.setErrorTolerance(getErrorTolerance(param.getChild(XMLTags.ErrorToleranceTag, vcNamespace)));
        // get StochSimOptions
        if (simulation != null && simulation.getMathDescription() != null) {
            if (simulation.getMathDescription().isNonSpatialStoch() && param.getChild(XMLTags.StochSimOptionsTag, vcNamespace) != null) {
                // Amended July 22nd, 2007 to read either stochSimOptions or stochHybridOptions
                solverTaskDesc.setStochOpt(getStochSimOptions(param.getChild(XMLTags.StochSimOptionsTag, vcNamespace)));
                if (sd != null && !sd.equals(SolverDescription.StochGibson)) {
                    solverTaskDesc.setStochHybridOpt(getStochHybridOptions(param.getChild(XMLTags.StochSimOptionsTag, vcNamespace)));
                }
            }
        }
        // get OutputOptions
        if (keepEvery != -1) {
            solverTaskDesc.setOutputTimeSpec(new DefaultOutputTimeSpec(keepEvery, keepAtMost));
        }
        OutputTimeSpec ots = getOutputTimeSpec(param.getChild(XMLTags.OutputOptionsTag, vcNamespace));
        if (ots != null) {
            solverTaskDesc.setOutputTimeSpec(getOutputTimeSpec(param.getChild(XMLTags.OutputOptionsTag, vcNamespace)));
        }
        // set SensitivityParameter
        solverTaskDesc.setSensitivityParameter(sensitivityparam);
        // set StopAtSpatiallyUniform
        Element stopSpatiallyElement = param.getChild(XMLTags.StopAtSpatiallyUniform, vcNamespace);
        if (stopSpatiallyElement != null) {
            Element errTolElement = stopSpatiallyElement.getChild(XMLTags.ErrorToleranceTag, vcNamespace);
            if (errTolElement != null) {
                solverTaskDesc.setStopAtSpatiallyUniformErrorTolerance(getErrorTolerance(errTolElement));
            }
        }
        String runParameterScanSeriallyAttributeValue = param.getAttributeValue(XMLTags.RunParameterScanSerially);
        if (runParameterScanSeriallyAttributeValue != null) {
            solverTaskDesc.setSerialParameterScan(new Boolean(runParameterScanSeriallyAttributeValue).booleanValue());
        }
        String timeoutDisabledAttributeValue = param.getAttributeValue(XMLTags.TimeoutSimulationDisabled);
        if (timeoutDisabledAttributeValue != null) {
            solverTaskDesc.setTimeoutDisabled(new Boolean(timeoutDisabledAttributeValue).booleanValue());
        }
        String borderExtrapolationDisabled = param.getAttributeValue(XMLTags.BorderExtrapolationDisabled);
        if (borderExtrapolationDisabled != null) {
            solverTaskDesc.setBorderExtrapolationDisabled(new Boolean(borderExtrapolationDisabled).booleanValue());
        }
        Element nfsimSimulationOptionsElement = param.getChild(XMLTags.NFSimSimulationOptions, vcNamespace);
        if (nfsimSimulationOptionsElement != null) {
            NFsimSimulationOptions nfsimSimulationOptions = getNFSimSimulationOptions(nfsimSimulationOptionsElement);
            solverTaskDesc.setNFSimSimulationOptions(nfsimSimulationOptions);
        }
        Element smoldySimulationOptionsElement = param.getChild(XMLTags.SmoldynSimulationOptions, vcNamespace);
        if (smoldySimulationOptionsElement != null) {
            SmoldynSimulationOptions smoldynSimulationOptions = getSmoldySimulationOptions(smoldySimulationOptionsElement);
            solverTaskDesc.setSmoldynSimulationOptions(smoldynSimulationOptions);
        }
        Element sundialsPdeSolverOptionsElement = param.getChild(XMLTags.SundialsSolverOptions, vcNamespace);
        if (sundialsPdeSolverOptionsElement != null) {
            SundialsPdeSolverOptions sundialsPdeSolverOptions = getSundialsPdeSolverOptions(sundialsPdeSolverOptionsElement);
            solverTaskDesc.setSundialsPdeSolverOptions(sundialsPdeSolverOptions);
        }
        Element chomboElement = param.getChild(XMLTags.ChomboSolverSpec, vcNamespace);
        if (chomboElement != null) {
            ChomboSolverSpec chombo = getChomboSolverSpec(solverTaskDesc, chomboElement, simulation.getMathDescription().getGeometry().getDimension());
            solverTaskDesc.setChomboSolverSpec(chombo);
        }
        Element mbElement = param.getChild(XMLTags.MovingBoundarySolverOptionsTag, vcNamespace);
        if (mbElement != null) {
            MovingBoundarySolverOptions mb = getMovingBoundarySolverOptions(solverTaskDesc, mbElement);
            solverTaskDesc.setMovingBoundarySolverOptions(mb);
        }
    } catch (java.beans.PropertyVetoException e) {
        e.printStackTrace();
        throw new XmlParseException(e);
    }
    return solverTaskDesc;
}
Also used : NFsimSimulationOptions(cbit.vcell.solver.NFsimSimulationOptions) SolverDescription(cbit.vcell.solver.SolverDescription) MovingBoundarySolverOptions(cbit.vcell.solvers.mb.MovingBoundarySolverOptions) SundialsPdeSolverOptions(cbit.vcell.solver.SundialsPdeSolverOptions) MacroscopicRateConstant(cbit.vcell.math.MacroscopicRateConstant) Constant(cbit.vcell.math.Constant) Element(org.jdom.Element) ChomboSolverSpec(org.vcell.chombo.ChomboSolverSpec) PropertyVetoException(java.beans.PropertyVetoException) SmoldynSimulationOptions(cbit.vcell.solver.SmoldynSimulationOptions) ExplicitOutputTimeSpec(cbit.vcell.solver.ExplicitOutputTimeSpec) OutputTimeSpec(cbit.vcell.solver.OutputTimeSpec) UniformOutputTimeSpec(cbit.vcell.solver.UniformOutputTimeSpec) DefaultOutputTimeSpec(cbit.vcell.solver.DefaultOutputTimeSpec) SolverTaskDescription(cbit.vcell.solver.SolverTaskDescription) DefaultOutputTimeSpec(cbit.vcell.solver.DefaultOutputTimeSpec)

Aggregations

SmoldynSimulationOptions (cbit.vcell.solver.SmoldynSimulationOptions)7 MathDescription (cbit.vcell.math.MathDescription)3 DefaultOutputTimeSpec (cbit.vcell.solver.DefaultOutputTimeSpec)2 ErrorTolerance (cbit.vcell.solver.ErrorTolerance)2 NFsimSimulationOptions (cbit.vcell.solver.NFsimSimulationOptions)2 OutputTimeSpec (cbit.vcell.solver.OutputTimeSpec)2 SolverTaskDescription (cbit.vcell.solver.SolverTaskDescription)2 SundialsPdeSolverOptions (cbit.vcell.solver.SundialsPdeSolverOptions)2 UniformOutputTimeSpec (cbit.vcell.solver.UniformOutputTimeSpec)2 MovingBoundarySolverOptions (cbit.vcell.solvers.mb.MovingBoundarySolverOptions)2 PropertyVetoException (java.beans.PropertyVetoException)2 Element (org.jdom.Element)2 ChomboSolverSpec (org.vcell.chombo.ChomboSolverSpec)2 CompartmentSubDomain (cbit.vcell.math.CompartmentSubDomain)1 Constant (cbit.vcell.math.Constant)1 Equation (cbit.vcell.math.Equation)1 MacroscopicRateConstant (cbit.vcell.math.MacroscopicRateConstant)1 MeasureEquation (cbit.vcell.math.MeasureEquation)1 MembraneRegionEquation (cbit.vcell.math.MembraneRegionEquation)1 MembraneSubDomain (cbit.vcell.math.MembraneSubDomain)1