diff options
author | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 1999-09-19 14:16:47 +0000 |
---|---|---|
committer | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 1999-09-19 14:16:47 +0000 |
commit | 3ab5cb019753e0b90e604925990a87632189fa92 (patch) | |
tree | 6e69541b8a1f7be3780b70d5a2f482fe0ec6019d /src/main/GroupsOnGH.c | |
parent | 9f87b1d5f18561784e4d09e627fbb591a693f0c4 (diff) |
New schedule stuff.
IMPORTANT: if you don't have a src/schedule directory, please
do an "update -d" or your code won't compile!
You can now create schedule groups and schedule items (other groups
or functions) IN a group. You may then schedule a group AT a
particular CCTK entry point, or inside another group.
There is a new keyword WHILE in the schedule specification. The
argument(s) to this are the full names of integer scalars, and the
item which is scheduled WHILE will be executed while this integer, or
these integers, are non-zero. Note that currently there is little
checking of the type of these scalars, 'though this will be coming
soon.
BEFORE, AFTER, or WHILE can take a list of arguments of the form
(a,b,c) to stop you having to do something like
BEFORE a BEFORE b BEFORE c
So the full format of a schedule statement is
SCHEDULE [GROUP] <name> <AT entrypoint | IN group> [BEFORE|AFTER <item | (item...)>] [WHILE <integer gridscalar>]
{
[LANG: <language>]
[COMM: <group(s)>]
[STORAGE: <groups(s)]
[TRIGGERS: <groups(s)]
} "<description>"
Note that even for a group you need to provide
{
} "<description>"
'though that may be relaxed soon.
Also TRIGGERS are now on a group basis, not on a variable basis.
So, for example, to test this I had
--------------------------------------
SCHEDULE TEST1_InitialData AT INITIAL
{
LANG: Fortran
} "Initialise"
SCHEDULE TEST1_InitialData AT EVOL
{
LANG: Fortran
} "Initialise"
SCHEDULE TEST1_Evolve IN testit
{
LANG: Fortran
} "Evolution routine"
SCHEDULE GROUP testit WHILE test1::foo_int_scalar AT EVOL AFTER TEST1_InitialData
{
} "Test a group within a group. "
---------------------------------------
where the initialisation routine set test1::foo_int_scalar to 4 and
the evolution routine decremented it. The group "testit" is redundant here
as only one thing is scheduled in it, the WHILE and AFTER could have gone
directly onto the scheduling of TEST1_Evolve.
Apart from the checking of the while stuff, the perl does a fair amount of
checking that groups exist. It doesn't yet check that a group you
are scheduling at or in exists, and neither does the C, so please check the
screen output of the final schedule tree. Checks for this an for
unreachable groups will go in, but perhaps not in the next week.
There's also some tidying up which needs to go in, but this stuff
passes all the tests that the unmodified code does.
I have also tried to make the output of the CST a bit more useful, 'though
now it's a wee bit long-winded.
Please send me comments if you want more output of various things, or would
like the current output, or how the WHILE stuff works, changed.
Tom
IMPORTANT: if you don't have a src/schedule directory, please
do an "update -d" or your code won't compile!
git-svn-id: http://svn.cactuscode.org/flesh/trunk@966 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/main/GroupsOnGH.c')
-rw-r--r-- | src/main/GroupsOnGH.c | 148 |
1 files changed, 148 insertions, 0 deletions
diff --git a/src/main/GroupsOnGH.c b/src/main/GroupsOnGH.c index aefa2a6c..caae5cba 100644 --- a/src/main/GroupsOnGH.c +++ b/src/main/GroupsOnGH.c @@ -17,6 +17,7 @@ #include "cctk_Groups.h" #include "cctk_WarnLevel.h" #include "cctk_GroupsOnGH.h" +#include "cctk_Comm.h" /*#define DEBUG_GROUPS*/ @@ -195,3 +196,150 @@ void *CCTK_VarDataPtrB(cGH *GH, int timelevel, int varindex, char *fullvarname) } } + /*@@ + @routine CCTK_EnableGroupCommI + @date Sat Feb 13 17:06:30 1999 + @author Tom Goodale + @desc + Enables communication for a group based upon its name. + @enddesc + @calls + @calledby + @history + + @endhistory + +@@*/ +int CCTK_EnableGroupCommI(void *GH, int group) +{ + int retcode; + char *group_name; + + group_name = CCTK_GroupName(group); + if(group_name) + { +#ifdef DEBUG + printf("Turning on comm in %s for group %s (%d)\n",__FILE__group_name,group); +#endif + retcode = CCTK_EnableGroupComm(GH, group_name); + + free(group_name); + } + else + { + retcode = 0; + } + + return retcode; +} + + /*@@ + @routine CCTK_EnableGroupStorageI + @date Sat Feb 13 17:06:30 1999 + @author Tom Goodale + @desc + Enables storage for a group based upon its name. + @enddesc + @calls + @calledby + @history + + @endhistory + +@@*/ +int CCTK_EnableGroupStorageI(void *GH, int group) +{ + int retcode; + char *group_name; + + group_name = CCTK_GroupName(group); + if(group_name) + { +#ifdef DEBUG + printf("Turning on storage in %s for group %s (%d)\n",__FILE__group_name,group); +#endif + retcode = CCTK_EnableGroupStorage(GH, group_name); + + free(group_name); + } + else + { + retcode = 0; + } + + return retcode; +} + + /*@@ + @routine CCTK_DisableGroupCommI + @date Sat Feb 13 17:06:30 1999 + @author Tom Goodale + @desc + Routine to switch communication off for a group based upon its index + @enddesc + @calls + @calledby + @history + + @endhistory + +@@*/ +int CCTK_DisableGroupCommI(void *GH, int group) +{ + int retcode; + char *group_name; + + group_name = CCTK_GroupName(group); + if(group_name) + { +#ifdef DEBUG + printf("Turning off comm in %s for group %s (%d)\n",__FILE__,group_name,group); +#endif + retcode = CCTK_DisableGroupComm(GH, group_name); + + free(group_name); + } + else + { + retcode = 0; + } + + return retcode; +} + + /*@@ + @routine CCTK_DisableGroupStorageI + @date Sat Feb 13 17:06:30 1999 + @author Tom Goodale + @desc + Routine to switch storage off for a group based upon its index + @enddesc + @calls + @calledby + @history + + @endhistory + +@@*/ +int CCTK_DisableGroupStorageI(void *GH, int group) +{ + int retcode; + char *group_name; + + group_name = CCTK_GroupName(group); + if(group_name) + { +#ifdef DEBUG + printf("Turning off storage in %s for group %s (%d)\n",__FILE__,group_name,group); +#endif + retcode = CCTK_DisableGroupStorage(GH, group_name); + + free(group_name); + } + else + { + retcode = 0; + } + + return retcode; +} |