summaryrefslogtreecommitdiff
path: root/src/main/Groups.c
diff options
context:
space:
mode:
authorschnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac>2003-10-07 14:51:41 +0000
committerschnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac>2003-10-07 14:51:41 +0000
commitdf6ac866c07086999f612dce375f4dfdc7b1eb38 (patch)
treea5f02b58b679df987a090cc6ff085c31487f0227 /src/main/Groups.c
parentf9fd939abbc7e148722bbf27d74d65b6ae7be603 (diff)
Allow vector groups of size 0.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@3426 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/main/Groups.c')
-rw-r--r--src/main/Groups.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/main/Groups.c b/src/main/Groups.c
index 86daebac..74264f7c 100644
--- a/src/main/Groups.c
+++ b/src/main/Groups.c
@@ -1214,12 +1214,14 @@ int CCTK_GroupTagsTableI(int group)
@returndesc
the index of the first variable in the given group, or
-1 if given group index is invalid
+ -2 if given group has no members
@endreturndesc
@@*/
int CCTK_FirstVarIndexI (int group)
{
- return ((0 <= group && group < n_groups) ?
- groups[group].variables[0].number : -1);
+ if (! (0 <= group && group < n_groups)) return -1;
+ if (groups[group].n_variables == 0) return -2;
+ return groups[group].variables[0].number;
}
void CCTK_FCALL CCTK_FNAME (CCTK_FirstVarIndexI)
@@ -2178,10 +2180,10 @@ int CCTKi_CreateGroup (const char *gname,
n_variables = CCTKi_ParamExpressionToInt(vararraysize,thorn);
- if(n_variables < 1)
+ if(n_variables < 0)
{
CCTK_VWarn (0, __LINE__, __FILE__, "Cactus",
- "CCTKi_CreateGroup: length of group %s less than 1 !",
+ "CCTKi_CreateGroup: length of group %s less than 0 !",
gname);
}
}
@@ -2582,7 +2584,7 @@ const int *CCTKi_GroupLengthAsPointer(const char *fullgroupname)
if (retval == NULL)
{
CCTK_VWarn (6, __LINE__, __FILE__, "Cactus",
- "CCTK_GroupIndex: No group named '%s' found",
+ "CCTKi_GroupLengthAsPointer: No group named '%s' found",
fullgroupname);
}
}