Search in sources :

Example 1 with SubdomainInfo

use of org.vcell.vis.vcell.SubdomainInfo in project vcell by virtualcell.

the class CartesianMeshFileReader method readFromFiles.

public CartesianMesh readFromFiles(VCellSimFiles vcellSimFiles) throws IOException, MathException {
    // 
    // read meshFile and parse into 'mesh' object
    // 
    BufferedReader meshReader = null;
    BufferedReader meshMetricsReader = null;
    try {
        meshReader = new BufferedReader(new FileReader(vcellSimFiles.cartesianMeshFile));
        CommentStringTokenizer meshST = new CommentStringTokenizer(meshReader);
        CommentStringTokenizer membraneMeshMetricsST = null;
        if (vcellSimFiles.meshMetricsFile != null) {
            meshMetricsReader = new BufferedReader(new FileReader(vcellSimFiles.meshMetricsFile));
            membraneMeshMetricsST = new CommentStringTokenizer(meshMetricsReader);
        }
        MembraneMeshMetrics membraneMeshMetrics = null;
        SubdomainInfo subdomainInfo = null;
        if (membraneMeshMetricsST != null) {
            membraneMeshMetrics = readMembraneMeshMetrics(membraneMeshMetricsST);
        }
        if (vcellSimFiles.subdomainFile != null) {
            subdomainInfo = SubdomainInfo.read(vcellSimFiles.subdomainFile);
        }
        CartesianMesh mesh = readCartesianMesh(meshST, membraneMeshMetrics, subdomainInfo);
        return mesh;
    } finally {
        if (meshReader != null) {
            try {
                meshReader.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        if (meshMetricsReader != null) {
            try {
                meshMetricsReader.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
Also used : CartesianMesh(org.vcell.vis.vcell.CartesianMesh) MembraneMeshMetrics(org.vcell.vis.vcell.MembraneMeshMetrics) BufferedReader(java.io.BufferedReader) CommentStringTokenizer(org.vcell.util.CommentStringTokenizer) FileReader(java.io.FileReader) SubdomainInfo(org.vcell.vis.vcell.SubdomainInfo) IOException(java.io.IOException) MathFormatException(cbit.vcell.math.MathFormatException) MathException(cbit.vcell.math.MathException)

Aggregations

MathException (cbit.vcell.math.MathException)1 MathFormatException (cbit.vcell.math.MathFormatException)1 BufferedReader (java.io.BufferedReader)1 FileReader (java.io.FileReader)1 IOException (java.io.IOException)1 CommentStringTokenizer (org.vcell.util.CommentStringTokenizer)1 CartesianMesh (org.vcell.vis.vcell.CartesianMesh)1 MembraneMeshMetrics (org.vcell.vis.vcell.MembraneMeshMetrics)1 SubdomainInfo (org.vcell.vis.vcell.SubdomainInfo)1