Search in sources :

Example 1 with ChomboVtkFileWriter

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);
    }
}
Also used : ChomboVtkFileWriter(org.vcell.vis.mapping.chombo.ChomboVtkFileWriter) DataAccessException(org.vcell.util.DataAccessException) ObjectNotFoundException(org.vcell.util.ObjectNotFoundException) XmlParseException(cbit.vcell.xml.XmlParseException) IOException(java.io.IOException) DataAccessException(org.vcell.util.DataAccessException) DivideByZeroException(cbit.vcell.parser.DivideByZeroException) CacheException(org.vcell.util.CacheException) ExpressionBindingException(cbit.vcell.parser.ExpressionBindingException) FileNotFoundException(java.io.FileNotFoundException) ExpressionException(cbit.vcell.parser.ExpressionException) MathException(cbit.vcell.math.MathException)

Example 2 with ChomboVtkFileWriter

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);
    }
}
Also used : ChomboVtkFileWriter(org.vcell.vis.mapping.chombo.ChomboVtkFileWriter) VtuFileContainer(org.vcell.vis.io.VtuFileContainer) ZipFile(org.apache.commons.compress.archivers.zip.ZipFile) File(java.io.File) ObjectNotFoundException(org.vcell.util.ObjectNotFoundException) XmlParseException(cbit.vcell.xml.XmlParseException) IOException(java.io.IOException) DataAccessException(org.vcell.util.DataAccessException) DivideByZeroException(cbit.vcell.parser.DivideByZeroException) CacheException(org.vcell.util.CacheException) ExpressionBindingException(cbit.vcell.parser.ExpressionBindingException) FileNotFoundException(java.io.FileNotFoundException) ExpressionException(cbit.vcell.parser.ExpressionException) MathException(cbit.vcell.math.MathException) DataAccessException(org.vcell.util.DataAccessException)

Example 3 with ChomboVtkFileWriter

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;
}
Also used : ChomboVtkFileWriter(org.vcell.vis.mapping.chombo.ChomboVtkFileWriter) ChomboFiles(org.vcell.vis.io.ChomboFiles) VCDataIdentifier(org.vcell.util.document.VCDataIdentifier) File(java.io.File) Vector(java.util.Vector)

Example 4 with ChomboVtkFileWriter

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);
    }
}
Also used : VtuVarInfo(org.vcell.vis.io.VtuVarInfo) ChomboVtkFileWriter(org.vcell.vis.mapping.chombo.ChomboVtkFileWriter) ObjectNotFoundException(org.vcell.util.ObjectNotFoundException) XmlParseException(cbit.vcell.xml.XmlParseException) IOException(java.io.IOException) DataAccessException(org.vcell.util.DataAccessException) DivideByZeroException(cbit.vcell.parser.DivideByZeroException) CacheException(org.vcell.util.CacheException) ExpressionBindingException(cbit.vcell.parser.ExpressionBindingException) FileNotFoundException(java.io.FileNotFoundException) ExpressionException(cbit.vcell.parser.ExpressionException) MathException(cbit.vcell.math.MathException) DataAccessException(org.vcell.util.DataAccessException)

Aggregations

ChomboVtkFileWriter (org.vcell.vis.mapping.chombo.ChomboVtkFileWriter)4 MathException (cbit.vcell.math.MathException)3 DivideByZeroException (cbit.vcell.parser.DivideByZeroException)3 ExpressionBindingException (cbit.vcell.parser.ExpressionBindingException)3 ExpressionException (cbit.vcell.parser.ExpressionException)3 XmlParseException (cbit.vcell.xml.XmlParseException)3 FileNotFoundException (java.io.FileNotFoundException)3 IOException (java.io.IOException)3 CacheException (org.vcell.util.CacheException)3 DataAccessException (org.vcell.util.DataAccessException)3 ObjectNotFoundException (org.vcell.util.ObjectNotFoundException)3 File (java.io.File)2 Vector (java.util.Vector)1 ZipFile (org.apache.commons.compress.archivers.zip.ZipFile)1 VCDataIdentifier (org.vcell.util.document.VCDataIdentifier)1 ChomboFiles (org.vcell.vis.io.ChomboFiles)1 VtuFileContainer (org.vcell.vis.io.VtuFileContainer)1 VtuVarInfo (org.vcell.vis.io.VtuVarInfo)1