File tree Expand file tree Collapse file tree 1 file changed +21
-7
lines changed Expand file tree Collapse file tree 1 file changed +21
-7
lines changed Original file line number Diff line number Diff line change @@ -24,22 +24,36 @@ void read_flat_grid_file(
24
24
25
25
size_t nx = 0 ;
26
26
size_t ny = 0 ;
27
- file >> nx;
28
- file >> ny;
29
- AMREX_ALWAYS_ASSERT (nx > 0 );
30
- AMREX_ALWAYS_ASSERT (ny > 0 );
27
+ if (!(file >> nx)) {
28
+ amrex::Abort (" Failed to read grid dimension nx" );
29
+ }
30
+ if (!(file >> ny)) {
31
+ amrex::Abort (" Failed to read grid dimension ny" );
32
+ }
33
+
34
+ AMREX_ALWAYS_ASSERT_WITH_MESSAGE (nx > 0 , " nx must be > 0" );
35
+ AMREX_ALWAYS_ASSERT_WITH_MESSAGE (ny > 0 , " ny must be > 0" );
36
+
31
37
xs.resize (nx);
32
38
ys.resize (ny);
33
39
zs.resize (nx * ny);
40
+
34
41
for (size_t n = 0 ; n < nx; n++) {
35
- file >> xs[n];
42
+ if (!(file >> xs[n])) {
43
+ amrex::Abort (" Failed to read xs[" + std::to_string (n) + " ]" );
44
+ }
36
45
}
37
46
for (size_t n = 0 ; n < ny; n++) {
38
- file >> ys[n];
47
+ if (!(file >> ys[n])) {
48
+ amrex::Abort (" Failed to read ys[" + std::to_string (n) + " ]" );
49
+ }
39
50
}
40
51
for (size_t n = 0 ; n < nx * ny; n++) {
41
- file >> zs[n];
52
+ if (!(file >> zs[n])) {
53
+ amrex::Abort (" Failed to read zs[" + std::to_string (n) + " ]" );
54
+ }
42
55
}
56
+
43
57
file.close ();
44
58
}
45
59
} // namespace amr_wind::ioutils
You can’t perform that action at this time.
0 commit comments