summaryrefslogtreecommitdiff
path: root/lib/sbin
diff options
context:
space:
mode:
authorschnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac>2003-11-21 15:27:25 +0000
committerschnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac>2003-11-21 15:27:25 +0000
commita78302e02db75eefebcaea943239ec48099c556e (patch)
tree67328e853b33fda8b98b400a39c5601c26d3c1e5 /lib/sbin
parentd214164831555d2307ac1c6b9bd53bee8f6f84f4 (diff)
Allow vector groups of scalars.
Allow vector groups with more than one declared variable. Much of this patch consists of removing special case code for scalars. Scalars are now almost everywhere treated as rank 0 arrays. git-svn-id: http://svn.cactuscode.org/flesh/trunk@3465 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin')
-rw-r--r--lib/sbin/CST4
-rw-r--r--lib/sbin/GridFuncStuff.pl24
-rw-r--r--lib/sbin/interface_parser.pl42
3 files changed, 21 insertions, 49 deletions
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)
{