diff options
-rwxr-xr-x | lib/make/configure | 5 | ||||
-rw-r--r-- | lib/make/configure.in | 5 | ||||
-rw-r--r-- | lib/make/force-rebuild | 6 | ||||
-rw-r--r-- | lib/sbin/CST | 4 | ||||
-rw-r--r-- | lib/sbin/GridFuncStuff.pl | 24 | ||||
-rw-r--r-- | lib/sbin/interface_parser.pl | 42 | ||||
-rw-r--r-- | src/include/cctk_Groups.h | 1 | ||||
-rw-r--r-- | src/include/cctki_Groups.h | 3 | ||||
-rw-r--r-- | src/main/Groups.c | 106 |
9 files changed, 80 insertions, 116 deletions
diff --git a/lib/make/configure b/lib/make/configure index d2c5d802..b9cb7727 100755 --- a/lib/make/configure +++ b/lib/make/configure @@ -4824,10 +4824,7 @@ fi # How to link the cactus libraries -# Currently (2003-10-07) the dependencies from the configure.ccl file are -# not handled correctly. As a temporary work-around, we re-enable the -# old behaviour. -: ${CACTUSLIBLINKLINE='-L$(CCTK_LIBDIR) $(addprefix -l, $(ALLCACTUSLIBS) $(ALLCACTUSLIBS))'} +: ${CACTUSLIBLINKLINE='-L$(CCTK_LIBDIR) $(addprefix -l, $(ALLCACTUSLIBS))'} # How to generate C dependency info diff --git a/lib/make/configure.in b/lib/make/configure.in index 7c650159..3fb273a5 100644 --- a/lib/make/configure.in +++ b/lib/make/configure.in @@ -904,10 +904,7 @@ AC_SUBST(LIBNAME_SUFFIX) # How to link the cactus libraries AC_SUBST(CACTUSLIBLINKLINE) -# Currently (2003-10-07) the dependencies from the configure.ccl file are -# not handled correctly. As a temporary work-around, we re-enable the -# old behaviour. -: ${CACTUSLIBLINKLINE='-L$(CCTK_LIBDIR) $(addprefix -l, $(ALLCACTUSLIBS) $(ALLCACTUSLIBS))'} +: ${CACTUSLIBLINKLINE='-L$(CCTK_LIBDIR) $(addprefix -l, $(ALLCACTUSLIBS))'} # How to generate C dependency info AC_SUBST(C_DEPEND) diff --git a/lib/make/force-rebuild b/lib/make/force-rebuild index e43dab88..c0cb471b 100644 --- a/lib/make/force-rebuild +++ b/lib/make/force-rebuild @@ -5,7 +5,7 @@ # @desc # Timestamp file for forcing rebuilds of configurations # @enddesc -# @version $Id: force-rebuild,v 1.9 2003-11-19 16:47:40 schnetter Exp $ +# @version $Id: force-rebuild,v 1.10 2003-11-21 15:27:24 schnetter Exp $ # @@*/ 6 March 2003: minor changes to CreateFunctionBindings.pl @@ -17,4 +17,6 @@ 27 October 2003: Provide function prototypes for both Fortran and C 28 October 2003: Correct passing of pointers between C and Fortran. 6 November 2003: Treat scalars as rank 0 arrays. -19 November 2003: Change include mechanism for cctk_Functions.h +19 November 2003: Change include mechanism for cctk_Functions.h. +21 November 2003: Allow vector scalars. +21 November 2003: Allow vector groups to have multiple variables. diff --git a/lib/sbin/CST b/lib/sbin/CST index 372632e3..d36a675c 100644 --- a/lib/sbin/CST +++ b/lib/sbin/CST @@ -6,7 +6,7 @@ # @desc # Parses the the configuration files for thorns. # @enddesc -# @version $Header: /mnt/data2/cvs2svn/cvs-repositories/Cactus/lib/sbin/CST,v 1.58 2003-11-18 18:27:28 tradke Exp $ +# @version $Header: /mnt/data2/cvs2svn/cvs-repositories/Cactus/lib/sbin/CST,v 1.59 2003-11-21 15:27:24 schnetter Exp $ #@@*/ # Global parameter to track the number of errors from the CST @@ -326,7 +326,7 @@ sub CreateMakeThornlist $thorn_linklist .= ' ' . &CreateThornLinkList($thorns, $config); - return ($thornlist . "\n" . $thorn_linklist . "\n" . $config_thornlist); + return ($thornlist . "\n" . $thorn_linklist . "\n" . $config_thornlist . "\n"); } diff --git a/lib/sbin/GridFuncStuff.pl b/lib/sbin/GridFuncStuff.pl index e83985ad..80fc511a 100644 --- a/lib/sbin/GridFuncStuff.pl +++ b/lib/sbin/GridFuncStuff.pl @@ -349,7 +349,7 @@ sub GetThornArguments my $vararraysize = $rhinterface_db->{"\U$thorn GROUP $group\E VARARRAY_SIZE"}; my $compactgroup = $rhinterface_db->{"\U$thorn GROUP $group\E COMPACT"}; - if($gtype eq 'GF' || $gtype eq 'ARRAY') + if($gtype eq 'GF' || $gtype eq 'ARRAY' || ($gtype eq 'SCALAR' && defined($vararraysize))) { $type .= ' ('; @@ -1078,29 +1078,25 @@ sub CreateThornGroupInitialisers { # Check that the size is allowed. &CheckArraySizes($rhinterface_db->{"\U$thorn GROUP $group\E VARARRAY_SIZE"},$thorn,$rhparameter_db,$rhinterface_db); - # Flag Cactus that it is a vector group. - $line = ' -1'; + # Pass in the size of the GV array, which may be a valid parameter expression + $line = ' "' + . $rhinterface_db->{"\U$thorn GROUP $group\E VARARRAY_SIZE"} + . '",'; + push(@data, $line); } else { - $line = ' ' . scalar(@variables); + $line = ' NULL,'; + push(@data, $line); } + $line = ' ' . scalar(@variables); + foreach $variable (@variables) { $line .= ",\n \"$variable\""; } - # Pass in the size of the GV array, which may be a valid parameter expression - if(defined($rhinterface_db->{"\U$thorn GROUP $group\E VARARRAY_SIZE"})) - { - $line .= ','; - push(@data, $line); - $line = ' "'; - $line .= $rhinterface_db->{"\U$thorn GROUP $group\E VARARRAY_SIZE"}; - $line .= '"'; - } - $line .= ') == 1)'; push(@data, $line); diff --git a/lib/sbin/interface_parser.pl b/lib/sbin/interface_parser.pl index 53ad310a..2259c2a7 100644 --- a/lib/sbin/interface_parser.pl +++ b/lib/sbin/interface_parser.pl @@ -786,7 +786,7 @@ sub parse_interface_ccl $interface_db{"\U$thorn FUNCTION\E $funcname ARGS"} .= "${funcargs} "; $interface_db{"\U$thorn FUNCTION\E $funcname RET"} .= "${rettype} "; } - elsif ($line =~ m/^\s*(CCTK_)?(CHAR|BYTE|INT|INT1|INT2|INT4|INT8|REAL|REAL4|REAL8|REAL16|COMPLEX|COMPLEX8|COMPLEX16|COMPLEX32)\s*(([a-zA-Z]+[a-zA-Z_0-9]*)(\[([^]]+)\])?)\s*(.*)\s*$/i) + elsif ($line =~ m/^\s*(CCTK_)?(CHAR|BYTE|INT|INT1|INT2|INT4|INT8|REAL|REAL4|REAL8|REAL16|COMPLEX|COMPLEX8|COMPLEX16|COMPLEX32)\s*(([a-zA-Z][a-zA-Z_0-9]*)\s*(\[([^]]+)\])?)\s*(.*)\s*$/i) { # for($i = 1; $i < 10; $i++) # { @@ -912,11 +912,6 @@ sub parse_interface_ccl $interface_db{"\U$thorn GROUP $current_group\E DIM"} = 3; } - if($interface_db{"\U$thorn GROUP $current_group\E GTYPE"} eq "SCALAR") - { - $interface_db{"\U$thorn GROUP $current_group\E DIM"} = 0; - } - if(! $interface_db{"\U$thorn GROUP $current_group\E TIMELEVELS"}) { $interface_db{"\U$thorn GROUP $current_group\E TIMELEVELS"} = 1; @@ -937,6 +932,13 @@ sub parse_interface_ccl $interface_db{"\U$thorn GROUP $current_group\E COMPACT"} = 0; } + # Override defaults for scalars + if($interface_db{"\U$thorn GROUP $current_group\E GTYPE"} eq "SCALAR") + { + $interface_db{"\U$thorn GROUP $current_group\E DIM"} = 0; + $interface_db{"\U$thorn GROUP $current_group\E DISTRIB"} = "CONSTANT"; + } + # Check that it is a known group type if($interface_db{"\U$thorn GROUP $current_group\E GTYPE"} !~ m:^\s*(SCALAR|GF|ARRAY)\s*$:) { @@ -971,37 +973,12 @@ sub parse_interface_ccl next; } - # Is it is a vararray ? - + # Is it a vararray? if($isgrouparray) { - # Create a variable with the same name as the group - $function = $current_group; - - if(! $known_variables{"\U$function\E"}) - { - $known_variables{"\U$function\E"} = 1; - - $interface_db{"\U$thorn GROUP $current_group\E"} .= " $function"; - } - else - { - &CST_error(0,"Duplicate variable $function in thorn $thorn",'', - __LINE__,__FILE__); - } - # get its size - $interface_db{"\U$thorn GROUP $current_group\E VARARRAY_SIZE"} = $grouparray_size; - - if($data[$line_number+1] =~ m/^\s*\{\s*$/) - { - &CST_error(1,"Can't give explicit list of array names with an array group - ignoring list","",__LINE__,__FILE__); - $line_number++ until ($data[$line_number] =~ m:\}:); - } } - else - { # Fill in data for the scalars/arrays/functions $line_number++; if($data[$line_number] =~ m/^\s*\{\s*$/) @@ -1055,7 +1032,6 @@ sub parse_interface_ccl $line_number--; } $interface_db{"\U$thorn GROUP $current_group\E DESCRIPTION"} = $description; - } } elsif ($line =~ m/^\s*(USES\s*INCLUDE)S?\s*(SOURCE)S?\s*:\s*(.*)\s*$/i) { diff --git a/src/include/cctk_Groups.h b/src/include/cctk_Groups.h index 2e822a98..8e5c58c9 100644 --- a/src/include/cctk_Groups.h +++ b/src/include/cctk_Groups.h @@ -21,6 +21,7 @@ typedef struct int numvars; int numtimelevels; int vectorgroup; + int vectorlength; } cGroup; /* Prototypes */ diff --git a/src/include/cctki_Groups.h b/src/include/cctki_Groups.h index c0b81ba9..a4b7d34b 100644 --- a/src/include/cctki_Groups.h +++ b/src/include/cctki_Groups.h @@ -32,7 +32,8 @@ int CCTKi_CreateGroup(const char *gname, const char *size, const char *ghostsize, const char *tags, - int n_variables, + const char *vararraysize, + int n_basevars, ...); #ifdef __cplusplus diff --git a/src/main/Groups.c b/src/main/Groups.c index 603a3e7d..38da4390 100644 --- a/src/main/Groups.c +++ b/src/main/Groups.c @@ -144,6 +144,8 @@ typedef struct int n_variables; + int vectorlength; + /* *size[dim] - pointers to parameter data*/ CCTK_INT **size; @@ -190,7 +192,8 @@ static int staggered = 0; static cGroupDefinition *CCTKi_SetupGroup (const char *implementation, const char *name, int staggercode, - int n_variables); + int n_variables, + int vectorlength); static CCTK_INT **CCTKi_ExtractSize (int dimension, const char *thorn, const char *sizestring); @@ -1008,6 +1011,7 @@ int CCTK_GroupData (int group, cGroup *gp) gp->disttype = groups[group].dtype; gp->dim = groups[group].dim; gp->numvars = groups[group].n_variables; + gp->vectorlength = groups[group].vectorlength; gp->numtimelevels = groups[group].n_timelevels; gp->stagtype = groups[group].staggertype; @@ -2167,7 +2171,8 @@ int CCTKi_CreateGroup (const char *gname, const char *size, const char *ghostsize, const char *tags, - int n_variables, + const char *vararraysize, + int n_basevars, ... ) { @@ -2176,33 +2181,35 @@ int CCTKi_CreateGroup (const char *gname, int staggercode; int variable; + int vectorlength; + int elem; + va_list ap; char *variable_name; - char *vararraysize; cGroupDefinition *group; + vectorlength = 1; + group = NULL; variable_name = NULL; - vararraysize = NULL; retval = 0; - va_start (ap, n_variables); + va_start (ap, n_basevars); /* get the staggercode */ staggercode = CCTKi_ParseStaggerString (dimension, imp, gname, stype); - if(n_variables == -1) + if (vararraysize) { - variable_name = va_arg (ap, char *); - - vararraysize = Util_Strdup(va_arg (ap, char *)); + vararraysize = Util_Strdup(vararraysize); + assert (vararraysize); - n_variables = CCTKi_ParamExpressionToInt(vararraysize,thorn); + vectorlength = CCTKi_ParamExpressionToInt(vararraysize,thorn); - if(n_variables < 0) + if(vectorlength < 0) { CCTK_VWarn (0, __LINE__, __FILE__, "Cactus", "CCTKi_CreateGroup: length of group %s less than 0 !", @@ -2214,11 +2221,13 @@ int CCTKi_CreateGroup (const char *gname, groupscope = CCTK_GroupScopeNumber (gscope); if (groupscope == CCTK_PUBLIC || groupscope == CCTK_PROTECTED) { - group = CCTKi_SetupGroup (imp, gname, staggercode, n_variables); + group = CCTKi_SetupGroup (imp, gname, staggercode, + n_basevars * vectorlength, vectorlength); } else if (groupscope == CCTK_PRIVATE) { - group = CCTKi_SetupGroup (thorn, gname, staggercode, n_variables); + group = CCTKi_SetupGroup (thorn, gname, staggercode, + n_basevars * vectorlength, vectorlength); } else { @@ -2248,58 +2257,41 @@ int CCTKi_CreateGroup (const char *gname, /* Extract the variable names from the argument list. */ - if(!vararraysize) + group->vararraysize = vararraysize; + + for (variable = 0; variable < n_basevars; variable++) { - group->vararraysize = NULL; - for (variable = 0; variable < n_variables; variable++) - { - variable_name = va_arg (ap, char *); + variable_name = va_arg (ap, char *); - group->variables[variable].name = - (char *)malloc ((strlen (variable_name)+1)*sizeof (char)); - - if (group->variables[variable].name) - { - strcpy (group->variables[variable].name, variable_name); - } - else - { - break; - } + if (!vararraysize) + { + assert (vectorlength == 1); + group->variables[variable].name = Util_Strdup(variable_name); } - } - else - { - group->vararraysize = vararraysize; - - for (variable = 0; variable < n_variables; variable++) + else { - char *name = NULL; - Util_asprintf(&name, "%s[%d]", variable_name, variable); - - group->variables[variable].name = name; + for (elem = 0; elem < vectorlength; elem++) + { + char *name = NULL; + Util_asprintf(&name, "%s[%d]", variable_name, elem); + + group->variables[variable * vectorlength + elem].name = name; + } } } va_end (ap); - if (variable < n_variables) + if (dimension > maxdim) { - retval = 3; + maxdim = dimension; } - else + if (staggercode > 0) { - if (dimension > maxdim) - { - maxdim = dimension; - } - if (staggercode > 0) - { - staggered = 1; - } - group->size = CCTKi_ExtractSize (dimension, thorn, size); - group->ghostsize = CCTKi_ExtractSize (dimension, thorn, ghostsize); + staggered = 1; } + group->size = CCTKi_ExtractSize (dimension, thorn, size); + group->ghostsize = CCTKi_ExtractSize (dimension, thorn, ghostsize); /* Only typically have GFs in a single dimension */ if (group->gtype == CCTK_GF) @@ -2376,7 +2368,8 @@ const char *CCTK_GroupImplementationI(int group) static cGroupDefinition *CCTKi_SetupGroup (const char *implementation, const char *name, int staggercode, - int n_variables) + int n_variables, + int vectorlength) { int *temp_int; void *temp; @@ -2426,9 +2419,10 @@ static cGroupDefinition *CCTKi_SetupGroup (const char *implementation, strcpy (groups[n_groups].implementation, implementation); strcpy (groups[n_groups].name, name); - groups[n_groups].number = n_groups; - groups[n_groups].staggertype= staggercode; - groups[n_groups].n_variables= n_variables; + groups[n_groups].number = n_groups; + groups[n_groups].staggertype = staggercode; + groups[n_groups].n_variables = n_variables; + groups[n_groups].vectorlength = vectorlength; /* Fill in global variable numbers. */ for (variable = 0; variable < n_variables; variable++) |