summaryrefslogtreecommitdiff
path: root/src/main/Groups.c
diff options
context:
space:
mode:
authorgoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>1999-02-16 21:24:33 +0000
committergoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>1999-02-16 21:24:33 +0000
commit4d7a9a26ebaee57100fd3628ec47e23d898b0717 (patch)
tree6b8a2abc5116cb9be1c8b1252a2b8eeea6b714bd /src/main/Groups.c
parent3ff349c2fc1ec2c9c1dd54a114d585fd678f4b4f (diff)
Added support for time levels.
You can now put TIMELEVELS=<n> in a group definition. Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@289 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/main/Groups.c')
-rw-r--r--src/main/Groups.c55
1 files changed, 49 insertions, 6 deletions
diff --git a/src/main/Groups.c b/src/main/Groups.c
index 3e045799..eaaea032 100644
--- a/src/main/Groups.c
+++ b/src/main/Groups.c
@@ -60,6 +60,7 @@ int CCTK_CreateGroup(const char *gname, const char *thorn, const char *imp,
const char *gtype,
const char *vtype,
int dimension,
+ int ntimelevels,
int n_variables,
...)
{
@@ -82,6 +83,8 @@ int CCTK_CreateGroup(const char *gname, const char *thorn, const char *imp,
group->dim = dimension;
group->gtype = CCTK_GTypeNumber(gtype);
group->vtype = CCTK_VTypeNumber(vtype);
+
+ group->n_timelevels = ntimelevels;
/* Extract the variable names from the argument list. */
va_start(ap, n_variables);
@@ -552,9 +555,16 @@ char *CCTK_GetVarName(int varnum)
char *name;
int group;
- group = group_of_variable[varnum];
+ if(varnum < total_variables)
+ {
+ group = group_of_variable[varnum];
- name = groups[group].variables[varnum-groups[group].variables[0].number].name;
+ name = groups[group].variables[varnum-groups[group].variables[0].number].name;
+ }
+ else
+ {
+ name = NULL;
+ }
return name;
}
@@ -599,9 +609,16 @@ int CCTK_GetVarGType(int var)
int gtype;
int group;
- group = group_of_variable[var];
+ if(var < total_variables)
+ {
+ group = group_of_variable[var];
- gtype = groups[group].gtype;
+ gtype = groups[group].gtype;
+ }
+ else
+ {
+ gtype = -1;
+ }
return gtype;
}
@@ -611,9 +628,35 @@ int CCTK_GetVarVType(int var)
int vtype;
int group;
- group = group_of_variable[var];
+ if(var < total_variables)
+ {
+ group = group_of_variable[var];
- vtype = groups[group].vtype;
+ vtype = groups[group].vtype;
+ }
+ else
+ {
+ vtype = -1;
+ }
return vtype;
}
+
+int CCTK_GetNumTimeLevels(int var)
+{
+ int ntimelevels;
+ int group;
+
+ if(var < total_variables)
+ {
+ group = group_of_variable[var];
+ ntimelevels = groups[group].n_timelevels;
+ }
+ else
+ {
+ ntimelevels = -1;
+ }
+
+ return ntimelevels;
+}
+