diff options
author | goodale <goodale@b61c5cb5-eaca-4651-9a7a-d64986f99364> | 2000-03-29 07:43:41 +0000 |
---|---|---|
committer | goodale <goodale@b61c5cb5-eaca-4651-9a7a-d64986f99364> | 2000-03-29 07:43:41 +0000 |
commit | 3740ecdd2787031c5f516db29e810cf805fc6802 (patch) | |
tree | c43183e6c6806c7369bfbe53fcb8cb7156ff90da | |
parent | 6f394dcd07976df1f91ef8aa8b8a15436613fbf7 (diff) |
Some tidying up and updating of grdoc.
Tom
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGH/trunk@188 b61c5cb5-eaca-4651-9a7a-d64986f99364
-rw-r--r-- | src/PUGH_Evolve.c | 278 |
1 files changed, 63 insertions, 215 deletions
diff --git a/src/PUGH_Evolve.c b/src/PUGH_Evolve.c index 815d83b..2904796 100644 --- a/src/PUGH_Evolve.c +++ b/src/PUGH_Evolve.c @@ -1,21 +1,26 @@ /*@@ - @file CactusDefaultEvolve.c + @file PUGH_Evolve.c @date Thu Oct 8 17:28:46 1998 @author Tom Goodale @desc - Default cactus evolution stuff. + PUGH evolution stuff. @enddesc + @version $Header$ + @hdate Tue Mar 28 22:41:15 2000 @hauthor Ed Evans + @hdesc Moved into PUGH and added time level rotation + @hdate Tue Mar 28 22:41:45 2000 @hauthor Tom Goodale + @hdesc Tidied up @@*/ -/*#define DEBUG_CCTK*/ - #include <stdio.h> -#include <assert.h> + #include "cctk_Flesh.h" #include "cctk_Parameters.h" #include "cctk_Groups.h" #include "CactusIOFunctions.h" + #include "pugh.h" + static char *rcsid="$Header$"; /* Define some macros for convenience. */ @@ -35,17 +40,14 @@ static char *rcsid="$Header$"; }; \ } - /* Quick stuff for testing purposes. */ -#define EVOLUTION 1 -#define OUTPUT 2 -int cactus_terminate; -/*#define TERMINATION_RAISED_BRDCAST 4*/ /* Local function prototypes. */ -int PUGH_StepGH(cGH *GH); -void RotateTimeLevelsGH(cGH *cgh); +static int StepGH(cGH *GH); +static void RotateTimeLevelsGH(cGH *cgh); + extern int PUGH_GHExtension; + /* the iteration counter used in the evolution loop */ static int iteration = 0; @@ -88,16 +90,19 @@ int PUGH_MainLoopIndex (void) /*@@ - @routine CactusDefaultEvolve + @routine PUGH_Evolve @date Thu Oct 8 17:30:15 1998 @author Tom Goodale @desc - The default cactus evolution routine. + PUGH's evolution routine. @enddesc @calls @calledby @history - + @hdate Tue Mar 28 22:42:47 2000 @hauthor Ed Evans + @hdesc Copied from CactusDefaultEvolve and added rotation + @hdate Tue Mar 28 22:43:18 2000 @hauthor Tom Goodale + @hdesc Tidied @endhistory @@*/ @@ -108,16 +113,6 @@ int PUGH_Evolve(tFleshConfig *config) int convergence_level; -#ifdef DEBUG_CCTK - CCTK_PRINTSEPARATOR - printf("In CactusDefaultEvolve\n----------------------\n"); - printf(" Initializing iteration = %d\n",iteration); - CCTK_PRINTSEPARATOR -#endif - -#if 0 - CactusStartTimer(config->timer[OUTPUT]); -#endif /*** Call OUTPUT for this GH (this routine ***/ /*** checks if output is necessary) and makes ***/ @@ -129,36 +124,16 @@ int PUGH_Evolve(tFleshConfig *config) } EndForallConvLevels; -#if 0 - CactusStopTimer(config->timer[OUTPUT]); - - CactusStartTimer(config->timer[EVOLUTION]); -#endif - /* - CCTK_InfoHeader(config); - */ - - while (iteration<cctk_itlast || (cctk_final_time>cctk_initial_time?config->GH[0]->cctk_time<cctk_final_time:0)) { - -#ifdef DEBUG_CCTK - CCTK_PRINTSEPARATOR - printf("In CactusDefaultEvolve\n----------------------\n"); - printf(" Advancing iteration %d = %d + 1\n",iteration+1, - iteration); - CCTK_PRINTSEPARATOR -#endif - iteration++; /* Step each convergence level */ - ForallConvLevels(iteration, convergence_level) { - PUGH_StepGH(config->GH[convergence_level]); + StepGH(config->GH[convergence_level]); /* CCTK_InfoOutput(config->GH[convergence_level], convergence_level); */ @@ -183,9 +158,7 @@ int PUGH_Evolve(tFleshConfig *config) EndForallConvLevels; /* Output perhaps */ -#if 0 - CactusStartTimer(config->timer[OUTPUT]); -#endif + /*** Call OUTPUT for this GH (this routine ***/ /*** checks if output is necessary) and makes ***/ /*** an Traverse with CCTK_ANALYSIS ***/ @@ -195,36 +168,21 @@ int PUGH_Evolve(tFleshConfig *config) CCTK_OutputGH(config->GH[convergence_level]); } EndForallConvLevels; - -#if 0 - CactusStopTimer(config->timer[OUTPUT]); -#endif - -#if 0 - ConvergenceReport(config->GH, iteration); - PUGH_TerminationStepper(config->GH[0]); - -#endif +#if 0 /* Termination has been raised and broadcasted, exit loop*/ if (cactus_terminate==TERMINATION_RAISED_BRDCAST) break; +#endif } /*** END OF MAIN ITERATION LOOP ***/ -#if 0 - CactusStopTimer(config->timer[EVOLUTION]); -#endif - return 0; - - USE_CCTK_PARAMETERS - } /************************************************************************/ /*@@ - @routine PUGH_StepGH + @routine StepGH @date Fri Aug 14 12:39:49 1998 @author Gerd Lanfermann @desc @@ -232,98 +190,36 @@ int PUGH_Evolve(tFleshConfig *config) int the main iteration loop. Makes calls to the individual routines for each schedule point. @enddesc - @calls PUGH_PreStepper, PUGH_EvolStepper, PUGH_PostStepper + @calls CCTK_Traverse @calledby main @@*/ -int PUGH_StepGH(cGH *GH) +static int StepGH(cGH *GH) { - - void PUGH_PreStepper(cGH *GH); - void PUGH_EvolStepper(cGH *GH); - void PUGH_PostStepper(cGH *GH); - /* Advance GH->iteration BEFORE evolving */ -#ifdef DEBUG_CCTK - CCTK_PRINTSEPARATOR - printf("In PUGH_StepGH\n--------------\n"); - printf(" Advancing GH->iteration to %lu = %lu + 1\n",(GH->cctk_iteration+1), - GH->cctk_iteration); - CCTK_PRINTSEPARATOR -#endif GH->cctk_iteration++; - PUGH_PreStepper(GH); - PUGH_EvolStepper(GH); + CCTK_Traverse(GH, "CCTK_PRESTEP"); + CCTK_Traverse(GH, "CCTK_EVOL"); + /* Advance GH->time AFTER evolving */ -#ifdef DEBUG_CCTK - CCTK_PRINTSEPARATOR - printf("In PUGH_StepGH\n--------------\n"); - printf(" Advancing GH->cctk_time %f = %f + %f\n",GH->cctk_time+GH->cctk_delta_time, - GH->cctk_time,GH->cctk_delta_time); - CCTK_PRINTSEPARATOR -#endif GH->cctk_time = GH->cctk_time + GH->cctk_delta_time; - PUGH_PostStepper(GH); - + CCTK_Traverse(GH, "CCTK_POSTSTEP"); return 0; } - /*@@ - @routine PUGH_PreStepper - @date Fri Aug 14 12:43:20 1998 - @author Gerd Lanfermann - @desc - calls PRESTEP - @enddesc - @calls - @calledby - @history - - @endhistory - -@@*/ - -void PUGH_PreStepper(cGH *GH) -{ - /* Call the schedular with CCTK_PRESTEP */ - CCTK_Traverse(GH, "CCTK_PRESTEP"); -} /*@@ - @routine PUGH_EvolStepper - @date Fri Aug 14 12:44:00 1998 - @author Gerd Lanfermann + @routine RotateTimeLevelsGH + @date Tue Mar 28 22:43:49 2000 + @author Ed Evans @desc - calls EVOLUTION, checks for nans, increases physical time - @enddesc - @calls - @calledby - @history - - @endhistory -@@*/ - -void PUGH_EvolStepper(cGH *GH) -{ - - /* Call the schedular with Evolution */ - CCTK_Traverse(GH, "CCTK_EVOL"); - /* after Evolution check for NANs */ - -} - - /*@@ - @routine PUGH_PostStepper - @date Fri Aug 14 12:45:39 1998 - @author Gerd Lanfermann - @desc - calls the routines rgeistered as CCTK_POSSTEPS + Rotates the time levels @enddesc @calls @calledby @@ -332,55 +228,7 @@ void PUGH_EvolStepper(cGH *GH) @endhistory @@*/ -void PUGH_PostStepper(cGH *GH) -{ - /* Call the scheduler with post step */ - CCTK_Traverse(GH, "CCTK_POSTSTEP"); -} - - /*@@ - @routine PUGH_TerminationStepper - @date Fri Aug 14 13:07:11 1998 - @author Gerd Lanfermann - @desc - cactus_terminate is a global variable with these values: - TERMINATION_NOT_RAISED : not signaled yet (cactus_initial.c) - TERMINATION_RAISED_LOCAL : signaled on one PE, not reduced (MPI_LOR) - to all PEs yet (main.c) - TERMINATION_RAISED_BRDCAST: reduced -> can now be used to terminate - (chkpnt_terminate.c) by the scheduler - the raised termiantion signal is caught on 1 PE only and has to be recduced - on all PEs before a termination sequenced can be launched (I like that) - @enddesc - @calls - @calledby - @history - - @endhistory - -@@*/ - -void PUGH_TerminationStepper(cGH *GH) -{ - int cactus_terminate_global; - - cactus_terminate_global=cactus_terminate; - -#if 0 - -#ifdef MPI - MPI_Allreduce(&cactus_terminate,&cactus_terminate_global,1, - MPI_INT,MPI_LOR,GH->PUGH_COMM_WORLD); -#endif -#endif - if (cactus_terminate_global) { - cactus_terminate=TERMINATION_RAISED_BRDCAST; - printf("RECEIVED GLOBAL TERMINATION SIGNAL \n"); - } - CCTK_Traverse(GH, "CCTK_TERMINATE"); -} - -void RotateTimeLevelsGH(cGH *cgh) +static void RotateTimeLevelsGH(cGH *cgh) { int didit; int var; @@ -388,41 +236,41 @@ void RotateTimeLevelsGH(cGH *cgh) void *temp; pGH *pughGH; int numtimelevels; - pughGH = (pGH *) cgh->extensions [PUGH_GHExtension]; + + pughGH = pugh_pGH(cgh); + didit=1; for(var = 0; var < pughGH->nvariables; var++) - { - + { numtimelevels = CCTK_NumTimeLevelsFromVarI(var); - if(numtimelevels<=1) - { - /*printf("Breaking Breaking 123\n");*/ - continue; - } - assert(numtimelevels>1); - if(didit==0) printf("Var = %d",var); - temp=pughGH->variables[var][0]; - for(i = 0 ; i < numtimelevels -1 ; i++) - { - if(didit==0) printf(" %d becomes %d",i+1,i); - pughGH->variables[var][i]=pughGH->variables[var][i+1]; - } - if(didit==0) printf(" %d becomes %d \n",0,numtimelevels-1); - pughGH->variables[var][numtimelevels-1]=temp; - didit=1; - assert(pughGH->variables[var][1]!=(pughGH->variables[var][0])); - - - } -} - - + if(numtimelevels<=1) + { + continue; + } + if(didit==0) + { + printf("Var = %d",var); + } + temp=pughGH->variables[var][0]; - + for(i = 0 ; i < numtimelevels -1 ; i++) + { + if(didit==0) printf(" %d becomes %d",i+1,i); + pughGH->variables[var][i]=pughGH->variables[var][i+1]; + } + if(didit==0) + { + printf(" %d becomes %d \n",0,numtimelevels-1); + } + pughGH->variables[var][numtimelevels-1]=temp; + didit=1; + } + return; +} |