diff options
-rw-r--r-- | src/SetupGroup.c | 121 | ||||
-rw-r--r-- | src/SetupPGH.c | 21 | ||||
-rw-r--r-- | src/Startup.c | 4 | ||||
-rw-r--r-- | src/include/pGH.h | 6 | ||||
-rw-r--r-- | src/make.code.defn | 2 | ||||
-rw-r--r-- | src/pugh_Comm.h | 4 |
6 files changed, 134 insertions, 24 deletions
diff --git a/src/SetupGroup.c b/src/SetupGroup.c new file mode 100644 index 0000000..e1678d3 --- /dev/null +++ b/src/SetupGroup.c @@ -0,0 +1,121 @@ + /*@@ + @file SetupGroup.c + @date Mon Feb 8 19:31:45 1999 + @author Tom Goodale + @desc + Subroutines for setting up a group on a pGH. + @enddesc + @@*/ + +#include <stdlib.h> + +#include "cctk.h" + +#include "flesh.h" +#include "Groups.h" + +#include "pugh.h" + +/*#include "pGH.h"*/ + +static char *rcisd = "$Header$"; + + /*@@ + @routine pugh_SetupGroup + @date Mon Feb 8 19:37:55 1999 + @author Tom Goodale + @desc + Sets up a griup on a pGH + @enddesc + @calls + @calledby + @history + + @endhistory + +@@*/ +int pugh_SetupGroup(pGH *newGH, int gtype, int vtype, int n_variables) +{ + int returncode; + switch(gtype) + { + case GROUP_SCALAR : returncode = pugh_SetupScalarGroup(newGH, + vtype, + n_variables); + break; + case GROUP_ARRAY : returncode = pugh_SetupScalarGroup(newGH, + vtype, + n_variables); + break; + case GROUP_GF : returncode = pugh_SetupScalarGroup(newGH, + vtype, + n_variables); + break; + default : fprintf(stderr, "Unknown group type in pugh_SetupGroup\n"); + returncode = 1; + } + + return returncode; +} + +int pugh_SetupScalarGroup(pGH *newGH, int vtype, int n_variables) +{ + int variable; + + int var_size; + + void **temp; + + int returncode; + + switch(vtype) + { + case VARIABLE_CHAR : var_size = sizeof(char); break; + case VARIABLE_INTEGER : var_size = sizeof(int) ; break; + case VARIABLE_REAL : var_size = sizeof(Double); break; + case VARIABLE_COMPLEX : var_size = sizeof(Complex); break; + default : fprintf(stderr, + "Unknown variable type in pugh_SetupScalarGroup\n"); + var_size = 1; + } + + temp = (void **)realloc(newGH->variables, (newGH->nvariables+n_variables)*sizeof(void *)); + + if(temp) + { + newGH->variables = temp; + + for(variable = 0; variable < n_variables; variable++) + { + newGH->variables[newGH->nvariables] = (void *)malloc(var_size); + + if(newGH->variables[newGH->nvariables]) + { + newGH->nvariables++; + } + else + { + fprintf(stderr, "Memory error in SetupScalarGroup at line %d\n", + __LINE__); + break; + } + } + } + else + { + fprintf(stderr, "Memory error in SetupScalarGroup at line %d\n", + __LINE__); + } + + return 0; +} + +int pugh_SetupArrayGroup(pGH *newGH, int vtype, int n_variables) +{ + return 0; +} + +int pugh_SetupGFGroup(pGH *newGH, int vtype, int n_variables) +{ + return 0; +} diff --git a/src/SetupPGH.c b/src/SetupPGH.c index 16cc8ca..d137131 100644 --- a/src/SetupPGH.c +++ b/src/SetupPGH.c @@ -250,13 +250,9 @@ void pGH_SetupBasics(pGH *GH, int nx, int ny, int nz, GH->periodic = 0; - /* Grid function list */ - GH->ngridFuncs = 0; - GH->gridFuncs = NULL; - - /* Array Llist */ - GH->nArrays = 0; - GH->Arrays = NULL; + /* Variable list */ + GH->nvariables = 0; + GH->variables = NULL; /* Allocate the bounds memory */ GH->lb = (int **)malloc(GH->nprocs*sizeof(int *)); @@ -979,16 +975,11 @@ void DestroyPGH(pGH **GHin) { } /* Great. Now go about the work of destroying me. */ - for (i=0;i<GH->ngridFuncs;i++) - DestroyPGF(GH, &(GH->gridFuncs[i])); + for (i=0;i<GH->nvariables;i++) + DestroyPGF(GH, &(GH->variables[i])); - for (i=0;i<GH->nArrays;i++){ - fflush(stdout); - DestroyPGArray(GH,&(GH->Arrays[i])); - } - free(GH->gridFuncs); - free(GH->Arrays); + free(GH->variables); free(GH->lb[0]); free(GH->lb); diff --git a/src/Startup.c b/src/Startup.c index 1f2f25a..8298b0e 100644 --- a/src/Startup.c +++ b/src/Startup.c @@ -51,10 +51,10 @@ void pugh_Startup(void) /* Overload some functions */ CCTK_OverloadSyncGroup(pugh_SyncGroup); CCTK_OverloadEnableGroupStorage(pugh_EnableGroupStorage); - CCTK_OverloadDisableGroupStorage(pugh_EnableGroupStorage); + CCTK_OverloadDisableGroupStorage(pugh_DisableGroupStorage); CCTK_OverloadEnableGroupComm(pugh_EnableGroupComm); - CCTK_OverloadDisableGroupComm(pugh_EnableGroupComm); + CCTK_OverloadDisableGroupComm(pugh_DisableGroupComm); CCTK_OverloadBarrier(pugh_Barrier); CCTK_OverloadReduce(pugh_Reduce); diff --git a/src/include/pGH.h b/src/include/pGH.h index 4318612..78ecf7d 100644 --- a/src/include/pGH.h +++ b/src/include/pGH.h @@ -39,13 +39,11 @@ typedef struct PGH { /* or PUGH_DERIVEDTYPES. Currently unused */ /* Size of the problems */ - int ngridFuncs; /* # of Grid Functions */ - pGF **gridFuncs; /* Pointers to them */ + int nvariables; /* # of Grid Functions */ + void **variables; /* Pointers to them */ int nx,ny,nz; /* Physical size of the Problem */ int stencil_width; /* Width of ghost zone */ - int nArrays; /* # of pGArrays */ - pGArray **Arrays; /* Pointers to them */ /* Processor group layouts */ Double maxskew; /* Maximum point skew */ diff --git a/src/make.code.defn b/src/make.code.defn index 640faaa..4628886 100644 --- a/src/make.code.defn +++ b/src/make.code.defn @@ -1,7 +1,7 @@ # Main make.code.defn file for thorn pugh # : /usr/users/cactus/CCTK/lib/make/new_thorn.pl,v 1.1 1999/02/03 17:00:50 goodale Exp n # Source files in this directory -SRCS = Startup.c GHExtension.c Comm.c SetupPGH.c +SRCS = Startup.c GHExtension.c Comm.c SetupPGH.c SetupGroup.c # Subdirectories containing source files SUBDIRS = diff --git a/src/pugh_Comm.h b/src/pugh_Comm.h index 0108c7b..e58420c 100644 --- a/src/pugh_Comm.h +++ b/src/pugh_Comm.h @@ -18,10 +18,10 @@ extern "C" { /* Overloaded functions. */ int pugh_SyncGroup(cGH *GH, const char *group); int pugh_EnableGroupStorage(cGH *GH, const char *group); -int pugh_EnableGroupStorage(cGH *GH, const char *group); +int pugh_DisableGroupStorage(cGH *GH, const char *group); int pugh_EnableGroupComm(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_Reduce(cGH *GH, |