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();
}
}
}
}
Aggregations