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);
}
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*/
});
}
}
Aggregations