aboutsummaryrefslogtreecommitdiff
path: root/src/Evolve.c
diff options
context:
space:
mode:
authortradke <tradke@b61c5cb5-eaca-4651-9a7a-d64986f99364>2001-10-31 12:05:01 +0000
committertradke <tradke@b61c5cb5-eaca-4651-9a7a-d64986f99364>2001-10-31 12:05:01 +0000
commit3c2d7c8ae5f322d135e3cf344e8d07af107eb95b (patch)
tree6a53588b10622db65b1f336b1f4c080f92ce6dd7 /src/Evolve.c
parentda1336fd54a0683c9e0bffd309d2df44ea753afe (diff)
PUGH overloadables for CCTK_MyProc(), CCTK_nProcs(), CCTK_Barrier() take
a 'const cGH *' argument now. Also fixed a couple of other warnings. Untabified sources. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGH/trunk@357 b61c5cb5-eaca-4651-9a7a-d64986f99364
Diffstat (limited to 'src/Evolve.c')
-rw-r--r--src/Evolve.c160
1 files changed, 68 insertions, 92 deletions
diff --git a/src/Evolve.c b/src/Evolve.c
index a55a0a7..652967c 100644
--- a/src/Evolve.c
+++ b/src/Evolve.c
@@ -2,9 +2,9 @@
@file PUGH_Evolve.c
@date Thu Oct 8 17:28:46 1998
@author Tom Goodale
- @desc
+ @desc
PUGH evolution stuff.
- @enddesc
+ @enddesc
@version $Header$
@hdate Tue Mar 28 22:41:15 2000 @hauthor Ed Evans
@hdesc Moved into PUGH and added time level rotation
@@ -34,7 +34,7 @@ CCTK_FILEVERSION(CactusPUGH_PUGH_Evolve_c)
{ \
if(iteration%factor == 0) \
{
-
+
#define EndForallConvLevels \
}; \
factor *=2; \
@@ -44,28 +44,28 @@ CCTK_FILEVERSION(CactusPUGH_PUGH_Evolve_c)
/* Local function prototypes. */
-static int DoneMainLoop (cGH *GH, CCTK_REAL cctk_time, int iteration);
+static int DoneMainLoop (const cGH *GH, CCTK_REAL cctk_time, int iteration);
static int StepGH(cGH *GH);
-static void RotateTimeLevelsGH(cGH *cgh);
+static void RotateTimeLevelsGH(cGH *cgh);
/*@@
@routine PUGH_Evolve
@date Thu Oct 8 17:30:15 1998
@author Tom Goodale
- @desc
+ @desc
PUGH's evolution routine.
- @enddesc
- @calls
- @calledby
- @history
+ @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
@hdate Fri May 12 2000 @hauthor Thomas Radke
- @hdesc Moved evolution loop termination check into DoneMainLoop()
- @endhistory
+ @hdesc Moved evolution loop termination check into DoneMainLoop()
+ @endhistory
@@*/
int PUGH_Evolve(tFleshConfig *config)
@@ -95,7 +95,7 @@ int PUGH_Evolve(tFleshConfig *config)
*/
}
EndForallConvLevels;
-
+
iteration = CCTK_SetMainLoopIndex(++iteration);
/* Step each convergence level */
@@ -109,7 +109,7 @@ int PUGH_Evolve(tFleshConfig *config)
*/
}
EndForallConvLevels;
-
+
/* Dump out checkpoint data on all levels */
ForallConvLevels(iteration, convergence_level)
{
@@ -129,7 +129,7 @@ int PUGH_Evolve(tFleshConfig *config)
}
EndForallConvLevels;
-#if 0
+#if 0
/* Termination has been raised and broadcasted, exit loop*/
if (cactus_terminate==TERMINATION_RAISED_BRDCAST) break;
#endif
@@ -145,97 +145,73 @@ int PUGH_Evolve(tFleshConfig *config)
@routine DoneMainLoop
@date Fri May 12 2000
@author Thomas Radke
- @desc
- Check the termination conditions for the evolution loop
- @enddesc
- @calls
-
- @var GH
- @vdesc GH data
- @vtype cGH *
- @vio in
+ @desc
+ Check the termination conditions for the evolution loop
+ @enddesc
+ @calls
+
+ @var GH
+ @vdesc pointer to CCTK grid hierarchy
+ @vtype const cGH *
+ @vio in
@endvar
- @var time
- @vdesc coordinate time
- @vtype CCTK_REAL
- @vio in
+ @var time
+ @vdesc coordinate time
+ @vtype CCTK_REAL
+ @vio in
@endvar
- @var iteration
- @vdesc iteration number
- @vtype int
- @vio in
+ @var iteration
+ @vdesc iteration number
+ @vtype int
+ @vio in
@endvar
@returntype int
@returndesc
- 1 - condition for evolution loop termination is true
- 0 - condition for evolution loop termination is false
+ 1 - condition for evolution loop termination is true
+ 0 - condition for evolution loop termination is false
@endreturndesc
-
- @history
- @endhistory
-
@@*/
-static int DoneMainLoop (cGH *GH, CCTK_REAL time, int iteration)
+static int DoneMainLoop (const cGH *GH, CCTK_REAL time, int iteration)
{
int retval;
- int con;
DECLARE_CCTK_PARAMETERS
- if (terminate_next || CCTK_TerminationReached(GH))
- {
- retval = 1;
- }
- else
+
+ retval = terminate_next || CCTK_TerminationReached (GH);
+ if (! retval)
{
- if (CCTK_Equals(terminate,"never"))
+ if (CCTK_Equals (terminate, "never"))
{
retval = 0;
}
- else if (CCTK_Equals(terminate,"iteration"))
+ else if (CCTK_Equals (terminate, "iteration"))
{
- retval = iteration < cctk_itlast ? 0 : 1;
+ retval = iteration >= cctk_itlast;
}
- else if (CCTK_Equals(terminate,"time"))
+ else
{
if (cctk_initial_time < cctk_final_time)
{
- retval = (time >= cctk_final_time) ? 1 : 0;
+ retval = time >= cctk_final_time;
}
else
{
- retval = (time <= cctk_final_time) ? 1 : 0;
- }
- }
- else if (CCTK_Equals(terminate,"either"))
- {
- if (cctk_initial_time < cctk_final_time)
- {
- con = (time >= cctk_final_time) ? 1 : 0;
+ retval = time <= cctk_final_time;
}
- else
- {
- con = (time <= cctk_final_time) ? 1 : 0;
- }
-
- retval = (!con && iteration < cctk_itlast) ? 0 : 1;
- }
- else if (CCTK_Equals(terminate,"both"))
- {
- if (cctk_initial_time < cctk_final_time)
+
+ if (CCTK_Equals (terminate, "either"))
{
- con = (time >= cctk_final_time) ? 1 : 0;
+ retval |= iteration >= cctk_itlast;
}
- else
+ else if (CCTK_Equals (terminate, "both"))
{
- con = (time <= cctk_final_time) ? 1 : 0;
+ retval &= iteration >= cctk_itlast;
}
-
- retval = (!con || iteration < cctk_itlast) ? 0 : 1;
}
}
-
- return retval;
+
+ return (retval);
}
@@ -243,16 +219,16 @@ static int DoneMainLoop (cGH *GH, CCTK_REAL time, int iteration)
@routine StepGH
@date Fri Aug 14 12:39:49 1998
@author Gerd Lanfermann
- @desc
- The full set of routines used to execute all schedule point
- int the main iteration loop. Makes calls to the individual
+ @desc
+ The full set of routines used to execute all schedule point
+ int the main iteration loop. Makes calls to the individual
routines for each schedule point.
- @enddesc
+ @enddesc
@calls CCTK_Traverse
- @calledby main
+ @calledby main
@@*/
-static int StepGH(cGH *GH)
+static int StepGH(cGH *GH)
{
/* Advance GH->iteration BEFORE evolving */
@@ -261,7 +237,7 @@ static int StepGH(cGH *GH)
CCTK_Traverse(GH, "CCTK_PRESTEP");
CCTK_Traverse(GH, "CCTK_EVOL");
- CCTK_Traverse(GH, "CCTK_POSTSTEP");
+ CCTK_Traverse(GH, "CCTK_POSTSTEP");
return 0;
}
@@ -271,14 +247,14 @@ static int StepGH(cGH *GH)
@routine RotateTimeLevelsGH
@date Tue Mar 28 22:43:49 2000
@author Ed Evans
- @desc
+ @desc
Rotates the time levels
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
+ @enddesc
+ @calls
+ @calledby
+ @history
+
+ @endhistory
@@*/
static void RotateTimeLevelsGH(cGH *cgh)
@@ -292,15 +268,15 @@ static void RotateTimeLevelsGH(cGH *cgh)
pughGH = PUGH_pGH(cgh);
for(var = 0; var < pughGH->nvariables; var++)
- {
+ {
numtimelevels = CCTK_NumTimeLevelsFromVarI(var);
- if(numtimelevels>1)
+ if(numtimelevels>1)
{
temp=pughGH->variables[var][numtimelevels-1];
for(i = numtimelevels-1; i>0; i--)
{
- pughGH->variables[var][i]=pughGH->variables[var][i-1];
+ pughGH->variables[var][i]=pughGH->variables[var][i-1];
}
pughGH->variables[var][0]=temp;