File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
components/eamxx/src/share/field Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -313,12 +313,22 @@ void print_field_hyperslab (const Field& f,
313
313
{
314
314
const auto dt = f.data_type ();
315
315
const auto rank = f.rank ();
316
+ const auto & fl = f.get_header ().get_identifier ().get_layout ();
316
317
317
318
EKAT_REQUIRE_MSG (rank>=static_cast <int >(tags.size ()),
318
319
" Error! Requested location incompatible with field rank.\n "
319
320
" - field name: " + f.name () + " \n "
320
321
" - field rank: " + std::to_string (rank) + " \n "
321
- " - requested indices: (" + ekat::join (indices," ," ) + " \n " );
322
+ " - requested indices: (" + ekat::join (indices," ," ) + " )\n " );
323
+
324
+ const int num_indices = indices.size ();
325
+ for (int i=0 ; i<num_indices; ++i) {
326
+ EKAT_REQUIRE_MSG ( indices[i]>=0 && indices[i]<fl.dim (i),
327
+ " Error! Requested index is invalid.\n "
328
+ " - field name: " + f.name () + " \n "
329
+ " - field layout: " + fl.to_string () + " \n "
330
+ " - requested indices: (" + ekat::join (indices," ," ) + " )\n " );
331
+ }
322
332
323
333
switch (dt) {
324
334
case DataType::IntType:
You can’t perform that action at this time.
0 commit comments