Search in sources :

Example 6 with PDEDataContext

use of cbit.vcell.simdata.PDEDataContext in project vcell by virtualcell.

the class PDEExportDataPanel method setPdeDataContext.

public void setPdeDataContext(PDEDataContext pdeDataContext, ExportSpecs.SimNameSimDataID currentSimNameSimDataID) {
    // currentSimNameSimDataID 2 states
    // 1.  with ExportSpecs.ExportParamScanInfo
    // 2.  without ExportSpecs.ExportParamScanInfo
    this.currentSimNameSimDataID = currentSimNameSimDataID;
    PDEDataContext oldValue = fieldPdeDataContext;
    fieldPdeDataContext = pdeDataContext;
    firePropertyChange(PDEDataContext.PROP_PDE_DATA_CONTEXT, oldValue, pdeDataContext);
}
Also used : ClientPDEDataContext(cbit.vcell.simdata.ClientPDEDataContext) PDEDataContext(cbit.vcell.simdata.PDEDataContext)

Example 7 with PDEDataContext

use of cbit.vcell.simdata.PDEDataContext in project vcell by virtualcell.

the class SimResultsViewer method updateScanParamChoices.

private void updateScanParamChoices(final String message, ListReset listReset) {
    if ((paramScanChoiceTimer = ClientTaskDispatcher.getBlockingTimer(this, null, null, paramScanChoiceTimer, new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e2) {
            updateScanParamChoices(message, listReset);
        }
    }, message)) != null) {
        return;
    }
    int selectedJobIndex = getSelectedParamScanJobIndex();
    // update viewer
    if (selectedJobIndex == -1) {
        if (isODEData) {
            if (listReset != null && odeDataViewer != null && odeDataViewer.getVcDataIdentifier() != null) {
                listReset.reset(odeDataViewer.getVcDataIdentifier());
            } else {
                odeDataViewer.setOdeSolverResultSet(null);
            }
        } else {
            if (listReset != null && pdeDataViewer != null && pdeDataViewer.getPdeDataContext() != null && pdeDataViewer.getPdeDataContext().getVCDataIdentifier() != null) {
                listReset.reset(pdeDataViewer.getPdeDataContext().getVCDataIdentifier());
            } else {
                pdeDataViewer.setPdeDataContext(null);
            }
        }
        return;
    }
    final VCSimulationDataIdentifier vcdid = new VCSimulationDataIdentifier(getSimulation().getSimulationInfo().getAuthoritativeVCSimulationIdentifier(), selectedJobIndex);
    if (isODEData) {
        AsynchClientTask task1 = new AsynchClientTask("get ode results", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

            @Override
            public void run(Hashtable<String, Object> hashTable) throws Exception {
                ODEDataManager odeDatamanager = ((ODEDataManager) dataManager).createNewODEDataManager(vcdid);
                hashTable.put("odeDatamanager", odeDatamanager);
            }
        };
        AsynchClientTask task2 = new AsynchClientTask("show results", AsynchClientTask.TASKTYPE_SWING_BLOCKING, false, false) {

            @Override
            public void run(Hashtable<String, Object> hashTable) throws Exception {
                if (hashTable.get(ClientTaskDispatcher.TASK_ABORTED_BY_ERROR) == null) {
                    ODEDataManager odeDatamanager = (ODEDataManager) hashTable.get("odeDatamanager");
                    odeDataViewer.setOdeSolverResultSet(odeDatamanager.getODESolverResultSet());
                    odeDataViewer.setVcDataIdentifier(vcdid);
                } else {
                    odeDataViewer.setOdeSolverResultSet(null);
                }
            }
        };
        ClientTaskDispatcher.dispatch(this, new Hashtable<String, Object>(), new AsynchClientTask[] { task1, task2 });
    } else {
        AsynchClientTask task1 = new AsynchClientTask("get pde results", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

            @Override
            public void run(Hashtable<String, Object> hashTable) throws Exception {
                PDEDataManager pdeDatamanager = ((PDEDataManager) dataManager).createNewPDEDataManager(vcdid, null);
                PDEDataContext newPDEDC = pdeDatamanager.getPDEDataContext();
                PDEDataContext oldPDEDC = pdeDataViewer.getPdeDataContext();
                hashTable.put("newPDEDC", newPDEDC);
                if (oldPDEDC != null && oldPDEDC.getTimePoints().length <= newPDEDC.getTimePoints().length) {
                    DataIdentifier setDid = (newPDEDC.getDataIdentifier() == null ? newPDEDC.getDataIdentifiers()[0] : newPDEDC.getDataIdentifier());
                    if (Arrays.asList(newPDEDC.getDataIdentifiers()).contains(oldPDEDC.getDataIdentifier())) {
                        setDid = oldPDEDC.getDataIdentifier();
                        newPDEDC.setVariableAndTime(setDid, newPDEDC.getTimePoints()[BeanUtils.firstIndexOf(oldPDEDC.getTimePoints(), oldPDEDC.getTimePoint())]);
                    }
                }
            }
        };
        AsynchClientTask task2 = new AsynchClientTask("show results", AsynchClientTask.TASKTYPE_SWING_BLOCKING, false, false) {

            @Override
            public void run(Hashtable<String, Object> hashTable) throws Exception {
                if (hashTable.get(ClientTaskDispatcher.TASK_ABORTED_BY_ERROR) == null) {
                    ClientPDEDataContext newPDEDC = (ClientPDEDataContext) hashTable.get("newPDEDC");
                    pdeDataViewer.setPdeDataContext(newPDEDC);
                    pdeDataViewer.setSimNameSimDataID(new ExportSpecs.SimNameSimDataID(getSimulation().getName(), getSimulation().getSimulationInfo().getAuthoritativeVCSimulationIdentifier(), SimResultsViewer.getParamScanInfo(getSimulation(), vcdid.getJobIndex())));
                } else {
                    if (listReset != null && pdeDataViewer != null && pdeDataViewer.getPdeDataContext() != null && pdeDataViewer.getPdeDataContext().getVCDataIdentifier() != null) {
                        listReset.reset(pdeDataViewer.getPdeDataContext().getVCDataIdentifier());
                    } else {
                        pdeDataViewer.setPdeDataContext(null);
                        pdeDataViewer.setSimNameSimDataID(null);
                    }
                }
            }
        };
        // AsynchClientTask refreshTask = new AsynchClientTask("",AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
        // @Override
        // public void run(Hashtable<String, Object> hashTable) throws Exception {
        // ((ArrayList<AsynchClientTask>)hashTable.get(ClientTaskDispatcher.INTERMEDIATE_TASKS)).addAll(Arrays.asList(pdeDataViewer.getRefreshTasks()));
        // }
        // };
        ClientTaskDispatcher.dispatch(this, new Hashtable<String, Object>(), new AsynchClientTask[] { task1, task2 /*,refreshTask*/
        });
    }
}
Also used : PDEDataContext(cbit.vcell.simdata.PDEDataContext) ClientPDEDataContext(cbit.vcell.simdata.ClientPDEDataContext) AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) VCDataIdentifier(org.vcell.util.document.VCDataIdentifier) VCSimulationDataIdentifier(cbit.vcell.solver.VCSimulationDataIdentifier) DataIdentifier(cbit.vcell.simdata.DataIdentifier) ActionEvent(java.awt.event.ActionEvent) Hashtable(java.util.Hashtable) ExportSpecs(cbit.vcell.export.server.ExportSpecs) VCSimulationDataIdentifier(cbit.vcell.solver.VCSimulationDataIdentifier) ActionListener(java.awt.event.ActionListener) PDEDataManager(cbit.vcell.simdata.PDEDataManager) ODEDataManager(cbit.vcell.simdata.ODEDataManager) ClientPDEDataContext(cbit.vcell.simdata.ClientPDEDataContext)

Aggregations

PDEDataContext (cbit.vcell.simdata.PDEDataContext)7 ClientPDEDataContext (cbit.vcell.simdata.ClientPDEDataContext)5 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)3 Hashtable (java.util.Hashtable)3 ImageException (cbit.image.ImageException)2 ExportSpecs (cbit.vcell.export.server.ExportSpecs)2 PDEDataManager (cbit.vcell.simdata.PDEDataManager)2 PropertyVetoException (java.beans.PropertyVetoException)2 DataAccessException (org.vcell.util.DataAccessException)2 UserCancelException (org.vcell.util.UserCancelException)2 ExternalDataIdentifier (org.vcell.util.document.ExternalDataIdentifier)2 VCDataIdentifier (org.vcell.util.document.VCDataIdentifier)2 DisplayPreferences (cbit.image.DisplayPreferences)1 ImageSizeInfo (cbit.image.ImageSizeInfo)1 VCImage (cbit.image.VCImage)1 VCPixelClass (cbit.image.VCPixelClass)1 ExportEvent (cbit.rmi.event.ExportEvent)1 ImageDataset (cbit.vcell.VirtualMicroscopy.ImageDataset)1 PostProcessDataPDEDataContext (cbit.vcell.client.data.PDEDataViewerPostProcess.PostProcessDataPDEDataContext)1 ChooseFile (cbit.vcell.client.task.ChooseFile)1