diff options
author | sbrandt <sbrandt@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2012-06-18 17:48:27 +0000 |
---|---|---|
committer | sbrandt <sbrandt@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2012-06-18 17:48:27 +0000 |
commit | 0d07ac21bf7db6765b83ea1bc88f9f4f05d63af7 (patch) | |
tree | 4a411cf054e16707d91836e64c7cb666085689b3 | |
parent | 47a6b6f908ad8f4607cb8e7830d8159522ce0947 (diff) |
Changes for ticket #768
Change per thorn -DTHORN_IS_xxx to a per thorn -I bindings/include/xxx
git-svn-id: http://svn.cactuscode.org/flesh/trunk@4839 17b73243-c579-4c4c-a9d2-2d5706c11dac
-rw-r--r-- | lib/make/force-rebuild | 1 | ||||
-rw-r--r-- | lib/make/make.config.defn.in | 3 | ||||
-rw-r--r-- | lib/make/make.config.rules.in | 4 | ||||
-rw-r--r-- | lib/make/make.subdir | 4 | ||||
-rw-r--r-- | lib/make/make.thornlib | 4 | ||||
-rw-r--r-- | lib/sbin/CST | 35 | ||||
-rw-r--r-- | lib/sbin/CreateConfigurationBindings.pl | 5 | ||||
-rw-r--r-- | lib/sbin/CreateFunctionBindings.pl | 75 | ||||
-rw-r--r-- | lib/sbin/CreateImplementationBindings.pl | 15 | ||||
-rw-r--r-- | lib/sbin/CreateParameterBindings.pl | 54 | ||||
-rw-r--r-- | lib/sbin/CreateScheduleBindings.pl | 27 | ||||
-rw-r--r-- | lib/sbin/GridFuncStuff.pl | 158 | ||||
-rw-r--r-- | src/include/cctk_core.h (renamed from src/include/cctk.h) | 7 | ||||
-rw-r--r-- | src/main/CactusDefaultEvolve.c | 2 | ||||
-rw-r--r-- | src/main/SetupCache.c | 2 | ||||
-rw-r--r-- | src/main/ShutdownCactus.c | 2 |
16 files changed, 213 insertions, 185 deletions
diff --git a/lib/make/force-rebuild b/lib/make/force-rebuild index aebdb9fb..b4aece37 100644 --- a/lib/make/force-rebuild +++ b/lib/make/force-rebuild @@ -38,3 +38,4 @@ 20 Jan 2011: Generate prototypes for scheduled functions 27 Oct 2011: Optimize CCTK_ARGUMENTS for grid functions in Fortran 17 Jun 2012: Correct error in handling optional dependencies +18 Jun 2012: Ticket 768, switch from per thorn define to per thorn include diff --git a/lib/make/make.config.defn.in b/lib/make/make.config.defn.in index b8739498..083f1827 100644 --- a/lib/make/make.config.defn.in +++ b/lib/make/make.config.defn.in @@ -179,7 +179,8 @@ export CU_POSTPROCESSING = @CU_POSTPROCESSING@ export USE_RANLIB = @USE_RANLIB@ # Exclude some files from the dependency lists -export DEP_EXCLUDE_FILES = cctk_Functions\.h|CParameterStructNames\.h|cctk_Arguments\.h|cctk_ScheduleFunctions\.h|definethisthorn\.h|FParameters.h|CParameters\.h|cctk_Capabilities\.h +#export DEP_EXCLUDE_FILES = cctk_Functions\.h|CParameterStructNames\.h|cctk_Arguments\.h|cctk_ScheduleFunctions\.h|definethisthorn\.h|FParameters.h|CParameters\.h|cctk_Capabilities\.h +#export DEP_EXCLUDE_FILES = # Command used to get the working directory export GET_WD = @GET_WD@ diff --git a/lib/make/make.config.rules.in b/lib/make/make.config.rules.in index caef245d..0d8d2db6 100644 --- a/lib/make/make.config.rules.in +++ b/lib/make/make.config.rules.in @@ -62,12 +62,12 @@ endif # Define how to do dependencies ifeq ($(strip $(PERL_BACKUP_NECESSARY)),) define DEPENDENCY_FIXER - $(PERL) -pi -e "s,([^:]*),$(basename $@).o $(basename $@).d, if(m/: /);\ + #$(PERL) -pi -e "s,([^:]*),$(basename $@).o $(basename $@).d, if(m/: /);\ s:\s+\S*[/\\\]($(DEP_EXCLUDE_FILES))\b::g" $@ endef else define DEPENDENCY_FIXER - $(PERL) -pi.bak -e "s,([^:]*),$(basename $@).o $(basename $@).d, if(m/: /);\ + #$(PERL) -pi.bak -e "s,([^:]*),$(basename $@).o $(basename $@).d, if(m/: /);\ s:\s+\S*[/\\\]($(DEP_EXCLUDE_FILES))\b::g" $@ rm $@.bak endef diff --git a/lib/make/make.subdir b/lib/make/make.subdir index 8fc8bff6..51867b90 100644 --- a/lib/make/make.subdir +++ b/lib/make/make.subdir @@ -25,9 +25,7 @@ endif endif # Add appropriate include lines -INC_DIRS += $(SRCDIR) $(SRCDIR)/include - -EXTRA_DEFINES += THORN_IS_$(THORN) +INC_DIRS += $(SRCDIR) $(SRCDIR)/include $(BINDINGS_DIR)/include/$(THORN) # Include the subdirectory's local include data -include $(SRCDIR)/make.code.defn diff --git a/lib/make/make.thornlib b/lib/make/make.thornlib index cedba537..2a174598 100644 --- a/lib/make/make.thornlib +++ b/lib/make/make.thornlib @@ -35,13 +35,11 @@ endif endif # Add appropriate include lines -INC_DIRS += $(SYS_INC_DIRS) $(SRCDIR) $(SRCDIR)/include $(CONFIG) $(BINDINGS_DIR)/include $(CCTK_HOME)/src/include $(CCTK_HOME)/arrangements $(BINDINGS_DIR)/Configuration/Thorns +INC_DIRS += $(SYS_INC_DIRS) $(SRCDIR) $(SRCDIR)/include $(CONFIG) $(BINDINGS_DIR)/include $(CCTK_HOME)/src/include $(CCTK_HOME)/arrangements $(BINDINGS_DIR)/Configuration/Thorns $(BINDINGS_DIR)/include/$(THORN) # Allow subdirectories to inherit these include directories export INC_DIRS -EXTRA_DEFINES += THORN_IS_$(THORN) - # Define some make variables PRE_WRAPPER = make.pre POST_WRAPPER = make.post diff --git a/lib/sbin/CST b/lib/sbin/CST index 8f04f5cc..6dea94ca 100644 --- a/lib/sbin/CST +++ b/lib/sbin/CST @@ -142,7 +142,11 @@ print "Creating Thorn-Flesh bindings...\n"; &CreateThornsHeaders(%source_thorns); &WriteFile("$bindings_dir/include/thornlist.h", \$thornsheader); &WriteFile("$bindings_dir/include/cctk_DefineThorn.h", \$definethornsheader); -&WriteFile("$bindings_dir/include/definethisthorn.h", \$definethisthornheader); +for my $header (@$definethisthornheader) { + my $thorn = $header->{thorn}; + my $body = $header->{body}; + &WriteFile("$bindings_dir/include/$thorn/definethisthorn.h", \$body); +} # Create the header files used by the thorns &BuildHeaders($cctk_home,$bindings_dir,%interface_database); @@ -484,25 +488,31 @@ sub RequiredThorns sub CreateThornsHeaders { my(%thorns) = @_; - my($header1,$header2,$header3,$thorn,$nthorns); + my($header1,$header2,@header3,$thorn,$nthorns); $header1 = "\/* List of compiled thorns in the code. *\/\n\n"; $header1 .= "static char const *const thorn_name[] = {\n"; $header2 = "\/* Defines for compiled thorns in the code. *\/\n\n"; - $header3 = "\/* Defines for thorn this file is part of *\/\n\n"; + + my @thorns = keys %thorns; $nthorns = 0; - foreach $thorn (sort keys %thorns) + foreach $thorn (sort @thorns) { # Only place package_name/thorn_name in the file. $thorns{$thorn} =~ m:.*/(.*)/(.*):; - - $header3 .= "#ifdef THORN_IS_$thorn\n" . - "#define CCTK_THORN $2\n" . - "#define CCTK_THORNSTRING \"$2\"\n" . - "#define CCTK_ARRANGEMENT $1\n" . - "#define CCTK_ARRANGEMENTSTRING \"$1\"\n" . - "#endif\n\n"; + my ($arr,$th) = ($1,$2); + + push @header3, {thorn => $thorn, body=> + "\/* Defines for thorn this file is part of *\/\n\n". + "#ifndef DEFINE_THIS_THORN_H\n". + "#define DEFINE_THIS_THORN_H 1\n". + "#define THORN_IS_$thorn 1\n". + "#define CCTK_THORN $th\n" . + "#define CCTK_THORNSTRING \"$th\"\n" . + "#define CCTK_ARRANGEMENT $arr\n" . + "#define CCTK_ARRANGEMENTSTRING \"$arr\"\n". + "#endif\n\n"}; # Ignore the main sources for the other headers - they may confuse next if ($thorn eq 'Cactus'); @@ -515,8 +525,9 @@ sub CreateThornsHeaders $header1 .= "\"\"};\n\n"; $header1 .= "static int const nthorns = $nthorns;\n\n"; + push @header3, {thorn=>"CactusBindings", body=>"#define THORN_IS_CactusBindings\n\n"}; - return ($header1, $header2, $header3); + return ($header1, $header2, \@header3); } diff --git a/lib/sbin/CreateConfigurationBindings.pl b/lib/sbin/CreateConfigurationBindings.pl index 0d8ea53b..82466336 100644 --- a/lib/sbin/CreateConfigurationBindings.pl +++ b/lib/sbin/CreateConfigurationBindings.pl @@ -216,13 +216,12 @@ sub CreateConfigurationBindings { if ($cfg->{"\U$thorn\E REQUIRES"}) { - $temp .= "#ifdef THORN_IS_$thorn\n"; $temp .= "#include \"../Configuration/Thorns/cctki_$thorn.h\"\n"; - $temp .= "#endif\n"; $temp .= "\n"; } + &WriteFile("../include/$thorn/cctk_Capabilities.h",\$temp); } - &WriteFile("../include/cctk_Capabilities.h",\$temp); + &WriteFile("../include/CactusBindings/cctk_Capabilities.h","#include \"../Configuration/Thorns/cctki_Cactus.h\"\n\n"); } return 1; diff --git a/lib/sbin/CreateFunctionBindings.pl b/lib/sbin/CreateFunctionBindings.pl index b607ce69..b41d7b43 100644 --- a/lib/sbin/CreateFunctionBindings.pl +++ b/lib/sbin/CreateFunctionBindings.pl @@ -282,7 +282,6 @@ sub CreateFunctionBindings ### $dataout = &ThornMasterIncludes($function_db); - &WriteFile('include/cctk_Functions.h',\$dataout); ### # Create the prototype header file for all thorns that USE a @@ -1757,50 +1756,52 @@ sub ThornMasterIncludes use strict; my %function_db = %{$_[0]}; + my @thorns = keys %function_db; - my(@data) = (); - - # Header Data - push(@data, '/*@@'); - push(@data, ' @header cctk_Functions.h'); - push(@data, ' @author Automatically generated by CreateFunctionBindings.pl'); - push(@data, ' @desc'); - push(@data, ' Prototypes for overloaded functions used by all thorns'); - push(@data, ' @enddesc'); - push(@data, ' @@*/'); - push(@data, ''); - push(@data, ''); - - push(@data, '#ifndef _CCTK_FUNCTIONALIASES_H_'); - push(@data, '#define _CCTK_FUNCTIONALIASES_H_ 1'); - push(@data, ''); + my $thorn; + foreach $thorn (sort @thorns) + { + my(@data) = (); + + # Header Data + push(@data, '/*@@'); + push(@data, ' @header $thorn/cctk_Functions.h'); + push(@data, ' @author Automatically generated by CreateFunctionBindings.pl'); + push(@data, ' @desc'); + push(@data, ' Prototypes for overloaded functions used by all thorns'); + push(@data, ' @enddesc'); + push(@data, ' @@*/'); + push(@data, ''); + push(@data, ''); - push(@data, '#ifdef CCODE'); - push(@data, '#ifdef __cplusplus'); - push(@data, 'extern "C" {'); - push(@data, '#endif'); - push(@data, ' CCTK_INT CCTK_IsFunctionAliased(const char *function);'); - push(@data, '#ifdef __cplusplus'); - push(@data, '}'); - push(@data, '#endif'); - push(@data, '#endif'); - push(@data, ''); + push(@data, '#ifndef _CCTK_FUNCTIONALIASES_H_'); + push(@data, '#define _CCTK_FUNCTIONALIASES_H_ 1'); + push(@data, ''); - my $thorn; + push(@data, '#ifdef CCODE'); + push(@data, '#ifdef __cplusplus'); + push(@data, 'extern "C" {'); + push(@data, '#endif'); + push(@data, ' CCTK_INT CCTK_IsFunctionAliased(const char *function);'); + push(@data, '#ifdef __cplusplus'); + push(@data, '}'); + push(@data, '#endif'); + push(@data, '#endif'); + push(@data, ''); - foreach $thorn (sort keys %function_db) - { - push(@data, "#ifdef THORN_IS_$thorn"); push(@data, "#include \"${thorn}_Prototypes.h\""); push(@data, "#define DECLARE_CCTK_FUNCTIONS DECLARE_\U$thorn\E_FUNCTIONS"); - push(@data, '#endif'); - push(@data, ''); - } - push(@data, '#endif /* _CCTK_FUNCTIONALIASES_H_ */'); - push(@data, "\n"); # workaround for perl 5.004_04 to add a trailing newline + push(@data, '#endif /* _CCTK_FUNCTIONALIASES_H_ */'); + push(@data, "\n"); # workaround for perl 5.004_04 to add a trailing newline - return join ("\n",@data); + my $dataout = join ("\n",@data); + mkdir("include/${thorn}"); + &WriteFile("include/${thorn}/cctk_Functions.h",\$dataout); + if($thorn eq "Cactus") { + &WriteFile("include/CactusBindings/cctk_Functions.h",\$dataout); + } + } } #/*@@ diff --git a/lib/sbin/CreateImplementationBindings.pl b/lib/sbin/CreateImplementationBindings.pl index 474e0858..64c45cad 100644 --- a/lib/sbin/CreateImplementationBindings.pl +++ b/lib/sbin/CreateImplementationBindings.pl @@ -37,6 +37,21 @@ sub CreateImplementationBindings } @thorns = sort split(' ', $rhinterface_db->{'THORNS'}); + if(! -d 'include') + { + mkdir('include', 0755) || die 'Unable to create include directory'; + } + if(! -d 'include/CactusBindings') + { + mkdir('include/CactusBindings', 0755) || die 'Unable to create include/CactusBindings directory'; + } + my $thorn; + foreach $thorn (@thorns) { + if(! -d "include/$thorns") { + mkdir("include/$thorn",0755) || die "Unable to create include/$thorn directory"; + } + } + @data = map { "void CCTKi_BindingsThorn_$_(void);" } @thorns; push(@data, ''); diff --git a/lib/sbin/CreateParameterBindings.pl b/lib/sbin/CreateParameterBindings.pl index 385bff80..52862243 100644 --- a/lib/sbin/CreateParameterBindings.pl +++ b/lib/sbin/CreateParameterBindings.pl @@ -154,13 +154,14 @@ sub CreateParameterBindings foreach $thorn (split(' ',$rhinterface_db->{'THORNS'})) { $dataout = &CreateFortranThornParameterBindings($thorn, $rhparameter_db, $rhinterface_db); - &WriteFile("include/${thorn}_FParameters.h",\$dataout); + mkdir("include/$thorn"); + &WriteFile("include/${thorn}/FParameters.h",\$dataout); $implementation = $rhinterface_db->{"\U$thorn\E IMPLEMENTS"}; @data = (); push(@data, '/*@@'); - push(@data, " \@header ${thorn}_CParameters.h"); + push(@data, " \@header ${thorn}/CParameters.h"); push(@data, ' @author Automatically generated by CreateParameterBindings.pl'); push(@data, ' @desc'); push(@data, " Declares parameters of thorn $thorn"); @@ -172,6 +173,7 @@ sub CreateParameterBindings push(@data, "#ifndef _\U$thorn\E_PARAMETERS_H_"); push(@data, "#define _\U$thorn\E_PARAMETERS_H_ 1"); push(@data, ''); + push(@data, '#include "CParameterStructNames.h"'); if($header_files{'GLOBAL'}) { @@ -231,7 +233,7 @@ sub CreateParameterBindings push(@data, "\n"); # workaround for perl 5.004_04 to add a trailing newline $dataout = join ("\n", @data); - &WriteFile("include/${thorn}_CParameters.h",\$dataout); + &WriteFile("include/${thorn}/CParameters.h",\$dataout); } # Write this one to a temporary file and read it back in @@ -253,46 +255,22 @@ sub CreateParameterBindings &WriteFile('include/CParameterStructNames.h',\$dataout); - - @data = (); - push(@data, '#include "CParameterStructNames.h"'); - push(@data, ''); foreach $thorn (split(' ',$rhinterface_db->{'THORNS'})) { - push(@data, "#ifdef THORN\_IS\_$thorn"); - push(@data, "#include \"${thorn}_CParameters.h\""); - push(@data, '#endif'); + @data = (); + push(@data, '/* get the CCTK datatype definitions */'); + push(@data, '#include "cctk_Types.h"'); push(@data, ''); - } - push(@data, "\n"); # workaround for perl 5.004_04 to add a trailing newline - $dataout = join ("\n", @data); - &WriteFile('include/CParameters.h',\$dataout); - - @data = (); - foreach $thorn (split(' ',$rhinterface_db->{'THORNS'})) - { - push(@data, "#ifdef THORN\_IS\_$thorn"); - push(@data, "#include \"${thorn}_FParameters.h\""); + push(@data, '#ifdef CCODE'); + push(@data, "#include \"${thorn}/CParameters.h\""); + push(@data, '#elif FCODE'); + push(@data, "#include \"${thorn}/FParameters.h\""); push(@data, '#endif'); - push(@data, ''); - } - push(@data, "\n"); # workaround for perl 5.004_04 to add a trailing newline - $dataout = join ("\n", @data); - &WriteFile('include/FParameters.h',\$dataout); + push(@data, "\n"); # workaround for perl 5.004_04 to add a trailing newline - @data = (); - push(@data, '/* get the CCTK datatype definitions */'); - push(@data, '#include "cctk_Types.h"'); - push(@data, ''); - push(@data, '#ifdef CCODE'); - push(@data, '#include "CParameters.h"'); - push(@data, '#elif FCODE'); - push(@data, '#include "FParameters.h"'); - push(@data, '#endif'); - push(@data, "\n"); # workaround for perl 5.004_04 to add a trailing newline - - $dataout = join ("\n", @data); - &WriteFile('include/cctk_Parameters.h',\$dataout); + $dataout = join ("\n", @data); + &WriteFile("include/${thorn}/cctk_Parameters.h",\$dataout); + } chdir $start_dir; diff --git a/lib/sbin/CreateScheduleBindings.pl b/lib/sbin/CreateScheduleBindings.pl index 095d49dc..18657189 100644 --- a/lib/sbin/CreateScheduleBindings.pl +++ b/lib/sbin/CreateScheduleBindings.pl @@ -53,20 +53,11 @@ sub CreateScheduleBindings $file_list .= " Schedule$thorn.c"; $rsbuffer = &ScheduleCreateInterfaceFile($thorn, $rhinterface_db, $rhschedule_db); - &WriteFile("../include/${thorn}_Schedule.h",\$rsbuffer); - } - - @data = (); - foreach $thorn (split(' ',$rhinterface_db->{'THORNS'})) - { - push(@data, "#ifdef THORN\_IS\_$thorn"); - push(@data, "#include \"${thorn}_Schedule.h\""); - push(@data, '#endif'); - push(@data, ''); + &WriteFile("../include/${thorn}/cctk_ScheduleFunctions.h",\$rsbuffer); + if($thorn eq "Cactus") { + &WriteFile("../include/CactusBindings/cctk_ScheduleFunctions.h",\$rsbuffer); + } } - push(@data, "\n"); # workaround for perl 5.004_04 to add a trailing newline - $dataout = join ("\n", @data); - &WriteFile('../include/cctk_ScheduleFunctions.h',\$dataout); $rsbuffer = &ScheduleCreateBindings($rhinterface_db, $rhschedule_db); &WriteFile("BindingsSchedule.c", \$rsbuffer); @@ -115,7 +106,7 @@ sub ScheduleCreateInterfaceFile # Process each schedule block my @data = (); - push (@data, '#include "cctk_Arguments.h"'); + push (@data, "#include \"$thorn/cctk_Arguments.h\""); for (my $block = 0; $block < $rhschedule_db->{"\U$thorn\E N_BLOCKS"}; @@ -292,11 +283,13 @@ sub ScheduleCreateFile push(@data, ' @enddesc'); push(@data, '@@*/'); push(@data, ''); - push(@data, "#define THORN_IS_$thorn"); + #push(@data, "#define THORN_IS_$thorn"); + #push(@data, "#define CCTK_THORNSTRING \"$thorn\""); push(@data, ''); - push(@data, '#include "cctk.h"'); - push(@data, '#include "cctk_Parameters.h"'); + push(@data, "#include \"$thorn/cctk.h\""); + push(@data, "#include \"$thorn/CParameters.h\""); push(@data, '#include "cctki_ScheduleBindings.h"'); + push(@data, "#include \"$thorn/cctk_ScheduleFunctions.h\""); push(@data, ''); #push(@data, '/* prototypes for schedule bindings functions to be registered */'); #push(@data, '/* Note that this is a cheat, we just need a function pointer. */'); diff --git a/lib/sbin/GridFuncStuff.pl b/lib/sbin/GridFuncStuff.pl index c587e7e6..fde9dfce 100644 --- a/lib/sbin/GridFuncStuff.pl +++ b/lib/sbin/GridFuncStuff.pl @@ -43,68 +43,97 @@ sub CreateVariableBindings WriteFile("include/$thorn\_Arguments.h",\$dataout); } - @data = (); - push(@data, '/*@@'); - push(@data, ' @header cctk_Arguments.h'); - push(@data, ' @author Automatically generated by GridFuncStuff.pl'); - push(@data, ' @desc'); - push(@data, ' Defines the CCTK_ARGUMENTS macro for all thorns'); - push(@data, ' @enddesc'); - push(@data, ' @@*/'); - push(@data, ''); - push(@data, ''); + my @thorns = split(" ",$rhinterface_db->{"THORNS"}); + foreach my $thorn (@thorns) + { + @data = (); + push(@data, "#ifndef CCTK_ARGUMENTS_H_"); + push(@data, "#define CCTK_ARGUMENTS_H_ 1"); + push(@data, '/*@@'); + push(@data, ' @header cctk_Arguments.h'); + push(@data, ' @author Automatically generated by GridFuncStuff.pl'); + push(@data, ' @desc'); + push(@data, ' Defines the CCTK_ARGUMENTS macro for all thorns'); + push(@data, ' @enddesc'); + push(@data, ' @@*/'); + push(@data, ''); + push(@data, ''); + push(@data, "#include \"${thorn}_Arguments.h\""); - push(@data, '/* get the CCTK datatype definitions */'); - push(@data, '#include "cctk_Types.h"'); - push(@data, ''); - push(@data, '#ifdef CCODE'); - - push(@data, '/* prototype for CCTKi_VarDataPtr() goes here'); - push(@data, ' because we don\'t want to include another CCTK header file */'); - push(@data, '#include "cGH.h"'); - push(@data, '#ifdef __cplusplus'); - push(@data, 'extern "C"'); - push(@data, '#endif'); - push(@data, 'void *CCTKi_VarDataPtr(const cGH *GH, int timelevel,'); - push(@data, ' const char *implementation, const char *varname);'); - push(@data, ''); + push(@data, '/* get the CCTK datatype definitions */'); + push(@data, '#include "cctk_Types.h"'); + push(@data, ''); + push(@data, '#ifdef CCODE'); + push(@data, '/* prototype for CCTKi_VarDataPtr() goes here'); + push(@data, ' because we don\'t want to include another CCTK header file */'); + push(@data, '#include "cGH.h"'); + push(@data, '#ifdef __cplusplus'); + push(@data, 'extern "C"'); + push(@data, '#endif'); + push(@data, 'void *CCTKi_VarDataPtr(const cGH *GH, int timelevel,'); + push(@data, ' const char *implementation, const char *varname);'); + push(@data, ''); - push(@data, '#define PASS_GROUPSIZE(group, dir) CCTKGROUPNUM_##group >= 0 ? \\'); - push(@data, ' CCTK_ArrayGroupSizeI(GH, dir, CCTKGROUPNUM_##group) : &_cctk_zero'); - push(@data, ''); - push(@data, '#define PASS_GROUPLEN(thorn, group) CCTKGROUPNUM_##group >= 0 ? \\'); - push(@data, ' CCTKi_GroupLengthAsPointer(#thorn "::" #group) : &_cctk_zero'); - push(@data, ''); - push(@data, '#define PASS_REFERENCE(var, level) CCTKARGNUM_##var >= 0 ? \\'); - push(@data, ' GH->data[CCTKARGNUM_##var][level] : 0'); - push(@data, ''); + push(@data, '#define PASS_GROUPSIZE(group, dir) CCTKGROUPNUM_##group >= 0 ? \\'); + push(@data, ' CCTK_ArrayGroupSizeI(GH, dir, CCTKGROUPNUM_##group) : &_cctk_zero'); + push(@data, ''); + push(@data, '#define PASS_GROUPLEN(thorn, group) CCTKGROUPNUM_##group >= 0 ? \\'); + push(@data, ' CCTKi_GroupLengthAsPointer(#thorn "::" #group) : &_cctk_zero'); + push(@data, ''); + push(@data, '#define PASS_REFERENCE(var, level) CCTKARGNUM_##var >= 0 ? \\'); + push(@data, ' GH->data[CCTKARGNUM_##var][level] : 0'); + push(@data, ''); - push(@data, '#define CCTK_ARGUMENTS CCTK_CARGUMENTS'); - push(@data, '#define _CCTK_ARGUMENTS _CCTK_CARGUMENTS'); - push(@data, '#define DECLARE_CCTK_ARGUMENTS DECLARE_CCTK_CARGUMENTS'); - push(@data, '#endif'); - push(@data, ''); - push(@data, '#ifdef FCODE'); - push(@data, '#define CCTK_ARGUMENTS CCTK_FARGUMENTS'); - push(@data, '#define _CCTK_ARGUMENTS _CCTK_FARGUMENTS'); - push(@data, '#define DECLARE_CCTK_ARGUMENTS DECLARE_CCTK_FARGUMENTS'); - push(@data, '#endif'); + push(@data, "#define CCTK_ARGUMENTS \U${thorn}_CARGUMENTS"); + push(@data, '#define _CCTK_ARGUMENTS _CCTK_CARGUMENTS'); + push(@data, "#define DECLARE_CCTK_ARGUMENTS DECLARE_\U${thorn}_CARGUMENTS"); + push(@data, '#endif'); + push(@data, ''); + push(@data, '#ifdef FCODE'); + push(@data, "#define CCTK_ARGUMENTS \U${thorn}_FARGUMENTS"); + push(@data, '#define _CCTK_ARGUMENTS _CCTK_FARGUMENTS'); + push(@data, "#define DECLARE_CCTK_ARGUMENTS DECLARE_\U${thorn}_FARGUMENTS"); + push(@data, '#endif'); - foreach my $thorn (split(" ",$rhinterface_db->{"THORNS"})) - { push(@data, ''); - push(@data, "#ifdef THORN_IS_$thorn"); - push(@data, "#include \"${thorn}_Arguments.h\""); push(@data, "#define CCTK_FARGUMENTS \U$thorn" . '_FARGUMENTS'); push(@data, "#define DECLARE_CCTK_FARGUMENTS DECLARE_\U$thorn" . '_FARGUMENTS'); push(@data, "#define CCTK_CARGUMENTS \U$thorn" . '_CARGUMENTS'); push(@data, "#define DECLARE_CCTK_CARGUMENTS DECLARE_\U$thorn" . '_CARGUMENTS'); - push(@data, '#endif'); - } - push(@data, "\n"); # workaround for perl 5.004_04 to add a trailing newline + push(@data, "#endif"); + push(@data, "\n"); # workaround for perl 5.004_04 to add a trailing newline - my $dataout = join ("\n", @data); - WriteFile("include/cctk_Arguments.h",\$dataout); + my $dataout = join ("\n", @data); + unless(-d "include/$thorn") { + mkdir("include/$thorn"); + } + WriteFile("include/$thorn/cctk_Arguments.h",\$dataout); + if($thorn eq "Cactus") { + unless(-d "include/CactusBindings") { + mkdir("include/CactusBindings"); + } + WriteFile("include/CactusBindings/cctk_Arguments.h",\$dataout); + } + @data = (); + # alternate + push @data, "#ifndef _CCTK_H_"; + push @data, "#define _CCTK_H_ 1"; + push @data, "#include \"${thorn}/definethisthorn.h\""; + push @data, ""; + push @data, "/* Include prototypes for scheduled functions */"; + push @data, "#include \"${thorn}/cctk_ScheduleFunctions.h\""; + push @data, "#include \"cctk_core.h\""; + push @data, "#endif"; + push @data, ""; + $dataout = join ("\n", @data); + WriteFile("include/$thorn/cctk.h",\$dataout); + if($thorn eq "Cactus") { + unless(-d "include/CactusBindings") { + mkdir("include/CactusBindings"); + } + WriteFile("include/CactusBindings/cctk.h",\$dataout); + } + } if(! -d "Variables") { @@ -166,16 +195,17 @@ sub CreateVariableBindings push(@data, ''); push(@data, ''); - push(@data, "#define THORN_IS_$thorn 1"); + #push(@data, "#define THORN_IS_$thorn 1"); push(@data, ''); push(@data, '#include <stddef.h>'); push(@data, ''); - push(@data, '#include "cctk.h"'); - push(@data, '#include "cctk_Arguments.h"'); - push(@data, '#include "cctk_Parameter.h"'); + push(@data, "#include \"$thorn/cctk.h\""); + push(@data, "#include \"$thorn/cctk_Arguments.h\""); + push(@data, "#include \"cctk_Parameter.h\""); push(@data, '#include "cctk_WarnLevel.h"'); push(@data, '#include "cctki_Groups.h"'); push(@data, '#include "cctki_FortranWrappers.h"'); + push(@data, "#include \"$thorn/cctk_ScheduleFunctions.h\""); push(@data, ''); push(@data, "int CactusBindingsVariables_${thorn}_Initialise(void);"); @@ -354,20 +384,20 @@ sub GetThornArguments $sep = ','; if ($gtype ne 'GF') { - if($block eq 'PRIVATE') - { + if($block eq 'PRIVATE') + { # FIXME: quick hack to shorten argument names # $arguments{"cctkv$dim$group"} = "(STORAGESIZE($thorn\::$group, $dim))"; - $arguments{"X$dim$group"} = "(STORAGESIZE($thorn\::$group, $dim))"; - } - else - { + $arguments{"X$dim$group"} = "(STORAGESIZE($thorn\::$group, $dim))"; + } + else + { # FIXME: quick hack to shorten argument names # $arguments{"cctkv$dim$group"} = "(STORAGESIZE($imp\::$group, $dim))"; - $arguments{"X$dim$group"} = "(STORAGESIZE($imp\::$group, $dim))"; - } + $arguments{"X$dim$group"} = "(STORAGESIZE($imp\::$group, $dim))"; } } + } if(defined($vararraysize) && $compactgroup == 0) { $type .= "$sep${group}_length"; diff --git a/src/include/cctk.h b/src/include/cctk_core.h index f47c0a39..7620e823 100644 --- a/src/include/cctk.h +++ b/src/include/cctk_core.h @@ -9,8 +9,8 @@ @version $Header$ @@*/ -#ifndef _CCTK_H_ -#define _CCTK_H_ 1 +#ifndef _CCTK_CORE_H_ +#define _CCTK_CORE_H_ 1 /* Grab the main configuration info. */ #include "cctk_Config.h" @@ -30,9 +30,6 @@ #include "cctk_Loop.h" #include "cctk_WarnLevel.h" -/* Include definitions provided by capabilities */ -#include "cctk_Capabilities.h" - #define CCTK_PRINTSEPARATOR\ print '("--------------------------------------------------------------------------------")' diff --git a/src/main/CactusDefaultEvolve.c b/src/main/CactusDefaultEvolve.c index 72bbeaa3..9bb64cf8 100644 --- a/src/main/CactusDefaultEvolve.c +++ b/src/main/CactusDefaultEvolve.c @@ -13,6 +13,8 @@ #include <stdio.h> #include <stdlib.h> +#include "definethisthorn.h" + #include "cctk_Flesh.h" #include "cctk_Parameters.h" #include "cctk_Groups.h" diff --git a/src/main/SetupCache.c b/src/main/SetupCache.c index 71ffa217..6700cd71 100644 --- a/src/main/SetupCache.c +++ b/src/main/SetupCache.c @@ -8,6 +8,8 @@ @version $Id$ @@*/ +#include "definethisthorn.h" + #include "cctk_Config.h" #include "cctk_Flesh.h" #include "cctk_Parameters.h" diff --git a/src/main/ShutdownCactus.c b/src/main/ShutdownCactus.c index 63fb720d..1e61224c 100644 --- a/src/main/ShutdownCactus.c +++ b/src/main/ShutdownCactus.c @@ -8,6 +8,8 @@ @version $Id$ @@*/ +#include "definethisthorn.h" + #include <stdio.h> #include <stdlib.h> |