Search in sources :

Example 31 with AnnotatedFunction

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

the class ClientTaskManager method copyApplication.

public static AsynchClientTask[] copyApplication(final JComponent requester, final BioModel bioModel, final SimulationContext simulationContext, final boolean bSpatial, final SimulationContext.Application appType) {
    // get valid application name
    String newApplicationName = null;
    String baseName = "Copy of " + simulationContext.getName();
    int count = 0;
    while (true) {
        if (count == 0) {
            newApplicationName = baseName;
        } else {
            newApplicationName = baseName + " " + count;
        }
        if (bioModel.getSimulationContext(newApplicationName) == null) {
            break;
        }
        count++;
    }
    final String newName = newApplicationName;
    AsynchClientTask task1 = new AsynchClientTask("preparing to copy", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

        @Override
        public void run(Hashtable<String, Object> hashTable) throws Exception {
            SimulationContext newSimulationContext = SimulationContext.copySimulationContext(simulationContext, newName, bSpatial, appType);
            newSimulationContext.getGeometry().precomputeAll(new GeometryThumbnailImageFactoryAWT());
            if (newSimulationContext.isSameTypeAs(simulationContext)) {
                MathMappingCallback callback = new MathMappingCallbackTaskAdapter(getClientTaskStatusSupport());
                String oldHash = simulationContext.getMd5hash();
                BNGOutputSpec oldSpec = simulationContext.getMostRecentlyCreatedOutputSpec();
                if (oldHash != null && oldSpec != null) {
                    // Warning: the results from "Edit / Test Constraints" are never cached because we want to repeatedly run it
                    // even if nothing changed
                    newSimulationContext.setMd5hash(oldHash);
                    newSimulationContext.setMostRecentlyCreatedOutputSpec(oldSpec);
                    newSimulationContext.setInsufficientIterations(simulationContext.isInsufficientIterations());
                    newSimulationContext.setInsufficientMaxMolecules(simulationContext.isInsufficientMaxMolecules());
                }
                newSimulationContext.refreshMathDescription(callback, NetworkGenerationRequirements.ComputeFullStandardTimeout);
            }
            hashTable.put("newSimulationContext", newSimulationContext);
        }
    };
    AsynchClientTask task2 = new AsynchClientTask("copying application and simulations", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

        @Override
        public void run(Hashtable<String, Object> hashTable) throws Exception {
            SimulationContext newSimulationContext = (SimulationContext) hashTable.get("newSimulationContext");
            bioModel.addSimulationContext(newSimulationContext);
            if (newSimulationContext.isSameTypeAs(simulationContext)) {
                // copy simulations to new simContext
                for (Simulation sim : simulationContext.getSimulations()) {
                    Simulation clonedSimulation = new Simulation(sim, false);
                    clonedSimulation.setMathDescription(newSimulationContext.getMathDescription());
                    clonedSimulation.setName(simulationContext.getBioModel().getFreeSimulationName());
                    newSimulationContext.addSimulation(clonedSimulation);
                }
                // copy output functions to new simContext
                ArrayList<AnnotatedFunction> outputFunctions = simulationContext.getOutputFunctionContext().getOutputFunctionsList();
                ArrayList<AnnotatedFunction> newOutputFunctions = new ArrayList<AnnotatedFunction>();
                for (AnnotatedFunction afn : outputFunctions) {
                    newOutputFunctions.add(new AnnotatedFunction(afn));
                }
                newSimulationContext.getOutputFunctionContext().setOutputFunctions(newOutputFunctions);
            } else {
                if (simulationContext.getSimulations().length > 0) {
                    DialogUtils.showWarningDialog(requester, "Simulations are not copied because new application is of different type.");
                }
            }
        }
    };
    return new AsynchClientTask[] { task1, task2 };
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) MathMappingCallbackTaskAdapter(cbit.vcell.mapping.MathMappingCallbackTaskAdapter) MathMappingCallback(cbit.vcell.mapping.SimulationContext.MathMappingCallback) Hashtable(java.util.Hashtable) ArrayList(java.util.ArrayList) SimulationContext(cbit.vcell.mapping.SimulationContext) BNGOutputSpec(cbit.vcell.bionetgen.BNGOutputSpec) GeometryThumbnailImageFactoryAWT(cbit.vcell.geometry.GeometryThumbnailImageFactoryAWT) Simulation(cbit.vcell.solver.Simulation) AnnotatedFunction(cbit.vcell.solver.AnnotatedFunction)

Example 32 with AnnotatedFunction

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

the class FieldDataWindowManager method viewData.

public void viewData(final ExternalDataIdentifier eDI) {
    ChildWindowManager childWindowManager = ChildWindowManager.findChildWindowManager(getComponent());
    if (eDI != null && eDI.equals(currentlyViewedEDI) && childWindowManager != null && childWindowManager.getChildWindowFromContext(eDI) != null) {
        childWindowManager.getChildWindowFromContext(eDI).show();
    } else {
        if (currentlyViewedOutputFunctionViewer != null) {
            if (getLocalRequestManager() != null && getLocalRequestManager().getAsynchMessageManager() != null) {
                getLocalRequestManager().getAsynchMessageManager().removeDataJobListener(currentlyViewedOutputFunctionViewer.getPDEDataViewer());
            }
            if (currentlyViewedOutputFunctionViewer != null) {
                currentlyViewedOutputFunctionViewer.getPDEDataViewer().getPdeDataContext().removePropertyChangeListener(this);
            }
        }
        if (currentlyViewedOutputFunctionViewer != null) {
            ChildWindow childWindow = childWindowManager.getChildWindowFromContext(eDI);
            if (childWindow != null) {
                childWindow.close();
            }
        }
        currentlyViewedEDI = null;
        currentlyViewedOutputFunctionViewer = null;
        if (eDI == null) {
            return;
        }
        AsynchClientTask task1 = new AsynchClientTask("retrieve data", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

            @Override
            public void run(Hashtable<String, Object> hashTable) throws Exception {
                ClientPDEDataContext newPDEDataContext = getPDEDataContext(eDI, new OutputContext(new AnnotatedFunction[0]));
                hashTable.put("newPDEDataContext", newPDEDataContext);
            }
        };
        AsynchClientTask task2 = new AsynchClientTask("show data", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

            @Override
            public void run(Hashtable<String, Object> hashTable) throws Exception {
                try {
                    PDEDataViewer currentlyViewedPDEDV = new PDEDataViewer();
                    ClientPDEDataContext newPDEDataContext = (ClientPDEDataContext) hashTable.get("newPDEDataContext");
                    currentlyViewedPDEDV.setPdeDataContext(newPDEDataContext);
                    newPDEDataContext.addPropertyChangeListener(FieldDataWindowManager.this);
                    getLocalRequestManager().getAsynchMessageManager().addDataJobListener(currentlyViewedPDEDV);
                    currentlyViewedOutputFunctionViewer = new OutputFunctionViewer(currentlyViewedPDEDV, FieldDataWindowManager.this, eDI);
                    DataViewerManager dvm = new DataViewerManager() {

                        public void dataJobMessage(DataJobEvent event) {
                        }

                        public void exportMessage(ExportEvent event) {
                        }

                        public void addDataListener(DataListener newListener) {
                        }

                        public UserPreferences getUserPreferences() {
                            return getRequestManager().getUserPreferences();
                        }

                        public void removeDataListener(DataListener newListener) {
                        }

                        public void startExport(Component requester, OutputContext outputContext, ExportSpecs exportSpecs) {
                            getLocalRequestManager().startExport(outputContext, requester, exportSpecs);
                        }

                        public void simStatusChanged(SimStatusEvent simStatusEvent) {
                        }

                        public User getUser() {
                            return getRequestManager().getDocumentManager().getUser();
                        }

                        public RequestManager getRequestManager() {
                            return FieldDataWindowManager.this.getRequestManager();
                        }
                    };
                    try {
                        currentlyViewedPDEDV.setDataViewerManager(dvm);
                    } catch (PropertyVetoException e) {
                        e.printStackTrace();
                    }
                    ChildWindowManager childWindowManager = ChildWindowManager.findChildWindowManager(getComponent());
                    currentlyViewedEDI = eDI;
                    ChildWindow childWindow = childWindowManager.addChildWindow(currentlyViewedOutputFunctionViewer, currentlyViewedEDI, "Field Data Viewer (" + eDI.getName() + ")");
                    childWindow.setSize(600, 500);
                    childWindow.setIsCenteredOnParent();
                    childWindow.show();
                } catch (Exception e) {
                    if (currentlyViewedOutputFunctionViewer != null) {
                        if (getLocalRequestManager() != null && getLocalRequestManager().getAsynchMessageManager() != null) {
                            getLocalRequestManager().getAsynchMessageManager().removeDataJobListener(currentlyViewedOutputFunctionViewer.getPDEDataViewer());
                        }
                        if (currentlyViewedOutputFunctionViewer != null) {
                            currentlyViewedOutputFunctionViewer.getPDEDataViewer().getPdeDataContext().removePropertyChangeListener(FieldDataWindowManager.this);
                        }
                    }
                    throw e;
                }
            }
        };
        ClientTaskDispatcher.dispatch(this.getComponent(), new Hashtable<String, Object>(), new AsynchClientTask[] { task1, task2 }, false);
    }
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) Hashtable(java.util.Hashtable) ExportEvent(cbit.rmi.event.ExportEvent) ExportSpecs(cbit.vcell.export.server.ExportSpecs) ChildWindow(cbit.vcell.client.ChildWindowManager.ChildWindow) OutputContext(cbit.vcell.simdata.OutputContext) PropertyVetoException(java.beans.PropertyVetoException) DataAccessException(org.vcell.util.DataAccessException) UserCancelException(org.vcell.util.UserCancelException) PropertyVetoException(java.beans.PropertyVetoException) DataJobEvent(cbit.rmi.event.DataJobEvent) SimStatusEvent(cbit.vcell.client.server.SimStatusEvent) ClientPDEDataContext(cbit.vcell.simdata.ClientPDEDataContext) DataListener(cbit.vcell.simdata.DataListener) Component(java.awt.Component) PDEDataViewer(cbit.vcell.client.data.PDEDataViewer) AnnotatedFunction(cbit.vcell.solver.AnnotatedFunction)

Example 33 with AnnotatedFunction

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

the class SimResultsViewerController method propertyChange.

public void propertyChange(PropertyChangeEvent evt) {
    // update functions
    if (simResultsViewer != null && evt.getPropertyName().equals("outputFunctions")) {
        try {
            ArrayList<AnnotatedFunction> outputFunctionsList = (ArrayList<AnnotatedFunction>) evt.getNewValue();
            dataManager.setOutputContext(new OutputContext(outputFunctionsList.toArray(new AnnotatedFunction[outputFunctionsList.size()])));
            simResultsViewer.refreshFunctions();
        } catch (Exception e) {
            e.printStackTrace();
            DialogUtils.showErrorDialog(simResultsViewer, "Failed to update viewer after function change: " + e.getMessage(), e);
        }
    }
}
Also used : ArrayList(java.util.ArrayList) OutputContext(cbit.vcell.simdata.OutputContext) DataAccessException(org.vcell.util.DataAccessException) AnnotatedFunction(cbit.vcell.solver.AnnotatedFunction)

Example 34 with AnnotatedFunction

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

the class TestingFrameworkWindowManager method compare.

/**
 * Insert the method's description here.
 * Creation date: (1/20/2003 11:52:18 AM)
 * @return boolean
 * @param mathDesc cbit.vcell.math.MathDescription
 */
public void compare(final TestCriteriaNew testCriteria, final SimulationInfo userDefinedRegrSimInfo) {
    final String KEY_MERGEDDATAINFO = "KEY_MERGEDDATAINFO";
    final String KEY_MERGEDDATASETVIEWERCNTRLR = "KEY_MERGEDDATASETVIEWERCNTRLR";
    AsynchClientTask gatherDataTask = new AsynchClientTask("Gathering compare Dta...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

        @Override
        public void run(Hashtable<String, Object> hashTable) throws Exception {
            // create the merged data for the simulationInfo in testCriteria and the regression simInfo
            SimulationInfo simInfo = testCriteria.getSimInfo();
            SimulationInfo regrSimInfo = null;
            if (userDefinedRegrSimInfo != null) {
                regrSimInfo = userDefinedRegrSimInfo;
            } else {
                regrSimInfo = testCriteria.getRegressionSimInfo();
            }
            if (regrSimInfo == null) {
                return;
            }
            VCDataIdentifier vcSimId1 = new VCSimulationDataIdentifier(simInfo.getAuthoritativeVCSimulationIdentifier(), 0);
            VCDataIdentifier vcSimId2 = new VCSimulationDataIdentifier(regrSimInfo.getAuthoritativeVCSimulationIdentifier(), 0);
            User user = simInfo.getOwner();
            VCDataIdentifier[] vcIdentifierArray = new VCDataIdentifier[] { vcSimId2, vcSimId1 };
            MergedDataInfo mergedDataInfo = new MergedDataInfo(user, vcIdentifierArray, MergedDataInfo.createDefaultPrefixNames(vcIdentifierArray.length));
            hashTable.put(KEY_MERGEDDATAINFO, mergedDataInfo);
            // get the data manager and wire it up
            // 
            // get all "Data1.XXX" data identifiers ... and remove those which are functions
            // add functions of the form DIFF_XXX = (Data1.XXX - Data2.XXX) for convenience in comparing results.
            // 
            Simulation sim1 = ((ClientDocumentManager) getRequestManager().getDocumentManager()).getSimulation(simInfo);
            Simulation sim2 = ((ClientDocumentManager) getRequestManager().getDocumentManager()).getSimulation(regrSimInfo);
            boolean isSpatial = sim1.isSpatial();
            if (sim2.isSpatial() != isSpatial) {
                throw new RuntimeException("Cannot compare spatial and non-spatial data sets : " + simInfo + "& " + regrSimInfo);
            }
            DataManager mergedDataManager = getRequestManager().getDataManager(null, mergedDataInfo, isSpatial);
            DataManager data1Manager = getRequestManager().getDataManager(null, vcSimId1, isSpatial);
            DataManager data2Manager = getRequestManager().getDataManager(null, vcSimId2, isSpatial);
            Vector<AnnotatedFunction> functionList = new Vector<AnnotatedFunction>();
            AnnotatedFunction[] data1Functions = data1Manager.getFunctions();
            AnnotatedFunction[] existingFunctions = mergedDataManager.getFunctions();
            DataIdentifier[] data1Identifiers = data1Manager.getDataIdentifiers();
            DataIdentifier[] data2Identifiers = data2Manager.getDataIdentifiers();
            for (int i = 0; i < data1Identifiers.length; i++) {
                // 
                // make sure dataIdentifier is not already a function
                // 
                boolean bIsFunction = false;
                for (int j = 0; j < data1Functions.length; j++) {
                    if (data1Identifiers[i].getName().equals(data1Functions[j].getName())) {
                        bIsFunction = true;
                    }
                }
                if (bIsFunction) {
                    continue;
                }
                // 
                // make sure corresponding identifier exists in "Data2"
                // 
                boolean bIsInData2 = false;
                for (int j = 0; j < data2Identifiers.length; j++) {
                    if (data2Identifiers[j].getName().equals(data1Identifiers[i].getName())) {
                        bIsInData2 = true;
                    }
                }
                if (!bIsInData2) {
                    continue;
                }
                // 
                // create "Diff" function
                // 
                String data1Name = "Data1." + data1Identifiers[i].getName();
                String data2Name = "Data2." + data1Identifiers[i].getName();
                String functionName = "DIFF_" + data1Identifiers[i].getName();
                VariableType varType = data1Identifiers[i].getVariableType();
                Expression exp = new Expression(data1Name + "-" + data2Name);
                AnnotatedFunction newFunction = new AnnotatedFunction(functionName, exp, data1Identifiers[i].getDomain(), "", varType, FunctionCategory.OUTPUTFUNCTION);
                // 
                // make sure new "Diff" function isn't already in existing function list.
                // 
                boolean bDiffFunctionAlreadyHere = false;
                for (int j = 0; j < existingFunctions.length; j++) {
                    if (newFunction.getName().equals(existingFunctions[j].getName())) {
                        bDiffFunctionAlreadyHere = true;
                    }
                }
                if (bDiffFunctionAlreadyHere) {
                    continue;
                }
                functionList.add(newFunction);
            }
            OutputContext outputContext = null;
            if (functionList.size() > 0) {
                AnnotatedFunction[] newDiffFunctions = (AnnotatedFunction[]) BeanUtils.getArray(functionList, AnnotatedFunction.class);
                outputContext = new OutputContext(newDiffFunctions);
            }
            MergedDatasetViewerController mergedDatasetViewerCtr = getRequestManager().getMergedDatasetViewerController(outputContext, mergedDataInfo, !isSpatial);
            hashTable.put(KEY_MERGEDDATASETVIEWERCNTRLR, mergedDatasetViewerCtr);
        }
    };
    AsynchClientTask showResultsTask = new AsynchClientTask("Showing Compare Results", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

        @Override
        public void run(Hashtable<String, Object> hashTable) throws Exception {
            // make the viewer
            MergedDatasetViewerController mergedDatasetViewerCtr = (MergedDatasetViewerController) hashTable.get(KEY_MERGEDDATASETVIEWERCNTRLR);
            addDataListener(mergedDatasetViewerCtr);
            DataViewer viewer = mergedDatasetViewerCtr.createViewer();
            viewer.setDataViewerManager(TestingFrameworkWindowManager.this);
            addExportListener(viewer);
            VCDataIdentifier vcDataIdentifier = (MergedDataInfo) hashTable.get(KEY_MERGEDDATAINFO);
            ChildWindowManager childWindowManager = TFWFinder.findChildWindowManager(getComponent());
            ChildWindow childWindow = childWindowManager.addChildWindow(viewer, vcDataIdentifier, "Comparing ... " + vcDataIdentifier.getID());
            childWindow.pack();
            // childWindow.setSize(450, 450);
            childWindow.setIsCenteredOnParent();
            childWindow.show();
        }
    };
    ClientTaskDispatcher.dispatch(getComponent(), new Hashtable<String, Object>(), new AsynchClientTask[] { gatherDataTask, showResultsTask }, false);
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) User(org.vcell.util.document.User) VCSimulationDataIdentifier(cbit.vcell.solver.VCSimulationDataIdentifier) VCDataIdentifier(org.vcell.util.document.VCDataIdentifier) DataIdentifier(cbit.vcell.simdata.DataIdentifier) ClientDocumentManager(cbit.vcell.clientdb.ClientDocumentManager) MergedDataInfo(cbit.vcell.simdata.MergedDataInfo) DataViewer(cbit.vcell.client.data.DataViewer) Vector(java.util.Vector) MergedDatasetViewerController(cbit.vcell.client.data.MergedDatasetViewerController) AnnotatedFunction(cbit.vcell.solver.AnnotatedFunction) VariableType(cbit.vcell.math.VariableType) Hashtable(java.util.Hashtable) PDEDataManager(cbit.vcell.simdata.PDEDataManager) ODEDataManager(cbit.vcell.simdata.ODEDataManager) DataManager(cbit.vcell.simdata.DataManager) VCSimulationDataIdentifier(cbit.vcell.solver.VCSimulationDataIdentifier) ChildWindow(cbit.vcell.client.ChildWindowManager.ChildWindow) OutputContext(cbit.vcell.simdata.OutputContext) Simulation(cbit.vcell.solver.Simulation) Expression(cbit.vcell.parser.Expression) VCDataIdentifier(org.vcell.util.document.VCDataIdentifier) SimulationInfo(cbit.vcell.solver.SimulationInfo)

Example 35 with AnnotatedFunction

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

the class PDEDataViewer method calcAutoAllTimes.

private void calcAutoAllTimes() throws Exception {
    HashSet<String> stateVarNames = null;
    Variable theVariable = null;
    boolean bStateVar = true;
    boolean isFieldData = getPdeDataContext().getVCDataIdentifier() instanceof ExternalDataIdentifier || getPdeDataContext().getVCDataIdentifier() instanceof MergedDataInfo;
    if (isFieldData) {
        // fielddata
        DataIdentifier[] dataids = getPdeDataContext().getDataIdentifiers();
        stateVarNames = new HashSet<>();
        for (int i = 0; i < dataids.length; i++) {
            if (!dataids[i].isFunction()) {
                stateVarNames.add(dataids[i].getName());
            }
        // System.out.println("name:'"+dataids[i].getName()+"' type:"+dataids[i].getVariableType()+" func:"+dataids[i].isFunction());
        }
        bStateVar = !getPdeDataContext().getDataIdentifier().isFunction();
        if (bStateVar) {
            theVariable = new VolVariable(getPdeDataContext().getDataIdentifier().getName(), getPdeDataContext().getDataIdentifier().getDomain());
        } else {
            AnnotatedFunction[] funcs = getPdeDataContext().getFunctions();
            for (int i = 0; i < funcs.length; i++) {
                if (funcs[i].getName().equals(getPdeDataContext().getDataIdentifier().getName())) {
                    theVariable = funcs[i];
                    break;
                }
            }
        }
    } else {
        stateVarNames = getSimulation().getMathDescription().getStateVariableNames();
        theVariable = getSimulation().getMathDescription().getVariable(getPdeDataContext().getVariableName());
        if (theVariable == null) {
            theVariable = ((ClientPDEDataContext) getPdeDataContext()).getDataManager().getOutputContext().getOutputFunction(getPdeDataContext().getVariableName());
        }
        if (theVariable == null) {
            DataProcessingOutputInfo dataProcessingOutputInfo = DataProcessingResultsPanel.getDataProcessingOutputInfo(getPdeDataContext());
            if (dataProcessingOutputInfo != null && Arrays.asList(dataProcessingOutputInfo.getVariableNames()).contains(getPdeDataContext().getVariableName())) {
                // PostProcess Variable
                return;
            }
        }
        bStateVar = stateVarNames.contains(getPdeDataContext().getVariableName());
    }
    if (theVariable == null) {
        throw new Exception("Unexpected Alltimes... selected variable '" + getPdeDataContext().getVariableName() + "' is not stateVariable or OutputFunction");
    }
    if (getPDEDataContextPanel1().getdisplayAdapterService1().getAllTimes()) {
        // min-max over all timepoints (allTimes)
        if (theVariable.isConstant()) {
            getPDEDataContextPanel1().getdisplayAdapterServicePanel1().changeAllTimesButtonText(DisplayAdapterServicePanel.ALL_TIMES__STATE_TEXT);
            double constVal = theVariable.getExpression().evaluateConstant();
            getPDEDataContextPanel1().setFunctionStatisticsRange(new Range(constVal, constVal));
        } else if (bStateVar) {
            getPDEDataContextPanel1().getdisplayAdapterServicePanel1().changeAllTimesButtonText(DisplayAdapterServicePanel.ALL_TIMES__STATE_TEXT);
            ArrayList<VarStatistics> varStatsArr = calcVarStat(getPdeDataContext(), new String[] { theVariable.getName() });
            if (errorAutoAllTimes(varStatsArr != null, (varStatsArr == null ? null : varStatsArr.size() > 0), isFieldData)) {
                // no postprocessinfo
                return;
            }
            FunctionStatistics functionStatistics = new FunctionStatistics(varStatsArr.get(0).minValuesOverTime, varStatsArr.get(0).maxValuesOverTime);
            getPDEDataContextPanel1().setFunctionStatisticsRange(new Range(functionStatistics.getMinOverTime(), functionStatistics.getMaxOverTime()));
        } else if (theVariable instanceof Function) {
            getPDEDataContextPanel1().getdisplayAdapterServicePanel1().changeAllTimesButtonText(DisplayAdapterServicePanel.ALL_TIMES__APPROX_TEXT);
            Function flattened = MathDescription.getFlattenedFunctions(SimulationSymbolTable.createMathSymbolTableFactory(), getSimulation().getMathDescription(), new String[] { theVariable.getName() })[0];
            if (flattened == null) {
                flattened = (Function) theVariable;
            }
            ArrayList<VarStatistics> varStatsArr = calcVarStat(getPdeDataContext(), stateVarNames.toArray(new String[0]));
            if (errorAutoAllTimes(varStatsArr != null, (varStatsArr == null ? null : varStatsArr.size() > 0), isFieldData)) {
                // check for no postprocessinfo
                return;
            }
            if (varStatsArr.size() == stateVarNames.size()) {
                if (getSimulation().getMeshSpecification().getGeometry().getGeometrySurfaceDescription().getRegionImage() == null) {
                    getSimulation().getMeshSpecification().getGeometry().getGeometrySurfaceDescription().updateAll();
                }
                FunctionStatistics functionStatistics = FunctionRangeGenerator.getFunctionStatistics(flattened.getExpression(), varStatsArr.toArray(new VarStatistics[0]), getPdeDataContext().getTimePoints(), getPdeDataContext().getCartesianMesh(), calcInDomainBitSet(), getPdeDataContext().getDataIdentifier().getVariableType());
                getPDEDataContextPanel1().setFunctionStatisticsRange(new Range(functionStatistics.getMinOverTime(), functionStatistics.getMaxOverTime()));
            } else {
                throw new Exception("Unexpectede AllTimes... calculated state var stats size != mathdescr state var size");
            }
        } else {
            throw new Exception("Unexpected AllTimes... not constant, stateVar or function");
        }
    } else {
        // min-max at each timepoint (currTime)
        if (!(theVariable instanceof Function)) {
            getPDEDataContextPanel1().getdisplayAdapterServicePanel1().changeAllTimesButtonText(DisplayAdapterServicePanel.ALL_TIMES__STATE_TEXT);
        } else {
            getPDEDataContextPanel1().getdisplayAdapterServicePanel1().changeAllTimesButtonText(DisplayAdapterServicePanel.ALL_TIMES__APPROX_TEXT);
        }
        getPDEDataContextPanel1().setFunctionStatisticsRange(null);
    }
}
Also used : VolVariable(cbit.vcell.math.VolVariable) ReservedVariable(cbit.vcell.math.ReservedVariable) Variable(cbit.vcell.math.Variable) VCSimulationDataIdentifier(cbit.vcell.solver.VCSimulationDataIdentifier) LocalVCSimulationDataIdentifier(cbit.vcell.client.ClientSimManager.LocalVCSimulationDataIdentifier) ExternalDataIdentifier(org.vcell.util.document.ExternalDataIdentifier) VCDataIdentifier(org.vcell.util.document.VCDataIdentifier) DataIdentifier(cbit.vcell.simdata.DataIdentifier) VolVariable(cbit.vcell.math.VolVariable) ArrayList(java.util.ArrayList) Range(org.vcell.util.Range) Point(java.awt.Point) SinglePoint(cbit.vcell.geometry.SinglePoint) DataAccessException(org.vcell.util.DataAccessException) PropertyVetoException(java.beans.PropertyVetoException) ImageException(cbit.image.ImageException) UserCancelException(org.vcell.util.UserCancelException) MergedDataInfo(cbit.vcell.simdata.MergedDataInfo) AnnotatedFunction(cbit.vcell.solver.AnnotatedFunction) Function(cbit.vcell.math.Function) VarStatistics(cbit.vcell.util.FunctionRangeGenerator.VarStatistics) DataProcessingOutputInfo(cbit.vcell.simdata.DataOperationResults.DataProcessingOutputInfo) ExternalDataIdentifier(org.vcell.util.document.ExternalDataIdentifier) AnnotatedFunction(cbit.vcell.solver.AnnotatedFunction) FunctionStatistics(cbit.vcell.util.FunctionRangeGenerator.FunctionStatistics)

Aggregations

AnnotatedFunction (cbit.vcell.solver.AnnotatedFunction)61 DataAccessException (org.vcell.util.DataAccessException)21 ExpressionException (cbit.vcell.parser.ExpressionException)20 Expression (cbit.vcell.parser.Expression)17 ArrayList (java.util.ArrayList)17 Simulation (cbit.vcell.solver.Simulation)15 IOException (java.io.IOException)15 OutputContext (cbit.vcell.simdata.OutputContext)14 MathException (cbit.vcell.math.MathException)12 VCDataIdentifier (org.vcell.util.document.VCDataIdentifier)12 SimulationContext (cbit.vcell.mapping.SimulationContext)11 ExpressionBindingException (cbit.vcell.parser.ExpressionBindingException)10 DataIdentifier (cbit.vcell.simdata.DataIdentifier)9 VCSimulationDataIdentifier (cbit.vcell.solver.VCSimulationDataIdentifier)9 FileNotFoundException (java.io.FileNotFoundException)8 Domain (cbit.vcell.math.Variable.Domain)7 VariableType (cbit.vcell.math.VariableType)7 XmlParseException (cbit.vcell.xml.XmlParseException)7 PropertyVetoException (java.beans.PropertyVetoException)7 File (java.io.File)7