use of org.vcell.vis.mapping.chombo.ChomboVtkFileWriter 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.vis.mapping.chombo.ChomboVtkFileWriter in project vcell by virtualcell.
the class DataSetControllerImpl method getEmptyVtuMeshFiles.
public VtuFileContainer getEmptyVtuMeshFiles(ChomboFiles chomboFiles, VCDataIdentifier vcdataID, int timeIndex) throws DataAccessException {
try {
if (timeIndex > 0) {
throw new RuntimeException("only time index 0 supported for chombo vtk mesh files");
}
ChomboVtkFileWriter chomboVTKFileWriter = new ChomboVtkFileWriter();
File primaryDirectory = getPrimaryUserDir(vcdataID.getOwner(), false);
VtuFileContainer vtuFiles = chomboVTKFileWriter.getEmptyVtuMeshFiles(chomboFiles, 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.vis.mapping.chombo.ChomboVtkFileWriter in project vcell by virtualcell.
the class RasterExporter method makeVTKUnstructuredData_Chombo.
public ExportOutput[] makeVTKUnstructuredData_Chombo(OutputContext outputContext, final JobRequest jobRequest, User user, DataServerImpl dataServerImpl, ExportSpecs exportSpecs, File tmpDir, FileDataContainerManager fileDataContainerManager) throws Exception {
String simID = exportSpecs.getVCDataIdentifier().getID();
final VCDataIdentifier vcdID = exportSpecs.getVCDataIdentifier();
VariableSpecs variableSpecs = exportSpecs.getVariableSpecs();
TimeSpecs timeSpecs = exportSpecs.getTimeSpecs();
ChomboFiles chomboFiles = dataServerImpl.getChomboFiles(user, vcdID);
ChomboVtkFileWriter chomboVTKFileWriter = new ChomboVtkFileWriter();
File[] vtkFiles = chomboVTKFileWriter.writeVtuExportFiles(chomboFiles, tmpDir, new ChomboVtkFileWriter.ProgressListener() {
public void progress(double percentDone) {
exportServiceImpl.fireExportProgress(jobRequest.getJobID(), vcdID, "VTKUNSTR", percentDone);
}
});
Vector<ExportOutput> exportOutV = new Vector<ExportOutput>();
for (File file : vtkFiles) {
String dataID = file.getName().replace(simID.toString(), "");
ExportOutput exportOut = new ExportOutput(true, ".vtu", simID.toString(), dataID, fileDataContainerManager);
fileDataContainerManager.manageExistingTempFile(exportOut.getFileDataContainerID(), file);
exportOutV.add(exportOut);
}
ExportOutput[] exportOutputArr = exportOutV.toArray(new ExportOutput[0]);
return exportOutputArr;
}
use of org.vcell.vis.mapping.chombo.ChomboVtkFileWriter in project vcell by virtualcell.
the class DataSetControllerImpl method getVtuVarInfos.
public VtuVarInfo[] getVtuVarInfos(ChomboFiles chomboFiles, OutputContext outputContext, VCDataIdentifier vcdataID) throws DataAccessException {
try {
ChomboVtkFileWriter chomboVTKFileWriter = new ChomboVtkFileWriter();
VtuVarInfo[] vtuVarInfos = chomboVTKFileWriter.getVtuVarInfos(chomboFiles, outputContext, getVCData(vcdataID));
return vtuVarInfos;
} catch (Exception e) {
lg.error(e.getMessage(), e);
throw new DataAccessException("failed to retrieve VTK variable list: " + e.getMessage(), e);
}
}
Aggregations