From 9a640c92e7194882f3f4d79091b44be1d2c5103b Mon Sep 17 00:00:00 2001 From: schnetter Date: Fri, 27 May 2005 12:26:05 +0000 Subject: Handle the case of 0 variables; just return in this case. Output fewer warnings. git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/RotatingSymmetry180/trunk@22 20f44201-0f4f-0410-9130-e5fc2714a787 --- src/rotatingsymmetry180.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src') diff --git a/src/rotatingsymmetry180.c b/src/rotatingsymmetry180.c index d37ca5b..ad2476a 100644 --- a/src/rotatingsymmetry180.c +++ b/src/rotatingsymmetry180.c @@ -73,6 +73,9 @@ int BndRot180VI (cGH const * restrict const cctkGH, } } + /* Return early if there is nothing to do */ + if (nvars == 0) return 0; + /* Get and check group info */ assert (nvars>0); gis = malloc (nvars * sizeof *gis); @@ -125,6 +128,21 @@ int BndRot180VI (cGH const * restrict const cctkGH, (table, sizeof tensortypealias, tensortypealias, "tensortypealias"); if (ierr == UTIL_ERROR_TABLE_NO_SUCH_KEY) { /* assume a scalar */ + if (numvars != 1) { + static int * restrict didwarn = 0; + if (! didwarn) { + didwarn = calloc (CCTK_NumGroups(), sizeof *didwarn); + } + if (! didwarn[gis[var]]) { + didwarn[gis[var]] = 1; + char * groupname = CCTK_GroupName(gis[var]); + assert (groupname); + CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING, + "Group \"%s\" has no tensor type and contains more than one element -- treating these as \"scalar\"", + groupname); + free (groupname); + } + } strcpy (tensortypealias, "scalar"); } else if (ierr<0) { char * groupname = CCTK_GroupName(gis[var]); -- cgit v1.2.3