use of org.vcell.util.DataAccessException in project vcell by virtualcell.
the class DataSetControllerImpl method doDataOperation.
public DataOperationResults doDataOperation(DataOperation dataOperation) throws DataAccessException {
VCDataJobID vcDataJobID = null;
try {
if (dataOperation instanceof DataOperation.DataProcessingOutputTimeSeriesOP) {
vcDataJobID = ((DataOperation.DataProcessingOutputTimeSeriesOP) dataOperation).getTimeSeriesJobSpec().getVcDataJobID();
}
if (!(getVCData(dataOperation.getVCDataIdentifier()) instanceof SimulationData)) {
return null;
}
File dataProcessingOutputFileHDF5 = ((SimulationData) getVCData(dataOperation.getVCDataIdentifier())).getDataProcessingOutputSourceFileHDF5();
DataOperationResults dataOperationResults = getDataProcessingOutput(dataOperation, dataProcessingOutputFileHDF5);
if (vcDataJobID != null) {
fireDataJobEventIfNecessary(vcDataJobID, MessageEvent.DATA_COMPLETE, dataOperation.getVCDataIdentifier(), new Double(0), ((DataOperationResults.DataProcessingOutputTimeSeriesValues) dataOperationResults).getTimeSeriesJobResults(), null);
}
return dataOperationResults;
} catch (Exception e) {
if (vcDataJobID != null) {
fireDataJobEventIfNecessary(vcDataJobID, MessageEvent.DATA_FAILURE, dataOperation.getVCDataIdentifier(), new Double(0), null, e);
}
if (e instanceof DataAccessException) {
throw (DataAccessException) e;
} else {
throw new DataAccessException("Datasetcontrollerimpl.doDataOperation error: " + e.getMessage(), e);
}
}
}
use of org.vcell.util.DataAccessException in project vcell by virtualcell.
the class DataSetControllerImpl method getEmptyVtuMeshFiles.
public VtuFileContainer getEmptyVtuMeshFiles(ComsolSimFiles comsolSimFiles, VCDataIdentifier vcdataID, int timeIndex) throws DataAccessException {
try {
if (timeIndex > 0) {
throw new RuntimeException("only time index 0 supported for comsol vtk mesh files");
}
ComsolVtkFileWriter comsolVTKFileWriter = new ComsolVtkFileWriter();
File primaryDirectory = getPrimaryUserDir(vcdataID.getOwner(), false);
VtuFileContainer vtuFiles = comsolVTKFileWriter.getEmptyVtuMeshFiles(comsolSimFiles, primaryDirectory);
return vtuFiles;
} catch (Exception e) {
lg.error(e.getMessage(), e);
throw new DataAccessException("failed to retrieve VTK files: " + e.getMessage(), e);
}
}
use of org.vcell.util.DataAccessException in project vcell by virtualcell.
the class DataSetControllerImpl method getFunction.
public AnnotatedFunction getFunction(OutputContext outputContext, VCDataIdentifier vcdID, String variableName) throws DataAccessException {
try {
VCData vcData = getVCData(vcdID);
AnnotatedFunction annotatedFunction = vcData.getFunction(outputContext, variableName);
checkFieldDataExists(annotatedFunction, vcdID.getOwner());
return annotatedFunction;
} catch (IOException e) {
lg.error(e.getMessage(), e);
throw new DataAccessException(e.getMessage());
}
}
use of org.vcell.util.DataAccessException in project vcell by virtualcell.
the class DataSetControllerImpl method getVtuMeshData.
public double[] getVtuMeshData(ChomboFiles chomboFiles, OutputContext outputContext, VCDataIdentifier vcdataID, VtuVarInfo var, double time) throws DataAccessException {
try {
double[] times = getDataSetTimes(vcdataID);
int timeIndex = -1;
for (int i = 0; i < times.length; i++) {
if (times[i] == time) {
timeIndex = i;
break;
}
}
if (timeIndex < 0) {
throw new DataAccessException("data for dataset " + vcdataID + " not found at time " + time);
}
ChomboVtkFileWriter chomboVTKFileWriter = new ChomboVtkFileWriter();
double[] vtuData = chomboVTKFileWriter.getVtuMeshData(chomboFiles, outputContext, getUserDataDirectory(vcdataID), time, var, timeIndex);
return vtuData;
} catch (Exception e) {
lg.error(e.getMessage(), e);
throw new DataAccessException("failed to retrieve VTK files: " + e.getMessage(), e);
}
}
use of org.vcell.util.DataAccessException in project vcell by virtualcell.
the class DataSetControllerImpl method getVtuMeshData.
public double[] getVtuMeshData(ComsolSimFiles comsolSimFiles, OutputContext outputContext, VCDataIdentifier vcdataID, VtuVarInfo var, double time) throws DataAccessException {
try {
double[] times = getVtuTimes(comsolSimFiles, vcdataID);
int timeIndex = -1;
for (int i = 0; i < times.length; i++) {
if (times[i] == time) {
timeIndex = i;
break;
}
}
if (timeIndex < 0) {
throw new DataAccessException("data for dataset " + vcdataID + " not found at time " + time);
}
ComsolVtkFileWriter comsolVTKFileWriter = new ComsolVtkFileWriter();
double[] vtuData = comsolVTKFileWriter.getVtuMeshData(comsolSimFiles, outputContext, getUserDataDirectory(vcdataID), time, var, timeIndex);
return vtuData;
} catch (Exception e) {
lg.error(e.getMessage(), e);
throw new DataAccessException("failed to retrieve VTK files: " + e.getMessage(), e);
}
}
Aggregations