use of cbit.vcell.mapping.SimulationContext in project vcell by virtualcell.
the class SimulationListPanel method quickRun.
/*
private void particleView() {
int row = getScrollPaneTable().getSelectedRow();
if (row < 0) {
return;
}
Simulation selectedSim = getSimulationListTableModel1().getValueAt(row);
getSimulationWorkspace().getClientSimManager().runSmoldynParticleView(selectedSim);
}
*/
private void quickRun(ViewerType viewerType) {
int row = getScrollPaneTable().getSelectedRow();
if (row < 0) {
return;
}
activateConsole();
Simulation selectedSim = getSimulationListTableModel1().getValueAt(row);
SolverDescription solverDescription = selectedSim.getSolverTaskDescription().getSolverDescription();
if (solverDescription.equals(SolverDescription.FiniteVolume)) {
if (getSimulationWorkspace().getSimulationOwner() instanceof SimulationContext) {
String option = DialogUtils.showOKCancelWarningDialog(SimulationListPanel.this, "Deprecated Solver", VCellErrorMessages.getSemiFVSolverCompiledSolverDeprecated(selectedSim));
if (option.equals(SimpleUserMessage.OPTION_CANCEL)) {
return;
}
try {
selectedSim.getSolverTaskDescription().setSolverDescription(SolverDescription.FiniteVolumeStandalone);
selectedSim.setIsDirty(true);
} catch (PropertyVetoException e) {
e.printStackTrace();
}
}
}
getSimulationWorkspace().getClientSimManager().runQuickSimulation(selectedSim, viewerType);
}
use of cbit.vcell.mapping.SimulationContext in project vcell by virtualcell.
the class SimulationListPanel method newSimulation.
/**
* Comment
*/
private void newSimulation(final NetworkGenerationRequirements networkGenerationRequirements) {
AsynchClientTask task1 = new AsynchClientTask("new simulation", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
MathMappingCallback mathMappingCallback = new MathMappingCallbackTaskAdapter(getClientTaskStatusSupport());
if (getSimulationWorkspace().getSimulationOwner() instanceof SimulationContext) {
SimulationContext simulationContext = (SimulationContext) getSimulationWorkspace().getSimulationOwner();
simulationContext.refreshMathDescription(mathMappingCallback, networkGenerationRequirements);
}
}
};
AsynchClientTask task2 = new AsynchClientTask("new simulation", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
MathMappingCallback mathMappingCallback = new MathMappingCallbackTaskAdapter(getClientTaskStatusSupport());
int newSimIndex = getSimulationWorkspace().newSimulation(SimulationListPanel.this, mathMappingCallback, networkGenerationRequirements);
getScrollPaneTable().getSelectionModel().setSelectionInterval(newSimIndex, newSimIndex);
getScrollPaneTable().scrollRectToVisible(getScrollPaneTable().getCellRect(newSimIndex, 0, true));
}
};
ClientTaskDispatcher.dispatch(this, new Hashtable<String, Object>(), new AsynchClientTask[] { task1, task2 });
}
use of cbit.vcell.mapping.SimulationContext in project vcell by virtualcell.
the class SimulationListPanel method massConservationButtonAdjust.
private void massConservationButtonAdjust() {
if (fieldSimulationWorkspace != null && fieldSimulationWorkspace.getSimulationOwner() instanceof SimulationContext) {
SimulationContext simContext = (SimulationContext) fieldSimulationWorkspace.getSimulationOwner();
if (simContext.getGeometry().getDimension() == 0 && simContext.getApplicationType() == SimulationContext.Application.NETWORK_DETERMINISTIC) {
getMassConservationModelReductionCheckBox().setVisible(true);
getMassConservationModelReductionCheckBox().setEnabled(true);
getMassConservationModelReductionCheckBox().setSelected(simContext.isUsingMassConservationModelReduction());
getMassConservationModelReductionHelpButton().setVisible(true);
getMassConservationModelReductionHelpButton().setEnabled(true);
} else {
getMassConservationModelReductionCheckBox().setVisible(false);
getMassConservationModelReductionHelpButton().setVisible(false);
}
} else {
getMassConservationModelReductionCheckBox().setVisible(false);
getMassConservationModelReductionHelpButton().setVisible(false);
}
}
use of cbit.vcell.mapping.SimulationContext in project vcell by virtualcell.
the class SimulationListPanel method runSimulations.
/**
* Comment
*/
private void runSimulations() {
if (User.isGuest(getSimulationWorkspace().getLoggedInUser().getName())) {
DialogUtils.showErrorDialog(this, User.createGuestErrorMessage("runVCellServerSimulations"));
return;
}
final ArrayList<Simulation> simList = new ArrayList<Simulation>();
int[] selections = getScrollPaneTable().getSelectedRows();
for (int i = 0; i < selections.length; i++) {
Simulation sim = (Simulation) (ivjSimulationListTableModel1.getValueAt(selections[i]));
if (sim.getSolverTaskDescription().getSolverDescription().equals(SolverDescription.FiniteVolume)) {
if (getSimulationWorkspace().getSimulationOwner() instanceof SimulationContext) {
String option = DialogUtils.showOKCancelWarningDialog(SimulationListPanel.this, "Deprecated Solver", VCellErrorMessages.getSemiFVSolverCompiledSolverDeprecated(sim));
if (option.equals(SimpleUserMessage.OPTION_CANCEL)) {
return;
}
try {
sim.getSolverTaskDescription().setSolverDescription(SolverDescription.FiniteVolumeStandalone);
sim.setIsDirty(true);
} catch (PropertyVetoException e) {
e.printStackTrace();
}
}
}
simList.add(sim);
}
if (simList.size() > 0) {
activateConsole();
Simulation[] toRun = simList.toArray(new Simulation[0]);
try {
getSimulationWorkspace().runSimulations(toRun, this);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
DialogUtils.showErrorDialog(this, e.getMessage());
}
}
}
use of cbit.vcell.mapping.SimulationContext in project vcell by virtualcell.
the class ImageJHelper method populateDesktopIJModelInfos.
private static void populateDesktopIJModelInfos(IJDocType docType, ArrayList<KeyValue> openVCDocumentVersionKeys, ArrayList<IJModelInfo> modelInfos) {
if (VCellClientTest.getVCellClient() == null) {
return;
}
Collection<TopLevelWindowManager> windowManagers = VCellClientTest.getVCellClient().getMdiManager().getWindowManagers();
for (TopLevelWindowManager topLevelWindowManager : windowManagers) {
if (topLevelWindowManager instanceof DocumentWindowManager) {
DocumentWindowManager documentWindowManager = (DocumentWindowManager) topLevelWindowManager;
VCDocument.VCDocumentType currDocType = documentWindowManager.getVCDocument().getDocumentType();
if (currDocType == docType.getVCDocType()) {
if (documentWindowManager.getVCDocument().getVersion() != null && documentWindowManager.getVCDocument().getVersion().getVersionKey() != null) {
openVCDocumentVersionKeys.add(documentWindowManager.getVCDocument().getVersion().getVersionKey());
} else {
ArrayList<IJContextInfo> ijContextInfos = new ArrayList<>();
if (documentWindowManager instanceof BioModelWindowManager) {
for (SimulationContext simulationContext : ((BioModelWindowManager) documentWindowManager).getBioModel().getSimulationContexts()) {
addSimToIJContextInfo(ijContextInfos, simulationContext.getName(), simulationContext.getMathType(), simulationContext.getGeometryContext().getGeometry().getDimension(), simulationContext.getGeometry().getName(), simulationContext.getSimulations());
}
modelInfos.add(new IJModelInfo(documentWindowManager.getVCDocument().getName(), null, IJDocType.bm, true, (documentWindowManager.getUser() == null ? null : documentWindowManager.getUser().getName()), null, ijContextInfos));
} else if (documentWindowManager instanceof MathModelWindowManager) {
MathModel mathModel = ((MathModelWindowManager) documentWindowManager).getMathModel();
addSimToIJContextInfo(ijContextInfos, null, mathModel.getMathDescription().getMathType(), mathModel.getGeometry().getDimension(), mathModel.getGeometry().getName(), ((MathModelWindowManager) documentWindowManager).getSimulationWorkspace().getSimulations());
modelInfos.add(new IJModelInfo(documentWindowManager.getVCDocument().getName(), null, IJDocType.mm, true, (documentWindowManager.getUser() == null ? null : documentWindowManager.getUser().getName()), null, ijContextInfos));
}
}
}
}
}
}
Aggregations