aboutsummaryrefslogtreecommitdiff
path: root/src/SetupGroup.c
diff options
context:
space:
mode:
authorgoodale <goodale@b61c5cb5-eaca-4651-9a7a-d64986f99364>1999-02-09 13:07:08 +0000
committergoodale <goodale@b61c5cb5-eaca-4651-9a7a-d64986f99364>1999-02-09 13:07:08 +0000
commitd919ae097799902d0e222874832dcd6a2206d0a5 (patch)
tree0fd0e7e910d6c97c5785ca3c428ea4e1f5bc77b6 /src/SetupGroup.c
parente3d49cea21dfeddf50636ea42d11ae4968f3b1a9 (diff)
Now creates all variable types except arrays.
Tom git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGH/trunk@6 b61c5cb5-eaca-4651-9a7a-d64986f99364
Diffstat (limited to 'src/SetupGroup.c')
-rw-r--r--src/SetupGroup.c51
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;
}