Search in sources :

Example 1 with SimNameSimDataID

use of cbit.vcell.export.server.ExportSpecs.SimNameSimDataID in project vcell by virtualcell.

the class PDEExportDataPanel method createSimulationSelector.

private ExportSpecs.SimulationSelector createSimulationSelector() {
    ExportSpecs.SimulationSelector simulationSelector = new ExportSpecs.SimulationSelector() {

        private ExportSpecs.SimNameSimDataID[] multiSimNameSimDataIDs;

        // private ExportSpecs.ExportParamScanInfo exportParamScanInfo;
        private int[] selectedParamScanIndexes;

        private Simulation[] simulations;

        public SimNameSimDataID[] getSelectedSimDataInfo() {
            // }
            if (multiSimNameSimDataIDs == null) {
                return new ExportSpecs.SimNameSimDataID[] { currentSimNameSimDataID };
            }
            return multiSimNameSimDataIDs;
        }

        public void selectSimulations() {
            getNumAvailableSimulations();
            String[][] rowData = new String[simulations.length][5];
            for (int i = 0; i < rowData.length; i++) {
                rowData[i][0] = simulations[i].getName();
                rowData[i][1] = simulations[i].getMeshSpecification().getSamplingSize().toString();
                rowData[i][2] = simulations[i].getSolverTaskDescription().getExpectedNumTimePoints() + "";
                rowData[i][3] = simulations[i].getSolverTaskDescription().getTimeBounds().getEndingTime() + "";
                rowData[i][4] = simulations[i].getSolverTaskDescription().getOutputTimeSpec().getShortDescription();
            }
            try {
                int[] choices = DialogUtils.showComponentOKCancelTableList(PDEExportDataPanel.this, "Choose Sims to export together", new String[] { "Simulation", "Mesh x,y,z", "NumTimePoints", "EndTime", "Output Descr." }, rowData, ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
                if (choices != null) {
                    multiSimNameSimDataIDs = new ExportSpecs.SimNameSimDataID[choices.length];
                    for (int i = 0; i < choices.length; i++) {
                        multiSimNameSimDataIDs[i] = new ExportSpecs.SimNameSimDataID(simulations[choices[i]].getName(), simulations[choices[i]].getSimulationInfo().getAuthoritativeVCSimulationIdentifier(), SimResultsViewer.getParamScanInfo(simulations[choices[i]], (currentSimNameSimDataID == null ? 0 : currentSimNameSimDataID.getDefaultJobIndex())));
                    }
                }
            } catch (UserCancelException uce) {
            // ignore
            }
        }

        public void selectParamScanInfo() {
            String[][] rowData = new String[currentSimNameSimDataID.getExportParamScanInfo().getParamScanJobIndexes().length][currentSimNameSimDataID.getExportParamScanInfo().getParamScanConstantNames().length];
            for (int i = 0; i < rowData.length; i++) {
                for (int j = 0; j < rowData[i].length; j++) {
                    rowData[i][j] = currentSimNameSimDataID.getExportParamScanInfo().getParamScanConstantValues()[i][j];
                }
            }
            try {
                int[] choices = DialogUtils.showComponentOKCancelTableList(PDEExportDataPanel.this, "Choose ParameterScans to export together", currentSimNameSimDataID.getExportParamScanInfo().getParamScanConstantNames(), rowData, ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
                if (choices != null && choices.length > 0) {
                    selectedParamScanIndexes = new int[choices.length];
                    // String[][] selectedParamScanValues = new String[choices.length][currentSimNameSimDataID.getExportParamScanInfo().getParamScanConstantNames().length];
                    for (int i = 0; i < choices.length; i++) {
                        selectedParamScanIndexes[i] = choices[i];
                    // for (int j = 0; j < currentSimNameSimDataID.getExportParamScanInfo().getParamScanConstantNames().length; j++) {
                    // selectedParamScanValues[i][j] = currentSimNameSimDataID.getExportParamScanInfo().getParamScanConstantValues()[choices[i]][j];
                    // }
                    }
                // exportParamScanInfo =
                // new ExportSpecs.ExportParamScanInfo(selectedParamScanIndexes, selectedParamScanIndexes[0], currentSimNameSimDataID.getExportParamScanInfo().getParamScanConstantNames(), selectedParamScanValues);
                } else {
                    selectedParamScanIndexes = null;
                }
            } catch (UserCancelException uce) {
            // ignore
            }
        }

        public int[] getselectedParamScanIndexes() {
            return selectedParamScanIndexes;
        }

        public int getNumAvailableParamScans() {
            if (currentSimNameSimDataID == null || currentSimNameSimDataID.getExportParamScanInfo() == null) {
                return 0;
            }
            return currentSimNameSimDataID.getExportParamScanInfo().getParamScanJobIndexes().length;
        }

        public int getNumAvailableSimulations() {
            if (simulations == null) {
                VCDocument thisDocument = (getDataViewerManager() instanceof DocumentWindowManager ? ((DocumentWindowManager) getDataViewerManager()).getVCDocument() : null);
                if (thisDocument instanceof BioModel) {
                    String thisSimContextName = dataInfoProvider.getSimulationModelInfo().getContextName();
                    SimulationContext[] simContexts = ((BioModel) thisDocument).getSimulationContexts();
                    SimulationContext thisSimulationContext = null;
                    for (int i = 0; i < simContexts.length; i++) {
                        if (thisSimContextName.equals(thisDocument.getName() + "::" + simContexts[i].getName())) {
                            thisSimulationContext = simContexts[i];
                            break;
                        }
                    }
                    simulations = thisSimulationContext.getSimulations();
                } else if (thisDocument instanceof MathModel) {
                    simulations = ((MathModel) thisDocument).getSimulations();
                } else {
                    simulations = new Simulation[0];
                }
            }
            return simulations.length;
        }
    };
    return simulationSelector;
}
Also used : MathModel(cbit.vcell.mathmodel.MathModel) VCDocument(org.vcell.util.document.VCDocument) ExportSpecs(cbit.vcell.export.server.ExportSpecs) UserCancelException(org.vcell.util.UserCancelException) SimulationContext(cbit.vcell.mapping.SimulationContext) SimNameSimDataID(cbit.vcell.export.server.ExportSpecs.SimNameSimDataID) Simulation(cbit.vcell.solver.Simulation) SimNameSimDataID(cbit.vcell.export.server.ExportSpecs.SimNameSimDataID) DocumentWindowManager(cbit.vcell.client.DocumentWindowManager) BioModel(cbit.vcell.biomodel.BioModel)

Aggregations

BioModel (cbit.vcell.biomodel.BioModel)1 DocumentWindowManager (cbit.vcell.client.DocumentWindowManager)1 ExportSpecs (cbit.vcell.export.server.ExportSpecs)1 SimNameSimDataID (cbit.vcell.export.server.ExportSpecs.SimNameSimDataID)1 SimulationContext (cbit.vcell.mapping.SimulationContext)1 MathModel (cbit.vcell.mathmodel.MathModel)1 Simulation (cbit.vcell.solver.Simulation)1 UserCancelException (org.vcell.util.UserCancelException)1 VCDocument (org.vcell.util.document.VCDocument)1