diff options
author | eschnett <eschnett@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2011-07-02 23:02:06 +0000 |
---|---|---|
committer | eschnett <eschnett@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2011-07-02 23:02:06 +0000 |
commit | 36f4ae043b465c333ee6ef615b751f9e92bd9c68 (patch) | |
tree | f6d3227c4a91b8089b91b5e0e55e1891e42fb49b | |
parent | 435ea2cb05eca3264531dd81e9f4a4c906e77d59 (diff) |
Allow parameters in STORAGE specifications
Allow parameters in addition to integer constants in STORAGE
specifications in schedule.ccl.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@4707 17b73243-c579-4c4c-a9d2-2d5706c11dac
-rw-r--r-- | lib/sbin/CreateScheduleBindings.pl | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/lib/sbin/CreateScheduleBindings.pl b/lib/sbin/CreateScheduleBindings.pl index f5256f94..b2b1f7c4 100644 --- a/lib/sbin/CreateScheduleBindings.pl +++ b/lib/sbin/CreateScheduleBindings.pl @@ -566,6 +566,17 @@ sub ScheduleBlock $buffer .= "0};\n"; + # add check on number of timelevels in case we were using a parameter + for($i=0; $i < @$tlist; $i++) + { + $buffer .= " if(!($$tlist[$i] > 0 && $$tlist[$i] <= CCTK_MaxTimeLevels(\"$$mem_groups[$i]\")))\n"; + $buffer .= " CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n"; + $buffer .= " \"Tried to schedule %d timelevels for group '%s' in schedule.ccl.\\n\"\n"; + $buffer .= " \"Value must be between 1 and %d (inclusive)\",\n"; + $buffer .= " $$tlist[$i], \"$$mem_groups[$i]\", CCTK_MaxTimeLevels(\"$$mem_groups[$i]\"));\n"; + $buffer .= "\n"; + } + # Start writing out the data if($rhschedule_db->{"\U$thorn\E BLOCK_$block TYPE"} eq "GROUP") { @@ -689,6 +700,17 @@ sub ScheduleStatement my $i; + # add check on number of timelevels in case we were using a parameter + for($i=0; $i < @$groups; $i++) + { + $buffer .= " if(!($$misc[$i] > 0 && $$misc[$i] <= CCTK_MaxTimeLevels(\"$$groups[$i]\")))\n"; + $buffer .= " CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,\n"; + $buffer .= " \"Tried to schedule %d timelevels for group '%s' in schedule.ccl.\\n\"\n"; + $buffer .= " \"Value must be between 1 and %d (inclusive)\",\n"; + $buffer .= " $$misc[$i], \"$$groups[$i]\", CCTK_MaxTimeLevels(\"$$groups[$i]\"));\n"; + $buffer .= "\n"; + } + for($i=0; $i < @$groups; $i++) { my $group = $$groups[$i]; @@ -951,7 +973,7 @@ sub ScheduleValidateTimeLevels # print "DEBUG: validate $thorn,$implementation,$group,$timelevels\n"; - if($timelevels !~ /^\d*$/) + if($timelevels !~ /^[[:alpha:]_][[:word:]]*$/ && $timelevels !~ /^\d*$/) { &CST_error(0,"Invalid timelevel specifier '$timelevels' in schedule.ccl of thorn '$thorn'","",__LINE__,__FILE__); $return_code++; @@ -993,7 +1015,7 @@ sub ScheduleValidateTimeLevels ,"",__LINE__,__FILE__); $return_code++; } - elsif($timelevels > 0 && $timelevels <= $allowed_timelevels) + elsif($timelevels =~ /^[[:alpha:]_][[:word:]]*$/ || ($timelevels > 0 && $timelevels <= $allowed_timelevels)) { next; } |