diff options
Diffstat (limited to 'src/SetupGroup.c')
-rw-r--r-- | src/SetupGroup.c | 51 |
1 files changed, 43 insertions, 8 deletions
diff --git a/src/SetupGroup.c b/src/SetupGroup.c index e1678d3..4290f5b 100644 --- a/src/SetupGroup.c +++ b/src/SetupGroup.c @@ -7,6 +7,7 @@ @enddesc @@*/ +#include <stdio.h> #include <stdlib.h> #include "cctk.h" @@ -16,16 +17,16 @@ #include "pugh.h" -/*#include "pGH.h"*/ - static char *rcisd = "$Header$"; +pGF *SetupPGF(pGH *GH, const char *name, int dim); + /*@@ @routine pugh_SetupGroup @date Mon Feb 8 19:37:55 1999 @author Tom Goodale @desc - Sets up a griup on a pGH + Sets up a group on a pGH @enddesc @calls @calledby @@ -34,7 +35,7 @@ static char *rcisd = "$Header$"; @endhistory @@*/ -int pugh_SetupGroup(pGH *newGH, int gtype, int vtype, int n_variables) +int pugh_SetupGroup(pGH *newGH, int gtype, int vtype, int dim, int n_variables) { int returncode; switch(gtype) @@ -44,11 +45,13 @@ int pugh_SetupGroup(pGH *newGH, int gtype, int vtype, int n_variables) n_variables); break; case GROUP_ARRAY : returncode = pugh_SetupScalarGroup(newGH, - vtype, + vtype, + dim, n_variables); break; case GROUP_GF : returncode = pugh_SetupScalarGroup(newGH, - vtype, + vtype, + dim, n_variables); break; default : fprintf(stderr, "Unknown group type in pugh_SetupGroup\n"); @@ -110,12 +113,44 @@ int pugh_SetupScalarGroup(pGH *newGH, int vtype, int n_variables) return 0; } -int pugh_SetupArrayGroup(pGH *newGH, int vtype, int n_variables) +int pugh_SetupArrayGroup(pGH *newGH, int vtype, int dim, int n_variables) { return 0; } -int pugh_SetupGFGroup(pGH *newGH, int vtype, int n_variables) +int pugh_SetupGFGroup(pGH *newGH, int vtype, int dim, 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] = SetupPGF(newGH, CCTK_GetVarName(n_variables), dim); + } + } + return 0; } |