Search in sources :

Example 1 with ChomboSolverSpec

use of org.vcell.chombo.ChomboSolverSpec in project vcell by virtualcell.

the class ChomboSolverSpecPanel method updateDisplay.

private void updateDisplay() {
    if (!simulation.getSolverTaskDescription().getSolverDescription().isChomboSolver()) {
        setVisible(false);
        return;
    }
    setVisible(true);
    ChomboSolverSpec chomboSolverSpec = simulation.getSolverTaskDescription().getChomboSolverSpec();
    maxBoxSizeComboBox.setSelectedItem(chomboSolverSpec.getMaxBoxSize());
    blockFactorComboBox.setSelectedItem(chomboSolverSpec.getBlockFactor());
    fillRatioTextField.setText(chomboSolverSpec.getFillRatio() + "");
    checkBoxTagsGrow.setSelected(chomboSolverSpec.isTagsGrowEnabled());
    updateViewLevel();
    updateFinestInfoPanel();
}
Also used : ChomboSolverSpec(org.vcell.chombo.ChomboSolverSpec)

Example 2 with ChomboSolverSpec

use of org.vcell.chombo.ChomboSolverSpec in project vcell by virtualcell.

the class FiniteVolumeFileWriter method writeChomboSpec.

private void writeChomboSpec() throws ExpressionException, SolverException, PropertyVetoException, ClassNotFoundException, IOException, GeometryException, ImageException {
    if (!bChomboSolver) {
        return;
    }
    GeometrySpec geometrySpec = resampledGeometry.getGeometrySpec();
    int dimension = geometrySpec.getDimension();
    if (dimension == 1) {
        throw new SolverException(simTask.getSimulation().getSolverTaskDescription().getSolverDescription().getDisplayLabel() + " is only supported for simulations with 2D or 3D geometry.");
    }
    Simulation simulation = getSimulationTask().getSimulation();
    SolverTaskDescription solverTaskDescription = simulation.getSolverTaskDescription();
    ChomboSolverSpec chomboSolverSpec = solverTaskDescription.getChomboSolverSpec();
    printWriter.println(FVInputFileKeyword.CHOMBO_SPEC_BEGIN);
    printWriter.println(FVInputFileKeyword.DIMENSION + " " + geometrySpec.getDimension());
    Extent extent = geometrySpec.getExtent();
    Origin origin = geometrySpec.getOrigin();
    ISize isize = simulation.getMeshSpecification().getSamplingSize();
    switch(geometrySpec.getDimension()) {
        case 2:
            printWriter.println(FVInputFileKeyword.MESH_SIZE + " " + isize.getX() + " " + isize.getY());
            printWriter.println(FVInputFileKeyword.DOMAIN_SIZE + " " + extent.getX() + " " + extent.getY());
            printWriter.println(FVInputFileKeyword.DOMAIN_ORIGIN + " " + origin.getX() + " " + origin.getY());
            break;
        case 3:
            printWriter.println(FVInputFileKeyword.MESH_SIZE + " " + isize.getX() + " " + isize.getY() + " " + isize.getZ());
            printWriter.println(FVInputFileKeyword.DOMAIN_SIZE + " " + extent.getX() + " " + extent.getY() + " " + extent.getZ());
            printWriter.println(FVInputFileKeyword.DOMAIN_ORIGIN + " " + origin.getX() + " " + origin.getY() + " " + origin.getZ());
            break;
    }
    List<CompartmentSubDomain> featureList = new ArrayList<CompartmentSubDomain>();
    Enumeration<SubDomain> enum1 = simulation.getMathDescription().getSubDomains();
    while (enum1.hasMoreElements()) {
        SubDomain sd = enum1.nextElement();
        if (sd instanceof CompartmentSubDomain) {
            featureList.add((CompartmentSubDomain) sd);
        }
    }
    int numFeatures = featureList.size();
    CompartmentSubDomain[] features = featureList.toArray(new CompartmentSubDomain[0]);
    int[] phases = new int[numFeatures];
    Arrays.fill(phases, -1);
    phases[numFeatures - 1] = 0;
    int[] numAssigned = new int[] { 1 };
    assignPhases(features, numFeatures - 1, phases, numAssigned);
    Map<String, Integer> subDomainPhaseMap = new HashMap<String, Integer>();
    for (int i = 0; i < phases.length; ++i) {
        if (phases[i] == -1) {
            throw new SolverException("Failed to assign a phase to CompartmentSubdomain '" + features[i].getName() + "'. It might be caused by too coarsh a mesh.");
        }
        subDomainPhaseMap.put(features[i].getName(), phases[i]);
    }
    SubVolume[] subVolumes = geometrySpec.getSubVolumes();
    if (geometrySpec.hasImage()) {
        Geometry geometry = (Geometry) BeanUtils.cloneSerializable(simulation.getMathDescription().getGeometry());
        Geometry simGeometry = geometry;
        VCImage img = geometry.getGeometrySpec().getImage();
        int factor = Math.max(Math.max(img.getNumX(), img.getNumY()), img.getNumZ()) < 512 ? 2 : 1;
        ISize distanceMapMeshSize = new ISize(img.getNumX() * factor, img.getNumY() * factor, img.getNumZ() * factor);
        Vect3d deltaX = null;
        boolean bCellCentered = false;
        double dx = 0.5;
        double dy = 0.5;
        double dz = 0.5;
        int Nx = distanceMapMeshSize.getX();
        int Ny = distanceMapMeshSize.getY();
        int Nz = distanceMapMeshSize.getZ();
        if (dimension == 2) {
            // pad the 2D image with itself in order to obtain a 3D image used to compute the distance map
            // because the distance map algorithm is 3D only (using distance to triangles)
            byte[] oldPixels = img.getPixels();
            byte[] newPixels = new byte[oldPixels.length * 3];
            System.arraycopy(oldPixels, 0, newPixels, 0, oldPixels.length);
            System.arraycopy(oldPixels, 0, newPixels, oldPixels.length, oldPixels.length);
            System.arraycopy(oldPixels, 0, newPixels, oldPixels.length * 2, oldPixels.length);
            double distX = geometry.getExtent().getX() / img.getNumX();
            double distY = geometry.getExtent().getY() / img.getNumY();
            // we set the distance on the z axis to something that makes sense
            double distZ = Math.max(distX, distY);
            Extent newExtent = new Extent(geometry.getExtent().getX(), geometry.getExtent().getY(), distZ * 3);
            VCImage newImage = new VCImageUncompressed(null, newPixels, newExtent, img.getNumX(), img.getNumY(), 3);
            // copy the pixel classes too
            ArrayList<VCPixelClass> newPixelClasses = new ArrayList<VCPixelClass>();
            for (VCPixelClass origPixelClass : geometry.getGeometrySpec().getImage().getPixelClasses()) {
                SubVolume origSubvolume = geometry.getGeometrySpec().getImageSubVolumeFromPixelValue(origPixelClass.getPixel());
                newPixelClasses.add(new VCPixelClass(null, origSubvolume.getName(), origPixelClass.getPixel()));
            }
            newImage.setPixelClasses(newPixelClasses.toArray(new VCPixelClass[newPixelClasses.size()]));
            simGeometry = new Geometry(geometry, newImage);
            Nz = 3;
        }
        GeometrySpec simGeometrySpec = simGeometry.getGeometrySpec();
        Extent simExtent = simGeometrySpec.getExtent();
        dx = simExtent.getX() / (Nx - 1);
        dy = simExtent.getY() / (Ny - 1);
        dz = simExtent.getZ() / (Nz - 1);
        if (Math.abs(dx - dy) > 0.1 * Math.max(dx, dy)) {
            dx = Math.min(dx, dy);
            dy = dx;
            Nx = (int) (simExtent.getX() / dx + 1);
            Ny = (int) (simExtent.getY() / dx + 1);
            if (dimension == 3) {
                dz = dx;
                Nz = (int) (simExtent.getZ() / dx + 1);
            }
        }
        deltaX = new Vect3d(dx, dy, dz);
        // one more point in each direction
        distanceMapMeshSize = new ISize(Nx + 1, Ny + 1, Nz + 1);
        Extent distanceMapExtent = new Extent(simExtent.getX() + dx, simExtent.getY() + dy, simExtent.getZ() + dz);
        simGeometrySpec.setExtent(distanceMapExtent);
        GeometrySurfaceDescription geoSurfaceDesc = simGeometry.getGeometrySurfaceDescription();
        geoSurfaceDesc.setVolumeSampleSize(distanceMapMeshSize);
        geoSurfaceDesc.updateAll();
        VCImage vcImage = RayCaster.sampleGeometry(simGeometry, distanceMapMeshSize, bCellCentered);
        SubvolumeSignedDistanceMap[] distanceMaps = DistanceMapGenerator.computeDistanceMaps(simGeometry, vcImage, bCellCentered);
        if (dimension == 2) {
            distanceMaps = DistanceMapGenerator.extractMiddleSlice(distanceMaps);
        }
        printWriter.println(FVInputFileKeyword.SUBDOMAINS + " " + simGeometrySpec.getNumSubVolumes() + " " + FVInputFileKeyword.DISTANCE_MAP);
        for (int i = 0; i < subVolumes.length; i++) {
            File distanceMapFile = new File(workingDirectory, getSimulationTask().getSimulationJobID() + "_" + subVolumes[i].getName() + DISTANCE_MAP_FILE_EXTENSION);
            writeDistanceMapFile(deltaX, distanceMaps[i], distanceMapFile);
            int phase = subDomainPhaseMap.get(subVolumes[i].getName());
            printWriter.println(subVolumes[i].getName() + " " + phase + " " + distanceMapFile.getAbsolutePath());
        }
    } else {
        printWriter.println(FVInputFileKeyword.SUBDOMAINS + " " + geometrySpec.getNumSubVolumes());
        Expression[] rvachevExps = convertAnalyticGeometryToRvachevFunction(geometrySpec);
        for (int i = 0; i < subVolumes.length; i++) {
            if (subVolumes[i] instanceof AnalyticSubVolume) {
                String name = subVolumes[i].getName();
                int phase = subDomainPhaseMap.get(name);
                printWriter.println(name + " " + phase + " ");
                printWriter.println(FVInputFileKeyword.IF + " " + rvachevExps[i].infix() + ";");
                printWriter.println(FVInputFileKeyword.USER + " " + ((AnalyticSubVolume) subVolumes[i]).getExpression().infix() + ";");
            }
        }
    }
    printWriter.println(FVInputFileKeyword.MAX_BOX_SIZE + " " + chomboSolverSpec.getMaxBoxSize());
    printWriter.println(FVInputFileKeyword.FILL_RATIO + " " + chomboSolverSpec.getFillRatio());
    printWriter.println(FVInputFileKeyword.RELATIVE_TOLERANCE + " " + simulation.getSolverTaskDescription().getErrorTolerance().getRelativeErrorTolerance());
    printWriter.println(FVInputFileKeyword.SAVE_VCELL_OUTPUT + " " + chomboSolverSpec.isSaveVCellOutput());
    printWriter.println(FVInputFileKeyword.SAVE_CHOMBO_OUTPUT + " " + chomboSolverSpec.isSaveChomboOutput());
    printWriter.println(FVInputFileKeyword.ACTIVATE_FEATURE_UNDER_DEVELOPMENT + " " + chomboSolverSpec.isActivateFeatureUnderDevelopment());
    printWriter.println(FVInputFileKeyword.SMALL_VOLFRAC_THRESHOLD + " " + chomboSolverSpec.getSmallVolfracThreshold());
    printWriter.println(FVInputFileKeyword.BLOCK_FACTOR + " " + chomboSolverSpec.getBlockFactor());
    printWriter.println(FVInputFileKeyword.TAGS_GROW + " " + chomboSolverSpec.getTagsGrow());
    // Refinement
    int numLevels = chomboSolverSpec.getNumRefinementLevels();
    // Refinements #Levels ratio 1, ratio 2, etc
    printWriter.print(FVInputFileKeyword.REFINEMENTS + " " + (numLevels + 1));
    List<Integer> ratios = chomboSolverSpec.getRefineRatioList();
    for (int i : ratios) {
        printWriter.print(" " + i);
    }
    // write last refinement ratio, fake
    printWriter.println(" 2");
    // membrane rois
    List<RefinementRoi> memRios = chomboSolverSpec.getMembraneRefinementRois();
    printWriter.println(FVInputFileKeyword.REFINEMENT_ROIS + " " + RoiType.Membrane + " " + memRios.size());
    for (RefinementRoi roi : memRios) {
        if (roi.getRoiExpression() == null) {
            throw new SolverException("ROI expression cannot be null");
        }
        // level tagsGrow ROIexpression
        printWriter.println(roi.getLevel() + " " + roi.getRoiExpression().infix() + ";");
    }
    List<RefinementRoi> volRios = chomboSolverSpec.getVolumeRefinementRois();
    printWriter.println(FVInputFileKeyword.REFINEMENT_ROIS + " " + RoiType.Volume + " " + volRios.size());
    for (RefinementRoi roi : volRios) {
        if (roi.getRoiExpression() == null) {
            throw new SolverException("ROI expression cannot be null");
        }
        printWriter.println(roi.getLevel() + " " + roi.getRoiExpression().infix() + ";");
    }
    printWriter.println(FVInputFileKeyword.VIEW_LEVEL + " " + chomboSolverSpec.getViewLevel());
    printWriter.println(FVInputFileKeyword.CHOMBO_SPEC_END);
    printWriter.println();
}
Also used : Origin(org.vcell.util.Origin) VCPixelClass(cbit.image.VCPixelClass) GeometrySurfaceDescription(cbit.vcell.geometry.surface.GeometrySurfaceDescription) Extent(org.vcell.util.Extent) HashMap(java.util.HashMap) ISize(org.vcell.util.ISize) ArrayList(java.util.ArrayList) VCImage(cbit.image.VCImage) SubvolumeSignedDistanceMap(cbit.vcell.geometry.surface.SubvolumeSignedDistanceMap) GeometrySpec(cbit.vcell.geometry.GeometrySpec) CompartmentSubDomain(cbit.vcell.math.CompartmentSubDomain) SubDomain(cbit.vcell.math.SubDomain) MembraneSubDomain(cbit.vcell.math.MembraneSubDomain) RefinementRoi(org.vcell.chombo.RefinementRoi) SubVolume(cbit.vcell.geometry.SubVolume) AnalyticSubVolume(cbit.vcell.geometry.AnalyticSubVolume) SolverTaskDescription(cbit.vcell.solver.SolverTaskDescription) VCImageUncompressed(cbit.image.VCImageUncompressed) ChomboSolverSpec(org.vcell.chombo.ChomboSolverSpec) Vect3d(cbit.vcell.render.Vect3d) Geometry(cbit.vcell.geometry.Geometry) Simulation(cbit.vcell.solver.Simulation) Expression(cbit.vcell.parser.Expression) CompartmentSubDomain(cbit.vcell.math.CompartmentSubDomain) SolverException(cbit.vcell.solver.SolverException) File(java.io.File) AnalyticSubVolume(cbit.vcell.geometry.AnalyticSubVolume)

Example 3 with ChomboSolverSpec

use of org.vcell.chombo.ChomboSolverSpec in project vcell by virtualcell.

the class FVSolverStandalone method getChomboCommands.

private Collection<ExecutableCommand> getChomboCommands() {
    assert (isChombo);
    ArrayList<ExecutableCommand> commands = new ArrayList<ExecutableCommand>(2);
    String inputFilename = getInputFilename();
    String executableName = null;
    Simulation simulation = getSimulationJob().getSimulation();
    SolverTaskDescription sTaskDesc = simulation.getSolverTaskDescription();
    final boolean isParallel = sTaskDesc.isParallel();
    int dimension = simulation.getMeshSpecification().getGeometry().getDimension();
    switch(dimension) {
        case 2:
            try {
                executableName = SolverUtilities.getExes(SolverDescription.Chombo)[0].getAbsolutePath();
            } catch (IOException e) {
                throw new RuntimeException("failed to get executable for 2D solver " + SolverDescription.Chombo.getDisplayLabel() + ": " + e.getMessage(), e);
            }
            break;
        case 3:
            try {
                executableName = SolverUtilities.getExes(SolverDescription.Chombo)[1].getAbsolutePath();
            } catch (IOException e) {
                throw new RuntimeException("failed to get executable for 3D solver " + SolverDescription.Chombo.getDisplayLabel() + ": " + e.getMessage(), e);
            }
            break;
        default:
            throw new IllegalArgumentException("VCell Chombo solver does not support " + dimension + "problems");
    }
    if (isParallel) {
        String parallelName = executableName + "parallel";
        ExecutableCommand solve = new ExecutableCommand(new ExecutableCommand.LibraryPath(ResourceUtil.getLocalSolversDirectory().getAbsolutePath()), true, true, parallelName, inputFilename);
        commands.add(solve);
        ChomboSolverSpec css = sTaskDesc.getChomboSolverSpec();
        Objects.requireNonNull(css);
        if (css.isSaveVCellOutput()) {
            ExecutableCommand convertChomboData = new ExecutableCommand(new ExecutableCommand.LibraryPath(ResourceUtil.getLocalSolversDirectory().getAbsolutePath()), true, false, executableName, "-ccd", inputFilename);
            commands.add(convertChomboData);
        }
    } else {
        ExecutableCommand ec = new ExecutableCommand(new ExecutableCommand.LibraryPath(ResourceUtil.getLocalSolversDirectory().getAbsolutePath()), true, false, executableName, inputFilename);
        commands.add(ec);
        primaryCommand = ec;
    }
    return commands;
}
Also used : ArrayList(java.util.ArrayList) IOException(java.io.IOException) ChomboSolverSpec(org.vcell.chombo.ChomboSolverSpec) Simulation(cbit.vcell.solver.Simulation) SolverTaskDescription(cbit.vcell.solver.SolverTaskDescription)

Example 4 with ChomboSolverSpec

use of org.vcell.chombo.ChomboSolverSpec in project vcell by virtualcell.

the class SolverTaskDescription method propertyChange.

/**
 * This method gets called when a bound property is changed.
 * @param evt A PropertyChangeEvent object describing the event source
 *   and the property that has changed.
 */
public void propertyChange(java.beans.PropertyChangeEvent evt) {
    try {
        if (evt.getSource() == this && (evt.getPropertyName().equals(PROPERTY_SOLVER_DESCRIPTION))) {
            SolverDescription solverDescription = getSolverDescription();
            if (solverDescription.equals(SolverDescription.SundialsPDE) || solverDescription.isSemiImplicitPdeSolver() || solverDescription.isGibsonSolver()) {
                TimeBounds timeBounds = getTimeBounds();
                if (!(getOutputTimeSpec() instanceof UniformOutputTimeSpec)) {
                    // set to uniform output if it is not.
                    double outputTime = (timeBounds.getEndingTime() - timeBounds.getStartingTime()) / 20;
                    setOutputTimeSpec(new UniformOutputTimeSpec(outputTime));
                }
                if (solverDescription.equals(SolverDescription.SundialsPDE)) {
                    setErrorTolerance(ErrorTolerance.getDefaultSundialsErrorTolerance());
                    setDefaultTimeStep(TimeStep.getDefaultSundialsTimeStep());
                    if (sundialsPdeSolverOptions == null) {
                        sundialsPdeSolverOptions = new SundialsPdeSolverOptions();
                    }
                } else {
                    sundialsPdeSolverOptions = null;
                    setErrorTolerance(ErrorTolerance.getDefaultSemiImplicitErrorTolerance());
                }
            } else if (!solverDescription.supports(getOutputTimeSpec())) {
                setOutputTimeSpec(solverDescription.createOutputTimeSpec(this));
            }
            if (solverDescription.isNonSpatialStochasticSolver()) {
                if (fieldNonspatialStochOpt == null) {
                    setStochOpt(new NonspatialStochSimOptions());
                } else {
                    setStochOpt(new NonspatialStochSimOptions(fieldNonspatialStochOpt));
                }
                if (!solverDescription.equals(SolverDescription.StochGibson)) {
                    if (fieldNonspatialStochHybridOpt == null) {
                        setStochHybridOpt(new NonspatialStochHybridOptions());
                    }
                }
            } else if (solverDescription.isSpatialStochasticSolver()) {
                setTimeStep(TimeStep.getDefaultSmoldynTimeStep());
                if (smoldynSimulationOptions == null) {
                    smoldynSimulationOptions = new SmoldynSimulationOptions();
                }
            // setSmoldynDefaultTimeStep();
            }
            if (solverDescription.isNFSimSolver()) {
                if (nfsimSimulationOptions == null) {
                    nfsimSimulationOptions = new NFsimSimulationOptions();
                }
            }
            if (solverDescription.isChomboSolver()) {
                if (chomboSolverSpec == null && getSimulation() != null) {
                    chomboSolverSpec = new ChomboSolverSpec(ChomboSolverSpec.getDefaultMaxBoxSize(getSimulation().getMathDescription().getGeometry().getDimension()));
                }
                if (getOutputTimeSpec() == null || !(getOutputTimeSpec() instanceof UniformOutputTimeSpec)) {
                    double outputTime = getTimeBounds().getEndingTime() / 10;
                    setOutputTimeSpec(new UniformOutputTimeSpec(outputTime));
                }
                if (chomboSolverSpec != null && chomboSolverSpec.getTimeIntervalList().size() == 0) {
                    chomboSolverSpec.addTimeInterval(TimeInterval.getDefaultTimeInterval());
                }
            } else {
                chomboSolverSpec = null;
            }
            if (solverDescription.isMovingBoundarySolver()) {
                if (movingBoundarySolverOptions == null && getSimulation() != null) {
                    movingBoundarySolverOptions = new MovingBoundarySolverOptions();
                }
            } else {
                movingBoundarySolverOptions = null;
            }
        }
    } catch (PropertyVetoException e) {
        e.printStackTrace();
    }
}
Also used : PropertyVetoException(java.beans.PropertyVetoException) MovingBoundarySolverOptions(cbit.vcell.solvers.mb.MovingBoundarySolverOptions) ChomboSolverSpec(org.vcell.chombo.ChomboSolverSpec)

Example 5 with ChomboSolverSpec

use of org.vcell.chombo.ChomboSolverSpec in project vcell by virtualcell.

the class Xmlproducer method getXML.

/**
 * This method returns a XML representation of a SolverTaskDescription object.
 * Creation date: (3/2/2001 10:59:55 PM)
 * @return Element
 * @param param cbit.vcell.solver.SolverTaskDescription
 */
private Element getXML(SolverTaskDescription param) {
    Element solvertask = new Element(XMLTags.SolverTaskDescriptionTag);
    // Add Attributes
    if (param.getTaskType() == SolverTaskDescription.TASK_UNSTEADY) {
        solvertask.setAttribute(XMLTags.TaskTypeTag, XMLTags.UnsteadyTag);
    } else if (param.getTaskType() == SolverTaskDescription.TASK_STEADY) {
        solvertask.setAttribute(XMLTags.TaskTypeTag, XMLTags.SteadyTag);
    } else {
        throw new IllegalArgumentException("Unexpected task type:" + param.getTaskType());
    }
    // solvertask.setAttribute(XMLTags.KeepEveryTag, String.valueOf(param.getKeepEvery()));
    // solvertask.setAttribute(XMLTags.KeepAtMostTag, String.valueOf(param.getKeepAtMost()));
    solvertask.setAttribute(XMLTags.UseSymbolicJacobianAttrTag, String.valueOf(param.getUseSymbolicJacobian()));
    // Add timeBounds
    solvertask.addContent(getXML(param.getTimeBounds()));
    // Add timeStep
    solvertask.addContent(getXML(param.getTimeStep()));
    // Add ErrorTolerence
    solvertask.addContent(getXML(param.getErrorTolerance()));
    // Jan 8, 2016 (jim) let getXML(stochOpt) write out the correct stochastic options
    if (param.getStochOpt() != null) {
        solvertask.addContent(getXML(param.getStochOpt(), param.getStochHybridOpt()));
    }
    // Add OutputOptions
    solvertask.addContent(getXML(param.getOutputTimeSpec()));
    // Add sensitivityParameter
    if (param.getSensitivityParameter() != null) {
        solvertask.addContent(getXML(param.getSensitivityParameter()));
    }
    // Add solver name
    solvertask.setAttribute(XMLTags.SolverNameTag, param.getSolverDescription().getDatabaseName());
    // Stop At Spatially Uniform
    ErrorTolerance stopAtSpatiallyUniformErrorTolerance = param.getStopAtSpatiallyUniformErrorTolerance();
    if (stopAtSpatiallyUniformErrorTolerance != null) {
        Element element = new Element(XMLTags.StopAtSpatiallyUniform);
        element.addContent(getXML(stopAtSpatiallyUniformErrorTolerance));
        solvertask.addContent(element);
    }
    boolean bRunParameterScanSerially = param.isSerialParameterScan();
    if (bRunParameterScanSerially) {
        solvertask.setAttribute(XMLTags.RunParameterScanSerially, String.valueOf(bRunParameterScanSerially));
    }
    boolean bTimeoutSimulationDisabled = param.isTimeoutDisabled();
    if (bTimeoutSimulationDisabled) {
        solvertask.setAttribute(XMLTags.TimeoutSimulationDisabled, String.valueOf(bTimeoutSimulationDisabled));
    }
    boolean bBorderExtrapolationDisabled = param.isBorderExtrapolationDisabled();
    if (bBorderExtrapolationDisabled) {
        solvertask.setAttribute(XMLTags.BorderExtrapolationDisabled, String.valueOf(bBorderExtrapolationDisabled));
    }
    SmoldynSimulationOptions smoldynSimulationOptions = param.getSmoldynSimulationOptions();
    if (smoldynSimulationOptions != null) {
        solvertask.addContent(getXML(smoldynSimulationOptions));
    }
    NFsimSimulationOptions nfsimSimulationOptions = param.getNFSimSimulationOptions();
    if (nfsimSimulationOptions != null) {
        solvertask.addContent(getXML(nfsimSimulationOptions));
    }
    SundialsPdeSolverOptions sundialsPdeSolverOptions = param.getSundialsPdeSolverOptions();
    if (sundialsPdeSolverOptions != null) {
        solvertask.addContent(getXML(sundialsPdeSolverOptions));
    }
    ChomboSolverSpec chomboSolverSpec = param.getChomboSolverSpec();
    if (chomboSolverSpec != null) {
        Element chomboElement = getXML(chomboSolverSpec);
        solvertask.addContent(chomboElement);
    }
    MovingBoundarySolverOptions mb = param.getMovingBoundarySolverOptions();
    if (mb != null) {
        Element e = getXML(mb);
        solvertask.addContent(e);
    }
    Element numProcessors = new Element(XMLTags.NUM_PROCESSORS);
    numProcessors.setText(Integer.toString(param.getNumProcessors()));
    solvertask.addContent(numProcessors);
    return solvertask;
}
Also used : SmoldynSimulationOptions(cbit.vcell.solver.SmoldynSimulationOptions) NFsimSimulationOptions(cbit.vcell.solver.NFsimSimulationOptions) MovingBoundarySolverOptions(cbit.vcell.solvers.mb.MovingBoundarySolverOptions) SundialsPdeSolverOptions(cbit.vcell.solver.SundialsPdeSolverOptions) Element(org.jdom.Element) ErrorTolerance(cbit.vcell.solver.ErrorTolerance) ChomboSolverSpec(org.vcell.chombo.ChomboSolverSpec)

Aggregations

ChomboSolverSpec (org.vcell.chombo.ChomboSolverSpec)10 PropertyVetoException (java.beans.PropertyVetoException)5 MovingBoundarySolverOptions (cbit.vcell.solvers.mb.MovingBoundarySolverOptions)4 SolverTaskDescription (cbit.vcell.solver.SolverTaskDescription)3 Element (org.jdom.Element)3 Constant (cbit.vcell.math.Constant)2 Expression (cbit.vcell.parser.Expression)2 NFsimSimulationOptions (cbit.vcell.solver.NFsimSimulationOptions)2 Simulation (cbit.vcell.solver.Simulation)2 SmoldynSimulationOptions (cbit.vcell.solver.SmoldynSimulationOptions)2 SundialsPdeSolverOptions (cbit.vcell.solver.SundialsPdeSolverOptions)2 UniformOutputTimeSpec (cbit.vcell.solver.UniformOutputTimeSpec)2 ArrayList (java.util.ArrayList)2 RefinementRoi (org.vcell.chombo.RefinementRoi)2 ISize (org.vcell.util.ISize)2 ImageException (cbit.image.ImageException)1 VCImage (cbit.image.VCImage)1 VCImageUncompressed (cbit.image.VCImageUncompressed)1 VCPixelClass (cbit.image.VCPixelClass)1 AnalyticSubVolume (cbit.vcell.geometry.AnalyticSubVolume)1