Search in sources :

Example 61 with VCSimulationIdentifier

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

the class TopLevelWindowManager method prepareDocumentToLoad.

public void prepareDocumentToLoad(VCDocument doc, boolean bInNewWindow) throws Exception {
    if (doc instanceof BioModel) {
        Simulation[] simulations = ((BioModel) doc).getSimulations();
        ArrayList<VCSimulationIdentifier> simIDs = new ArrayList<VCSimulationIdentifier>();
        for (int i = 0; i < simulations.length; i++) {
            SimulationInfo simulationInfo = simulations[i].getSimulationInfo();
            if (simulationInfo != null) {
                simIDs.add(simulationInfo.getAuthoritativeVCSimulationIdentifier());
            }
        }
        RequestManager rm = getRequestManager();
        ConnectionStatus stat = rm.getConnectionStatus();
        if (stat.getStatus() == ConnectionStatus.CONNECTED) {
            rm.getDocumentManager().preloadSimulationStatus(simIDs.toArray(new VCSimulationIdentifier[0]));
        }
    } else if (doc instanceof MathModel) {
        Geometry geometry = ((MathModel) doc).getMathDescription().getGeometry();
        geometry.precomputeAll(new GeometryThumbnailImageFactoryAWT());
        Simulation[] simulations = ((MathModel) doc).getSimulations();
        // VCSimulationIdentifier simIDs[] = new VCSimulationIdentifier[simulations.length];
        ArrayList<VCSimulationIdentifier> simIDs = new ArrayList<>();
        for (int i = 0; i < simulations.length; i++) {
            if (simulations[i].getSimulationInfo() != null) {
                simIDs.add(simulations[i].getSimulationInfo().getAuthoritativeVCSimulationIdentifier());
            }
        }
        getRequestManager().getDocumentManager().preloadSimulationStatus(simIDs.toArray(new VCSimulationIdentifier[0]));
    } else if (doc instanceof Geometry) {
        ((Geometry) doc).precomputeAll(new GeometryThumbnailImageFactoryAWT());
    }
}
Also used : VCSimulationIdentifier(cbit.vcell.solver.VCSimulationIdentifier) MathModel(cbit.vcell.mathmodel.MathModel) ArrayList(java.util.ArrayList) Geometry(cbit.vcell.geometry.Geometry) GeometryThumbnailImageFactoryAWT(cbit.vcell.geometry.GeometryThumbnailImageFactoryAWT) Simulation(cbit.vcell.solver.Simulation) BioModel(cbit.vcell.biomodel.BioModel) ConnectionStatus(cbit.vcell.client.server.ConnectionStatus) SimulationInfo(cbit.vcell.solver.SimulationInfo)

Example 62 with VCSimulationIdentifier

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

the class VCellClientDataServiceImpl method displayPostProcessingDataInVCell.

@Override
public void displayPostProcessingDataInVCell(SimulationDataSetRef simulationDataSetRef) throws NumberFormatException, DataAccessException {
    User vcUser = vcellClient.getRequestManager().getDocumentManager().getUser();
    VCSimulationIdentifier vcSimId = new VCSimulationIdentifier(new KeyValue(simulationDataSetRef.getSimId()), vcUser);
    ClientDocumentManager clientDocumentManager = (ClientDocumentManager) vcellClient.getClientServerManager().getDocumentManager();
    SimulationOwner simulationOwner = null;
    if (simulationDataSetRef.isMathModel) {
        simulationOwner = clientDocumentManager.getMathModel(new KeyValue(simulationDataSetRef.getModelId()));
    } else {
        BioModel bioModel = clientDocumentManager.getBioModel(new KeyValue(simulationDataSetRef.getModelId()));
        simulationOwner = bioModel.getSimulationContext(simulationDataSetRef.getSimulationContextName());
    }
    ArrayList<AnnotatedFunction> outputFunctionsList = simulationOwner.getOutputFunctionContext().getOutputFunctionsList();
    OutputContext outputContext = new OutputContext(outputFunctionsList.toArray(new AnnotatedFunction[outputFunctionsList.size()]));
    VCSimulationDataIdentifier vcSimDataId = new VCSimulationDataIdentifier(vcSimId, simulationDataSetRef.getJobIndex());
    PDEDataManager pdeDataManager = (PDEDataManager) vcellClient.getRequestManager().getDataManager(outputContext, vcSimDataId, true);
    final ClientPDEDataContext newClientPDEDataContext = pdeDataManager.getPDEDataContext();
    // this was the code before the windows refactoring; appears to just always get the first window???
    // Enumeration<TopLevelWindowManager> windowManagers = vcellClient.getMdiManager().getWindowManagers();
    // final Window window = FindWindow.getWindow(windowManagers.nextElement().getComponent());
    Optional<TopLevelWindowManager> first = vcellClient.getMdiManager().getWindowManagers().stream().findFirst();
    VCAssert.assertTrue(first.isPresent(), "window manager not present?");
    final Window window = getWindow(first.get().getComponent());
    AsynchClientTask task = new AsynchClientTask("Display Post Processing Statistics", AsynchClientTask.TASKTYPE_SWING_NONBLOCKING, false, false) {

        @Override
        public void run(Hashtable<String, Object> hashTable) throws Exception {
            DataProcessingResultsPanel dataProcessingResultsPanel = new DataProcessingResultsPanel();
            dataProcessingResultsPanel.update(newClientPDEDataContext);
            DialogUtils.showComponentOKCancelDialog(window, dataProcessingResultsPanel, "Post Processing Statistics");
        }
    };
    Hashtable<String, Object> hash = new Hashtable<String, Object>();
    Vector<AsynchClientTask> tasksV = new Vector<AsynchClientTask>();
    tasksV.add(task);
    AsynchClientTask[] tasks = new AsynchClientTask[tasksV.size()];
    tasksV.copyInto(tasks);
    ClientTaskDispatcher.dispatch(window, hash, tasks, true);
}
Also used : Window(java.awt.Window) VCSimulationIdentifier(cbit.vcell.solver.VCSimulationIdentifier) AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) User(org.vcell.util.document.User) KeyValue(org.vcell.util.document.KeyValue) TopLevelWindowManager(cbit.vcell.client.TopLevelWindowManager) Hashtable(java.util.Hashtable) ClientDocumentManager(cbit.vcell.clientdb.ClientDocumentManager) VCSimulationDataIdentifier(cbit.vcell.solver.VCSimulationDataIdentifier) LocalVCSimulationDataIdentifier(cbit.vcell.client.ClientSimManager.LocalVCSimulationDataIdentifier) OutputContext(cbit.vcell.simdata.OutputContext) SimulationOwner(cbit.vcell.solver.SimulationOwner) PDEDataManager(cbit.vcell.simdata.PDEDataManager) BioModel(cbit.vcell.biomodel.BioModel) ClientPDEDataContext(cbit.vcell.simdata.ClientPDEDataContext) Vector(java.util.Vector) AnnotatedFunction(cbit.vcell.solver.AnnotatedFunction)

Example 63 with VCSimulationIdentifier

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

the class VCellClientDataServiceImpl method getVCSimulationDataIdentifier.

public VCSimulationDataIdentifier getVCSimulationDataIdentifier(SimulationDataSetRef simulationDataSetRef) throws FileNotFoundException {
    User user = new User(simulationDataSetRef.getUsername(), new KeyValue(simulationDataSetRef.getUserkey()));
    KeyValue simKeyValue = new KeyValue(simulationDataSetRef.getSimId());
    VCSimulationIdentifier vcSimulationIdentifier = new VCSimulationIdentifier(simKeyValue, user);
    if (simulationDataSetRef.isIsLocal()) {
        File primaryDir = ResourceUtil.getLocalRootDir();
        DataSetControllerImpl dataSetControllerImpl = new DataSetControllerImpl(null, primaryDir, null);
        ExportServiceImpl localExportServiceImpl = new ExportServiceImpl();
        LocalDataSetControllerProvider localDSCProvider = new LocalDataSetControllerProvider(user, dataSetControllerImpl, localExportServiceImpl);
        VCDataManager vcDataManager = new VCDataManager(localDSCProvider);
        File localSimDir = ResourceUtil.getLocalSimDir(User.tempUser.getName());
        VCSimulationDataIdentifier simulationDataIdentifier = new LocalVCSimulationDataIdentifier(vcSimulationIdentifier, 0, localSimDir);
        return simulationDataIdentifier;
    } else {
        VCSimulationDataIdentifier vcSimulationDataIdentifier = new VCSimulationDataIdentifier(vcSimulationIdentifier, simulationDataSetRef.getJobIndex());
        return vcSimulationDataIdentifier;
    }
}
Also used : LocalDataSetControllerProvider(cbit.vcell.client.LocalDataSetControllerProvider) VCSimulationIdentifier(cbit.vcell.solver.VCSimulationIdentifier) User(org.vcell.util.document.User) KeyValue(org.vcell.util.document.KeyValue) LocalVCSimulationDataIdentifier(cbit.vcell.client.ClientSimManager.LocalVCSimulationDataIdentifier) DataSetControllerImpl(cbit.vcell.simdata.DataSetControllerImpl) ExportServiceImpl(cbit.vcell.export.server.ExportServiceImpl) File(java.io.File) VCDataManager(cbit.vcell.simdata.VCDataManager) VCSimulationDataIdentifier(cbit.vcell.solver.VCSimulationDataIdentifier) LocalVCSimulationDataIdentifier(cbit.vcell.client.ClientSimManager.LocalVCSimulationDataIdentifier)

Example 64 with VCSimulationIdentifier

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

the class ApplicationComponents method cleanSimWindowsHash.

/**
 * Remove server side sim results windows that are no longer in use
 */
public void cleanSimWindowsHash() {
    Iterator<Entry<VCSimulationIdentifier, SimulationWindow>> iter = simulationWindowsHash.entrySet().iterator();
    while (iter.hasNext()) {
        Entry<VCSimulationIdentifier, SimulationWindow> es = iter.next();
        SimulationWindow sw = es.getValue();
        if (!sw.isShowingLocalSimulation()) {
            VCSimulationIdentifier vcsid = es.getKey();
            Simulation[] sims = simulationWorkspace.getSimulations();
            boolean bFound = false;
            for (int i = 0; i < sims.length; i += 1) {
                if (sims[i].getSimulationInfo() != null && sims[i].getSimulationInfo().getAuthoritativeVCSimulationIdentifier().equals(vcsid)) {
                    bFound = true;
                    break;
                }
            }
            if (!bFound) {
                iter.remove();
            }
        }
    }
}
Also used : Entry(java.util.Map.Entry) VCSimulationIdentifier(cbit.vcell.solver.VCSimulationIdentifier) Simulation(cbit.vcell.solver.Simulation) SimulationWindow(cbit.vcell.client.desktop.simulation.SimulationWindow)

Aggregations

VCSimulationIdentifier (cbit.vcell.solver.VCSimulationIdentifier)64 KeyValue (org.vcell.util.document.KeyValue)41 VCSimulationDataIdentifier (cbit.vcell.solver.VCSimulationDataIdentifier)31 User (org.vcell.util.document.User)26 File (java.io.File)19 Simulation (cbit.vcell.solver.Simulation)17 BigString (org.vcell.util.BigString)15 BioModel (cbit.vcell.biomodel.BioModel)13 UserLoginInfo (org.vcell.util.document.UserLoginInfo)11 Hashtable (java.util.Hashtable)10 ObjectNotFoundException (org.vcell.util.ObjectNotFoundException)10 SimulationJobStatus (cbit.vcell.server.SimulationJobStatus)9 DataSetControllerImpl (cbit.vcell.simdata.DataSetControllerImpl)9 DataAccessException (org.vcell.util.DataAccessException)9 SQLException (java.sql.SQLException)8 FileNotFoundException (java.io.FileNotFoundException)7 VCDataIdentifier (org.vcell.util.document.VCDataIdentifier)7 VCMessageSession (cbit.vcell.message.VCMessageSession)6 OutputContext (cbit.vcell.simdata.OutputContext)6 AnnotatedFunction (cbit.vcell.solver.AnnotatedFunction)6