Search in sources :

Example 1 with DomainType

use of org.vcell.sbmlsim.api.common.DomainType in project vcell by virtualcell.

the class SimulationServiceImpl method getVariableList.

@Override
public List<VariableInfo> getVariableList(SimulationInfo simInfo) throws Exception {
    SimulationServiceContext simServiceContext = sims.get(simInfo.getLocalId());
    if (simServiceContext == null) {
        throw new Exception("simulation results not found");
    }
    try {
        DataSetControllerImpl datasetController = getDataSetController(simServiceContext);
        OutputContext outputContext = new OutputContext(new AnnotatedFunction[0]);
        final DataIdentifier[] dataIdentifiers;
        try {
            dataIdentifiers = datasetController.getDataIdentifiers(outputContext, simServiceContext.vcDataIdentifier);
        } catch (IOException | DataAccessException e) {
            e.printStackTrace();
            throw new RuntimeException("failed to retrieve variable information: " + e.getMessage(), e);
        }
        ArrayList<VariableInfo> varInfos = new ArrayList<VariableInfo>();
        for (DataIdentifier dataIdentifier : dataIdentifiers) {
            final DomainType domainType;
            if (dataIdentifier.getVariableType().equals(VariableType.VOLUME)) {
                domainType = DomainType.VOLUME;
            } else if (dataIdentifier.getVariableType().equals(VariableType.MEMBRANE)) {
                domainType = DomainType.MEMBRANE;
            } else {
                continue;
            }
            String domainName = "";
            if (dataIdentifier.getDomain() != null) {
                domainName = dataIdentifier.getDomain().getName();
            }
            VariableInfo varInfo = new VariableInfo(dataIdentifier.getName(), dataIdentifier.getDisplayName(), domainName, domainType);
            varInfos.add(varInfo);
        }
        return varInfos;
    } catch (Exception e) {
        e.printStackTrace();
        throw new Exception("failed to retrieve variable list: " + e.getMessage());
    }
}
Also used : VCSimulationDataIdentifier(cbit.vcell.solver.VCSimulationDataIdentifier) DataIdentifier(cbit.vcell.simdata.DataIdentifier) VariableInfo(org.vcell.sbmlsim.api.common.VariableInfo) ArrayList(java.util.ArrayList) IOException(java.io.IOException) XMLStreamException(javax.xml.stream.XMLStreamException) SbmlException(org.vcell.sbml.SbmlException) SBMLException(org.sbml.jsbml.SBMLException) XmlParseException(cbit.vcell.xml.XmlParseException) SolverException(cbit.vcell.solver.SolverException) IOException(java.io.IOException) DataAccessException(org.vcell.util.DataAccessException) OutputContext(cbit.vcell.simdata.OutputContext) DomainType(org.vcell.sbmlsim.api.common.DomainType) DataSetControllerImpl(cbit.vcell.simdata.DataSetControllerImpl) DataAccessException(org.vcell.util.DataAccessException)

Aggregations

DataIdentifier (cbit.vcell.simdata.DataIdentifier)1 DataSetControllerImpl (cbit.vcell.simdata.DataSetControllerImpl)1 OutputContext (cbit.vcell.simdata.OutputContext)1 SolverException (cbit.vcell.solver.SolverException)1 VCSimulationDataIdentifier (cbit.vcell.solver.VCSimulationDataIdentifier)1 XmlParseException (cbit.vcell.xml.XmlParseException)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 SBMLException (org.sbml.jsbml.SBMLException)1 SbmlException (org.vcell.sbml.SbmlException)1 DomainType (org.vcell.sbmlsim.api.common.DomainType)1 VariableInfo (org.vcell.sbmlsim.api.common.VariableInfo)1 DataAccessException (org.vcell.util.DataAccessException)1