use of org.vcell.vcellij.api.DomainType in project vcell by virtualcell.
the class SimulationServiceImpl method getVariableList.
public List<VariableInfo> getVariableList(SimulationInfo simInfo) throws ThriftDataAccessException, TException {
SimulationServiceContext simServiceContext = sims.get(simInfo.id);
if (simServiceContext == null) {
throw new ThriftDataAccessException("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 ThriftDataAccessException("failed to retrieve variable list: " + e.getMessage());
}
}
Aggregations