aboutsummaryrefslogtreecommitdiff
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
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
-rw-r--r--src/Comm.c11
-rw-r--r--src/Evolve.c160
-rw-r--r--src/PughUtils.c198
-rw-r--r--src/SetupPGH.c46
-rw-r--r--src/Storage.c81
-rw-r--r--src/include/pugh.h20
-rw-r--r--src/pugh_Comm.h9
7 files changed, 241 insertions, 284 deletions
diff --git a/src/Comm.c b/src/Comm.c
index 713d8d7..833ad9e 100644
--- a/src/Comm.c
+++ b/src/Comm.c
@@ -331,16 +331,15 @@ int PUGH_SyncGArray(pGA *GA)
}
-int PUGH_Barrier(cGH *GH)
+int PUGH_Barrier(const cGH *GH)
{
#ifdef CCTK_MPI
- CACTUS_MPI_ERROR(MPI_Barrier(PUGH_pGH(GH)->PUGH_COMM_WORLD));
-#endif
-
- /* get rid of compiler warning about unused parameters */
+ CACTUS_MPI_ERROR (MPI_Barrier (PUGH_pGH (GH)->PUGH_COMM_WORLD));
+#else
GH = GH;
+#endif
- return 0;
+ return (0);
}
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;
diff --git a/src/PughUtils.c b/src/PughUtils.c
index b743bcc..7bfa858 100644
--- a/src/PughUtils.c
+++ b/src/PughUtils.c
@@ -2,9 +2,9 @@
@file PUGH_utils.c
@date Sunday 12th September 1999
@author Gabrielle Allen
- @desc
- @enddesc
- @version $Header$
+ @desc
+ @version $Id$
+ @enddesc
@@*/
#include <stdlib.h>
@@ -32,35 +32,29 @@ CCTK_FILEVERSION(CactusPUGH_PUGH_PughUtils_c)
/********************************************************************
******************** External Routines ************************
********************************************************************/
-void PUGH_Report(CCTK_ARGUMENTS);
-void PUGH_PrintStorageReport (CCTK_ARGUMENTS);
+int PUGH_QueryGroupStorage (const cGH *GH, int group, const char *groupname);
+void PUGH_Report(const cGH *GH);
+void PUGH_PrintStorageReport (const cGH *GH);
void PUGHi_PrintStorageReport (void);
-void PUGH_PrintFinalStorageReport (CCTK_ARGUMENTS);
-void PUGH_PrintStorage(cGH *GH);
-int PUGH_QueryGroupStorage (cGH *GH, int group, const char *groupname);
+void PUGH_PrintFinalStorageReport (const cGH *GH);
+void PUGH_PrintStorage(const cGH *GH);
void CCTK_FCALL CCTK_FNAME (PUGH_PrintStorage)
- (cGH *cctkGH);
+ (const cGH *GH);
/*@@
@routine PUGH_Topology
@date Sunday 28 October 2001
@author Gabrielle Allen
- @desc
- Return the processor topology for grid functions for a given dimension
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
-
+ @desc
+ Return the processor topology for grid functions
+ for a given dimension
+ @enddesc
@@*/
-
-int *PUGH_Topology(cGH *GH,int dim)
+const int *PUGH_Topology (const cGH *GH, int dim)
{
pGH *pughGH;
- pughGH = PUGH_pGH(GH);
+ pughGH = PUGH_pGH (GH);
return pughGH->Connectivity[dim-1]->nprocs;
}
@@ -69,33 +63,25 @@ int *PUGH_Topology(cGH *GH,int dim)
@routine PUGH_Report
@date Sunday 12 September 1999
@author Gabrielle Allen
- @desc
- Report on PUGH set up
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
-
+ @desc
+ Report on PUGH set up
+ @enddesc
@@*/
-
-void PUGH_Report(CCTK_ARGUMENTS)
+void PUGH_Report (const cGH *GH)
{
- DECLARE_CCTK_PARAMETERS
-
- pGH *pughGH;
+ pGH *pughGH;
int i,gi,dim;
int *havedims;
char *mess;
#ifdef CCTK_MPI
int in;
#endif
+ DECLARE_CCTK_PARAMETERS
- pughGH = PUGH_pGH(cctkGH);
+ pughGH = PUGH_pGH(GH);
+
+ havedims = (int *)calloc(GH->cctk_dim,sizeof(int));
- havedims = (int *)calloc(cctkGH->cctk_dim,sizeof(int));
-
mess = (char *)malloc(200*sizeof(char));
#ifdef CCTK_MPI
@@ -114,7 +100,7 @@ void PUGH_Report(CCTK_ARGUMENTS)
}
}
- for (dim=0;dim<cctkGH->cctk_dim;dim++)
+ for (dim=0;dim<GH->cctk_dim;dim++)
{
if (havedims[dim])
{
@@ -133,9 +119,9 @@ void PUGH_Report(CCTK_ARGUMENTS)
}
sprintf(mess,"%s %d",mess,pughGH->Connectivity[dim]->nprocs[dim]);
CCTK_INFO(mess);
-
- if (CCTK_Equals(partition, "automatic"))
- {
+
+ if (CCTK_Equals(partition, "automatic"))
+ {
sprintf(mess," Local load: %d [",pughGH->GFExtras[dim]->npoints);
for (i=0;i<dim;i++)
{
@@ -144,26 +130,26 @@ void PUGH_Report(CCTK_ARGUMENTS)
sprintf(mess,"%s%d]",mess,pughGH->GFExtras[dim]->lnsize[i]);
CCTK_INFO(mess);
- if (CCTK_Equals(info,"load"))
- {
- for (in=0; in<pughGH->nprocs; in++)
- {
- sprintf(mess," Local load on processor %d: %d [",
- in,pughGH->GFExtras[dim]->rnpoints[in]);
- for (i=0;i<dim;i++)
- {
- sprintf(mess,"%s%d x ",mess,
- pughGH->GFExtras[dim]->rnsize[in][i]);
- }
- sprintf(mess,"%s%d]",mess,pughGH->GFExtras[dim]->rnsize[in][i]);
- CCTK_INFO(mess);
- }
- }
-
- }
- else
+ if (CCTK_Equals(info,"load"))
+ {
+ for (in=0; in<pughGH->nprocs; in++)
+ {
+ sprintf(mess," Local load on processor %d: %d [",
+ in,pughGH->GFExtras[dim]->rnpoints[in]);
+ for (i=0;i<dim;i++)
+ {
+ sprintf(mess,"%s%d x ",mess,
+ pughGH->GFExtras[dim]->rnsize[in][i]);
+ }
+ sprintf(mess,"%s%d]",mess,pughGH->GFExtras[dim]->rnsize[in][i]);
+ CCTK_INFO(mess);
+ }
+ }
+
+ }
+ else
{ /* manual partition */
- for (in=0; in<pughGH->nprocs; in++)
+ for (in=0; in<pughGH->nprocs; in++)
{
sprintf(mess," Local load on proc %d: %d [",
in,pughGH->GFExtras[dim]->rnpoints[in]);
@@ -173,8 +159,8 @@ void PUGH_Report(CCTK_ARGUMENTS)
}
sprintf(mess,"%s%d]",mess,pughGH->GFExtras[dim]->rnsize[in][i]);
CCTK_INFO(mess);
- }
- }
+ }
+ }
CCTK_VInfo(CCTK_THORNSTRING, " Maximum load skew: %f",
pughGH->GFExtras[dim]->maxskew);
@@ -192,19 +178,26 @@ void PUGH_Report(CCTK_ARGUMENTS)
@routine PUGH_pGH
@date Wed Feb 2 13:27:41 2000
@author Tom Goodale
- @desc
- This takes a cGH and returns the active pGH.
- Needed once the pugh GH Extension changes from being
- a pGH to a structure containing pGHs for multi-patch stuff.
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
+ @desc
+ This takes a cGH and returns the active pGH.
+ Needed once the pugh GH Extension changes from being
+ a pGH to a structure containing pGHs for multi-patch stuff.
+ @enddesc
+ @calls CCTK_GHExtension
+ @var GH
+ @vdesc pointer to grid hierarchy
+ @vtype const cGH *
+ @vio in
+ @endvar
+
+ @returntype pGH *
+ @returndesc
+ the PUGH GH extension pointer,<BR>
+ or NULL if no PUGH GH extension was registered yet
+ @endreturndesc
@@*/
-pGH *PUGH_pGH(cGH *GH)
+pGH *PUGH_pGH (const cGH *GH)
{
return ((pGH *) CCTK_GHExtension (GH, "PUGH"));
}
@@ -214,10 +207,10 @@ pGH *PUGH_pGH(cGH *GH)
@routine PUGH_MPIDataType
@date Fri 26 Jan 2001
@author Thomas Radke
- @desc
+ @desc
This routine returns the MPI data type to use
for communicating a given CCTK datatype.
- @enddesc
+ @enddesc
@var pughGH
@vdesc Pointer to PUGH extensions
@@ -285,20 +278,18 @@ MPI_Datatype PUGH_MPIDataType (pGH *pughGH, int cctk_type)
@author Gabrielle Allen
@date 16th Sept 2001
@desc
- Print a report about the use of storage
+ Print a report about the use of storage
@enddesc
@@*/
-void PUGH_PrintStorageReport (CCTK_ARGUMENTS)
+void PUGH_PrintStorageReport (const cGH *GH)
{
DECLARE_CCTK_PARAMETERS
- DECLARE_CCTK_ARGUMENTS
- if (storage_report_every > 0)
- {
- if (cctk_iteration % storage_report_every == 0)
- {
- PUGHi_PrintStorageReport();
- }
+
+ if (storage_report_every > 0 &&
+ GH->cctk_iteration % storage_report_every == 0)
+ {
+ PUGHi_PrintStorageReport();
}
}
@@ -308,13 +299,13 @@ void PUGH_PrintStorageReport (CCTK_ARGUMENTS)
@author Gabrielle Allen
@date 16th Sept 2001
@desc
- Print a report about the use of storage
+ Print a report about the use of storage
@enddesc
@@*/
-void PUGH_PrintFinalStorageReport (CCTK_ARGUMENTS)
+void PUGH_PrintFinalStorageReport (const cGH *GH)
{
- cctkGH = cctkGH;
- PUGHi_PrintStorageReport();
+ GH = GH;
+ PUGHi_PrintStorageReport ();
}
@@ -326,7 +317,7 @@ void PUGH_PrintFinalStorageReport (CCTK_ARGUMENTS)
Print grid variables with storage assigned
@enddesc
@@*/
-void PUGH_PrintStorage(cGH *cctkGH)
+void PUGH_PrintStorage (const cGH *GH)
{
int i;
int countgf;
@@ -335,7 +326,7 @@ void PUGH_PrintStorage(cGH *cctkGH)
char *messgf=NULL;
char *messarray=NULL;
char *messscalar=NULL;
-
+
countgf = 0;
countarray = 0;
countscalar = 0;
@@ -344,19 +335,19 @@ void PUGH_PrintStorage(cGH *cctkGH)
for (i=0;i<CCTK_NumGroups();i++)
{
- if (PUGH_QueryGroupStorage(cctkGH,i,NULL))
+ if (PUGH_QueryGroupStorage(GH,i,NULL))
{
if (CCTK_GroupTypeI(i) == CCTK_GF)
{
- countgf += strlen(CCTK_GroupName(i))+1;
+ countgf += strlen(CCTK_GroupName(i))+1;
}
else if (CCTK_GroupTypeI(i) == CCTK_ARRAY)
{
- countarray += strlen(CCTK_GroupName(i))+1;
+ countarray += strlen(CCTK_GroupName(i))+1;
}
else if (CCTK_GroupTypeI(i) == CCTK_SCALAR)
{
- countscalar += strlen(CCTK_GroupName(i))+1;
+ countscalar += strlen(CCTK_GroupName(i))+1;
}
}
}
@@ -380,23 +371,23 @@ void PUGH_PrintStorage(cGH *cctkGH)
for (i=0;i<CCTK_NumGroups();i++)
{
- if (PUGH_QueryGroupStorage(cctkGH,i,NULL))
+ if (PUGH_QueryGroupStorage(GH,i,NULL))
{
if (CCTK_GroupTypeI(i) == CCTK_GF)
{
- sprintf(messgf,"%s%s ",messgf,CCTK_GroupName(i));
+ sprintf(messgf,"%s%s ",messgf,CCTK_GroupName(i));
}
else if (CCTK_GroupTypeI(i) == CCTK_ARRAY)
{
- sprintf(messarray,"%s%s ",messarray,CCTK_GroupName(i));
+ sprintf(messarray,"%s%s ",messarray,CCTK_GroupName(i));
}
else if (CCTK_GroupTypeI(i) == CCTK_SCALAR)
{
- sprintf(messscalar,"%s%s ",messscalar,CCTK_GroupName(i));
+ sprintf(messscalar,"%s%s ",messscalar,CCTK_GroupName(i));
}
}
}
-
+
if (messgf||messarray||messscalar)
{
CCTK_VInfo(CCTK_THORNSTRING,"Grid Variables with storage enabled:");
@@ -421,10 +412,7 @@ void PUGH_PrintStorage(cGH *cctkGH)
}
void CCTK_FCALL CCTK_FNAME (PUGH_PrintStorage)
- (cGH *cctkGH)
+ (const cGH *GH)
{
- PUGH_PrintStorage(cctkGH);
+ PUGH_PrintStorage (GH);
}
-
-
-
diff --git a/src/SetupPGH.c b/src/SetupPGH.c
index f9b05e4..4abb52e 100644
--- a/src/SetupPGH.c
+++ b/src/SetupPGH.c
@@ -2,9 +2,9 @@
@file SetupPGH.c
@date Fri Feb 21 10:18:17 1997
@author Paul Walker
- @desc
- Initializes the Pugh Grid Hierachy.
- @enddesc
+ @desc
+ Initializes the Pugh Grid Hierachy.
+ @enddesc
@version $Id$
@@*/
@@ -38,12 +38,12 @@ static int Setup_nProcs (pGH *pughGH, int dim);
@routine PUGH_SetupPGH
@date Fri Feb 21 10:21:36 1997
@author Gabrielle Allen, Tom Goodale, Paul Walker
- @desc
+ @desc
Sets up the PGH distribution based on processor number and
problem size.
This includes setting an optimal domain decomposition for each
dimension, and setting ghosts and overlaps.
- @enddesc
+ @enddesc
@var callerid
@vdesc back reference to the calling cGH structure
@@ -81,12 +81,12 @@ static int Setup_nProcs (pGH *pughGH, int dim);
the pointer to the new pGH structure
@endreturndesc
@@*/
-pGH *PUGH_SetupPGH (void *callerid,
- int dim,
- int *nsize,
+pGH *PUGH_SetupPGH (void *callerid,
+ int dim,
+ int *nsize,
int *nghostzones,
int staggertype,
- int *perme)
+ int *perme)
{
DECLARE_CCTK_PARAMETERS
pGH *pughGH;
@@ -127,7 +127,7 @@ pGH *PUGH_SetupPGH (void *callerid,
pughGH->Connectivity[idim-1] = PUGH_SetupConnectivity (idim, pughGH->nprocs,
nprocs, perme);
free(nprocs);
-
+
pughGH->GFExtras[idim-1] = PUGH_SetupPGExtras (idim, perme, staggertype,
nsize, nghostzones,
pughGH->nprocs,
@@ -186,9 +186,9 @@ int PUGH_Terminate (cGH *GH)
@routine PUGH_DestroyPGH
@date Thu Aug 21 11:38:10 1997
@author Paul Walker
- @desc
+ @desc
Destroys a GH object.
- @enddesc
+ @enddesc
@var GHin
@vdesc address of PUGH GH extensions object to be destroyed
@@ -196,7 +196,7 @@ int PUGH_Terminate (cGH *GH)
@vio in
@endvar
@@*/
-void PUGH_DestroyPGH (pGH **GHin)
+void PUGH_DestroyPGH (pGH **GHin)
{
pGH *GH;
pGA *GA;
@@ -231,7 +231,7 @@ void PUGH_DestroyPGH (pGH **GHin)
#ifdef DEBUG_PUGH
printf("Calling Destroying Group %s\n", CCTK_GroupName(group));
fflush(stdout);
-#endif
+#endif
CCTK_GroupData(group,&pgroup);
@@ -263,7 +263,7 @@ void PUGH_DestroyPGH (pGH **GHin)
}
}
- for (this_var = 0; this_var < pgroup.numvars; this_var++, variable++)
+ for (this_var = 0; this_var < pgroup.numvars; this_var++, variable++)
{
for(i = 0 ; i < pgroup.numtimelevels; i++)
{
@@ -307,7 +307,7 @@ void PUGH_DestroyPGH (pGH **GHin)
@routine PUGH_SetupDefaultTopology
@date Sun 23 Jan 1999
@author Gabrielle Allen
- @desc
+ @desc
Set the processor decomposition from PUGH parameters.
@enddesc
@@ -487,7 +487,7 @@ int PUGH_Abort (cGH *GH, int retval)
@var GH
@vdesc Pointer to CCTK grid hierarchy
- @vtype cGH *
+ @vtype const cGH *
@vio in
@endvar
@@ -496,7 +496,7 @@ int PUGH_Abort (cGH *GH, int retval)
the processor number of the caller
@endreturndesc
@@*/
-int PUGH_MyProc (cGH *GH)
+int PUGH_MyProc (const cGH *GH)
{
int myproc;
@@ -505,6 +505,7 @@ int PUGH_MyProc (cGH *GH)
CACTUS_MPI_ERROR (MPI_Comm_rank (GH ? PUGH_pGH (GH)->PUGH_COMM_WORLD :
MPI_COMM_WORLD, &myproc));
#else
+ GH = GH;
myproc = 0;
#endif
@@ -523,7 +524,7 @@ int PUGH_MyProc (cGH *GH)
@var GH
@vdesc Pointer to CCTK grid hierarchy
- @vtype cGH *
+ @vtype const cGH *
@vio in
@endvar
@@ -532,7 +533,7 @@ int PUGH_MyProc (cGH *GH)
the total number of processors
@endreturndesc
@@*/
-int PUGH_nProcs (cGH *GH)
+int PUGH_nProcs (const cGH *GH)
{
int nprocs;
@@ -541,6 +542,7 @@ int PUGH_nProcs (cGH *GH)
CACTUS_MPI_ERROR (MPI_Comm_size (GH ? PUGH_pGH (GH)->PUGH_COMM_WORLD :
MPI_COMM_WORLD, &nprocs));
#else
+ GH = GH;
nprocs = 1;
#endif
@@ -549,7 +551,7 @@ int PUGH_nProcs (cGH *GH)
#if 0
-void pGH_DumpInfo(pGH *GH)
+void pGH_DumpInfo(pGH *GH)
{
int i,j,k;
printf("INFO: \n");
@@ -626,7 +628,7 @@ static int Setup_nProcs (pGH *pughGH, int dim)
CCTK_REAL4 sum_sizes [2], compiled_sizes [2];
- /* Set up my communicator. This would allow us to run pugh on
+ /* Set up my communicator. This would allow us to run pugh on
a subset of processors at a later date if, for instance, we
were using panda or what not.
*/
diff --git a/src/Storage.c b/src/Storage.c
index c62b361..3fe0334 100644
--- a/src/Storage.c
+++ b/src/Storage.c
@@ -341,31 +341,31 @@ int PUGH_EnableGroupStorage (cGH *GH, const char *groupname)
{
/* get GA pointer of first var in group */
GA = (pGA *) pughGH->variables[first_var][0];
- if (pgroup.grouptype == CCTK_GF)
- {
- totalnumberGF += pgroup.numvars * pgroup.numtimelevels;
- }
- else
- {
- totalnumberGA += pgroup.numvars * pgroup.numtimelevels;
- }
+ if (pgroup.grouptype == CCTK_GF)
+ {
+ totalnumberGF += pgroup.numvars * pgroup.numtimelevels;
+ }
+ else
+ {
+ totalnumberGA += pgroup.numvars * pgroup.numtimelevels;
+ }
totalstorage += (GA->extras->npoints * GA->varsize *
pgroup.numtimelevels * pgroup.numvars) /
(float) (1024*1024);
- if (totalstorage > maxstorage)
- {
- numberGF = totalnumberGF;
- numberGA = totalnumberGA;
- maxstorage = totalstorage;
- }
-
- /* Report on memory usage */
- if (CCTK_Equals(storage_verbose,"yes"))
- {
- CCTK_VInfo (CCTK_THORNSTRING, "Switched memory on for group '%s'"
- " [GFs: %d GAs: %d Total Size: %6.2fMB]",
- groupname, totalnumberGF, totalnumberGA, totalstorage);
- }
+ if (totalstorage > maxstorage)
+ {
+ numberGF = totalnumberGF;
+ numberGA = totalnumberGA;
+ maxstorage = totalstorage;
+ }
+
+ /* Report on memory usage */
+ if (CCTK_Equals(storage_verbose,"yes"))
+ {
+ CCTK_VInfo (CCTK_THORNSTRING, "Switched memory on for group '%s'"
+ " [GFs: %d GAs: %d Total Size: %6.2fMB]",
+ groupname, totalnumberGF, totalnumberGA, totalstorage);
+ }
}
}
@@ -496,24 +496,25 @@ int PUGH_DisableGroupStorage (cGH *GH, const char *groupname)
{
if (unchanged == 0)
{
-
+
/* Memory toggled */
if (pgroup.grouptype == CCTK_GF)
{
- totalnumberGF -= pgroup.numvars;
+ totalnumberGF -= pgroup.numvars;
}
else if (pgroup.grouptype == CCTK_ARRAY)
{
- totalnumberGA -= pgroup.numvars;
+ totalnumberGA -= pgroup.numvars;
}
totalstorage -= (variables[first_var][0]->extras->npoints *
variables[first_var][0]->varsize *
- pgroup.numtimelevels * pgroup.numvars) / (float) (1024 * 1024);
+ pgroup.numtimelevels * pgroup.numvars) /
+ (float) (1024 * 1024);
if (CCTK_Equals(storage_verbose,"yes"))
{
- CCTK_VInfo (CCTK_THORNSTRING, "Switched memory off for group '%s'"
- " [GFs: %d GAs: %d Total Size: %6.2fMB]",
- groupname, totalnumberGF, totalnumberGA, totalstorage);
+ CCTK_VInfo (CCTK_THORNSTRING, "Switched memory off for group '%s'"
+ " [GFs: %d GAs: %d Total Size: %6.2fMB]",
+ groupname, totalnumberGF, totalnumberGA, totalstorage);
}
}
else if (unchanged == pgroup.numvars)
@@ -521,7 +522,7 @@ int PUGH_DisableGroupStorage (cGH *GH, const char *groupname)
/* Memory already off */
if (CCTK_Equals(storage_verbose,"yes"))
{
- CCTK_VInfo (CCTK_THORNSTRING, "Memory already off for group '%s'", groupname);
+ CCTK_VInfo (CCTK_THORNSTRING, "Memory already off for group '%s'", groupname);
}
}
else
@@ -771,6 +772,7 @@ static int PUGH_EnableGArrayGroupStorage (pGH *pughGH,
padding_size = padding_size;
padding_address_spacing = padding_address_spacing;
+ retval = 0;
if (GA->storage == PUGH_NOSTORAGE)
{
@@ -824,21 +826,18 @@ static int PUGH_EnableGArrayGroupStorage (pGH *pughGH,
}
}
- retval = GA->extras->npoints * GA->varsize < 0 ||
- GA->padddata != NULL ? 0 : -1;
-
-
- if (retval)
+ if (GA->extras->npoints * GA->varsize < 0 || GA->padddata != NULL)
{
CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING,
- "PUGH_EnableGArrayDataStorage: Cannot allocate data for '%s' [%d]",
- GA->name, GA->id);
+ "PUGH_EnableGArrayDataStorage: Cannot allocate data for "
+ "'%s' [%d]", GA->name, GA->id);
+ retval = -1;
}
}
GA->storage = PUGH_STORAGE;
- return retval;
+ return (retval);
}
@@ -872,13 +871,13 @@ static int PUGH_EnableGArrayGroupStorage (pGH *pughGH,
if (GA->storage == PUGH_STORAGE)
{
-
+
#ifdef DEBUG_PUGH
printf ("PUGH_DisableGArrayDataStorage: freeing storage for var '%s'\n",
GA->name);
fflush (stdout);
#endif
-
+
if(GA->vector_size > 1 && GA->vector_entry > 0)
{
GA->data = GA->padddata;
@@ -968,7 +967,7 @@ static void PUGH_InitializeMemory (const char *initialize_memory,
@author Gabrielle Allen
@date 16th Sept 2001
@desc
- Print a report about the use of storage
+ Print a report about the use of storage
@enddesc
@@*/
void PUGHi_PrintStorageReport ()
diff --git a/src/include/pugh.h b/src/include/pugh.h
index c656652..cae3a4a 100644
--- a/src/include/pugh.h
+++ b/src/include/pugh.h
@@ -110,7 +110,7 @@
#endif
#ifdef __cplusplus
-extern "C"
+extern "C"
{
#endif
@@ -126,9 +126,9 @@ int PUGH_SetupGroup (pGH *newGH,
int n_timelevels,
int vectorgroup);
-pGH *PUGH_SetupPGH(void *callerid,
- int dim,
- int *nsize,
+pGH *PUGH_SetupPGH(void *callerid,
+ int dim,
+ int *nsize,
int *nghostzones,
int staggertype,
int *perme);
@@ -138,9 +138,9 @@ void PUGH_GFSize(int dim, int *nsize);
void PUGH_GFGhostsize(int dim, int *ghostsize);
void PUGH_GFPeriodic(int dim, int *perme);
-pGH *PUGH_pGH(cGH *GH);
+pGH *PUGH_pGH(const cGH *GH);
-int PUGH_Evolve(tFleshConfig *config);
+int PUGH_Evolve(tFleshConfig *config);
int PUGH_GetBounds(int dim,
int **bounds,
@@ -153,16 +153,16 @@ int PUGH_ParallelInit(cGH *GH);
int PUGH_Abort(cGH *GH, int retval);
-int PUGH_MyProc(cGH *GH);
+int PUGH_MyProc(const cGH *GH);
-int PUGH_nProcs(cGH *GH);
+int PUGH_nProcs(const cGH *GH);
int PUGH_Exit(cGH *GH, int retval);
-int *PUGH_Topology(cGH *GH, int dim);
+const int *PUGH_Topology(const cGH *GH, int dim);
#ifdef CCTK_MPI
-MPI_Datatype PUGH_MPIDataType (pGH *pughGH, int cctk_type);
+MPI_Datatype PUGH_MPIDataType (const pGH *pughGH, int cctk_type);
#endif
#ifdef __cplusplus
diff --git a/src/pugh_Comm.h b/src/pugh_Comm.h
index 899753f..4a67405 100644
--- a/src/pugh_Comm.h
+++ b/src/pugh_Comm.h
@@ -24,7 +24,7 @@ int PUGH_DisableGroupStorage(cGH *GH, const char *group);
int PUGH_EnableGroupComm(cGH *GH, const char *group);
int PUGH_DisableGroupComm(cGH *GH, const char *group);
-int PUGH_Barrier(cGH *GH);
+int PUGH_Barrier(const cGH *GH);
int PUGH_Reduce(cGH *GH,
const char *operation,
int n_infields,
@@ -42,13 +42,6 @@ int PUGH_Interp(cGH *GH,
int type,
...);
-int PUGH_ParallelInit(cGH *GH);
-int PUGH_Exit(cGH *GH, int retval);
-int PUGH_Abort(cGH *GH, int retval);
-
-int PUGH_MyProc(cGH *GH);
-int PUGH_nProcs(cGH *GH);
-
const int *PUGH_ArrayGroupSize(cGH *GH, int dir, int vindex, const char *groupname);
int PUGH_QueryGroupStorage(cGH *GH, int group, const char *groupname);