From e88fdcd0e8f598950aaa7e5f1d7b3ec7ed3ba045 Mon Sep 17 00:00:00 2001 From: mattisnowman <matthias@rauter.it> Date: Sun, 2 Oct 2022 14:39:38 +0200 Subject: [PATCH] BUG: Added error message when gridfile can not be read --- applications/utilities/gridToSTL/gridToSTL.C | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/applications/utilities/gridToSTL/gridToSTL.C b/applications/utilities/gridToSTL/gridToSTL.C index 3aa68c4..2548def 100644 --- a/applications/utilities/gridToSTL/gridToSTL.C +++ b/applications/utilities/gridToSTL/gridToSTL.C @@ -596,14 +596,14 @@ int main(int argc, char *argv[]) if (! shp.read(shapeBoundary)) { - FatalIOErrorIn("gridToSTL.C", gridToSTLDict) + FatalIOErrorIn("gridToSTL", gridToSTLDict) << "Unable to read shapefile " << shapeBoundary << "." << exit(FatalIOError); } if (shp.shptype() != shapefile::POLYLINE && shp.shptype() != shapefile::POLYGON) { - FatalIOErrorIn("gridToSTL.C", gridToSTLDict) + FatalIOErrorIn("gridToSTL", gridToSTLDict) << "Boundary shapefile must be of type POLYLINE or POLYGON." << exit(FatalIOError); } @@ -620,7 +620,7 @@ int main(int argc, char *argv[]) if (polyIndex < 0) { - FatalIOErrorIn("gridToSTL.C", gridToSTLDict) + FatalIOErrorIn("gridToSTL", gridToSTLDict) << "Boundary shapefile contains no usable record." << exit(FatalIOError); } @@ -651,7 +651,7 @@ int main(int argc, char *argv[]) } else { - FatalIOErrorIn("gridToSTL.C", gridToSTLDict) + FatalIOErrorIn("gridToSTL", gridToSTLDict) << "Boundary \"" << boundary << "\" not known. Please choose \"fromShape\" or \"fromPoints\"" << exit(FatalIOError); @@ -674,7 +674,12 @@ int main(int argc, char *argv[]) Info << "Reading grid file" << endl; gridfile grid; - grid.read(gridName); + if (!grid.read(gridName)) + { + FatalIOErrorIn("gridToSTL", gridToSTLDict) + << "Could not read grid file " << gridName + << exit(FatalIOError); + } bTri.exportSTL(stlName, grid, divisions, domainHeight); -- GitLab