From b713dc18e04c1aa36e1b19ead120c9b643d7eb67 Mon Sep 17 00:00:00 2001 From: knarf Date: Wed, 27 Oct 2010 14:26:31 +0000 Subject: detect error in dimension size settings of grid arrays, and produce a meaningful error message git-svn-id: http://svn.cactuscode.org/flesh/trunk@4644 17b73243-c579-4c4c-a9d2-2d5706c11dac --- src/main/Groups.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/main') diff --git a/src/main/Groups.c b/src/main/Groups.c index 40d80a29..cf501a53 100644 --- a/src/main/Groups.c +++ b/src/main/Groups.c @@ -222,7 +222,8 @@ static cGroupDefinition *CCTKi_SetupGroup (const char *implementation, int vectorlength); static CCTK_INT **CCTKi_ExtractSize (int dimension, const char *thorn, - const char *sizestring); + const char *sizestring, + const char *gname); static int CCTKi_ParamExpressionToInt(const char *expression, const char *thorn); @@ -2494,8 +2495,8 @@ int CCTKi_CreateGroup (const char *gname, { staggered = 1; } - group->size = CCTKi_ExtractSize (dimension, thorn, size); - group->ghostsize = CCTKi_ExtractSize (dimension, thorn, ghostsize); + group->size = CCTKi_ExtractSize (dimension, thorn, size, gname); + group->ghostsize = CCTKi_ExtractSize (dimension, thorn, ghostsize, gname); /* Only typically have GFs in a single dimension */ if (group->gtype == CCTK_GF) @@ -2700,14 +2701,14 @@ static cGroupDefinition *CCTKi_SetupGroup (const char *implementation, @@*/ static CCTK_INT **CCTKi_ExtractSize (int dimension, const char *this_thorn, - const char *sizestring) + const char *sizestring, + const char *gname) { int dim; char *tmp; const char *last_comma, *next_comma; CCTK_INT **size_array; - if (dimension < 0) { CCTK_Warn (0, __LINE__, __FILE__, "Cactus","Illegal dimension specified"); @@ -2732,6 +2733,10 @@ static CCTK_INT **CCTKi_ExtractSize (int dimension, for (dim = 0; dim < dimension; dim++) { + if (!next_comma) + { + CCTK_VWarn (0, __LINE__, __FILE__, "Cactus","Insufficient dimension size specified in %s::%s -> %s", this_thorn, gname, sizestring); + } /* find the comma as a delimiter for different dimension sizes */ last_comma = next_comma[0] == ',' ? next_comma+1 : next_comma; next_comma = strstr (last_comma, ","); -- cgit v1.2.3