diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2011-07-03 22:39:09 -0400 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2011-07-03 22:39:09 -0400 |
commit | 31abe3cdd9e78da3be4fb35732668b121fd610c6 (patch) | |
tree | b8fa3cd33fe6bed6982fc266cfbab630d0be66d5 | |
parent | 27405789982bc776aea0b231ebb067eaa508f88d (diff) |
LoopControl: Improve checking Fortran type sizes
-rw-r--r-- | Carpet/LoopControl/src/lc_get_type_sizes.F90 | 20 | ||||
-rw-r--r-- | Carpet/LoopControl/src/loopcontrol.c | 23 | ||||
-rw-r--r-- | Carpet/LoopControl/src/loopcontrol_get_type_sizes.F90 | 25 | ||||
-rw-r--r-- | Carpet/LoopControl/src/make.code.defn | 2 |
4 files changed, 33 insertions, 37 deletions
diff --git a/Carpet/LoopControl/src/lc_get_type_sizes.F90 b/Carpet/LoopControl/src/lc_get_type_sizes.F90 new file mode 100644 index 000000000..6d8fdfce7 --- /dev/null +++ b/Carpet/LoopControl/src/lc_get_type_sizes.F90 @@ -0,0 +1,20 @@ +#include "cctk.h" +#include "cctk_Functions.h" + +subroutine lc_get_fortran_type_sizes (lc_control_size, lc_statmap_size) + + use loopcontrol_types + + implicit none + + DECLARE_CCTK_FUNCTIONS + + integer, intent(out) :: lc_control_size, lc_statmap_size + + type(lc_control_t), dimension(2) :: lc_lc + type(lc_statmap_t), dimension(2) :: lc_lm + + lc_control_size = CCTK_PointerTo(lc_lc(2)) - CCTK_PointerTo(lc_lc(1)) + lc_statmap_size = CCTK_PointerTo(lc_lm(2)) - CCTK_PointerTo(lc_lm(1)) + +end subroutine lc_get_fortran_type_sizes diff --git a/Carpet/LoopControl/src/loopcontrol.c b/Carpet/LoopControl/src/loopcontrol.c index 829339aaf..83a09a313 100644 --- a/Carpet/LoopControl/src/loopcontrol.c +++ b/Carpet/LoopControl/src/loopcontrol.c @@ -1232,23 +1232,24 @@ lc_printstats_terminate (CCTK_ARGUMENTS) lc_printstats (); } -int -lc_check_type_sizes (void); +CCTK_FCALL +void +CCTK_FNAME (lc_get_fortran_type_sizes) (int * lc_control_size, + int * lc_statmap_size); + int lc_check_type_sizes (void) { - /* check that the sizes of LoopControls control structures are the same in - * loopcontrol.h and loopcontrol_fortran.h */ - CCTK_FCALL - void - CCTK_FNAME (lc_get_fortran_type_sizes) (int * sum_of_sizes); + /* check that the sizes of LoopControls control structures are the + * same in loopcontrol.h and loopcontrol_fortran.h */ - int Fortran_size, C_size; + int lc_control_size, lc_statmap_size; - CCTK_FNAME (lc_get_fortran_type_sizes) ( & Fortran_size); - C_size = (int) ( sizeof(lc_statmap_t) + sizeof(lc_control_t) ); + CCTK_FNAME (lc_get_fortran_type_sizes) ( & lc_control_size, + & lc_statmap_size ); - if (C_size != Fortran_size) { + if ( lc_control_size != sizeof(lc_control_t) || + lc_statmap_size != sizeof(lc_statmap_t) ) { CCTK_VWarn (CCTK_WARN_ABORT, __LINE__, __FILE__, CCTK_THORNSTRING, "Fortran and C control structures (lc_statmap_t and lc_control_t) " "differ in size. If you are not using Fortran or believe " diff --git a/Carpet/LoopControl/src/loopcontrol_get_type_sizes.F90 b/Carpet/LoopControl/src/loopcontrol_get_type_sizes.F90 deleted file mode 100644 index 4ddb69cf2..000000000 --- a/Carpet/LoopControl/src/loopcontrol_get_type_sizes.F90 +++ /dev/null @@ -1,25 +0,0 @@ -#include <cctk.h> -#include <cctk_Functions.h> - - subroutine lc_get_fortran_type_sizes (sum_of_type_sizes) - - use loopcontrol_types - - implicit none - - DECLARE_CCTK_FUNCTIONS - - integer, intent(out) :: sum_of_type_sizes - - integer :: lc_control_size, lc_statmap_size - - type(lc_control_t), dimension(2) :: lc_lc - type(lc_statmap_t), dimension(2) :: lc_lm - - lc_control_size = CCTK_PointerTo(lc_lc(2)) - CCTK_PointerTo(lc_lc(1)) - lc_statmap_size = CCTK_PointerTo(lc_lm(2)) - CCTK_PointerTo(lc_lm(1)) - - sum_of_type_sizes = lc_control_size + lc_statmap_size - - end subroutine lc_get_fortran_type_sizes - diff --git a/Carpet/LoopControl/src/make.code.defn b/Carpet/LoopControl/src/make.code.defn index 804104fc8..c821a8438 100644 --- a/Carpet/LoopControl/src/make.code.defn +++ b/Carpet/LoopControl/src/make.code.defn @@ -1,7 +1,7 @@ # Main make.code.defn file for thorn LoopControl # Source files in this directory -SRCS = loopcontrol.c loopcontrol.F90 loopcontrol_get_type_sizes.F90 loopcontrol_types.F90 lc_auto.c lc_siman.c lc_hill.c lc_selftest.c +SRCS = loopcontrol.c loopcontrol.F90 lc_get_type_sizes.F90 loopcontrol_types.F90 lc_auto.c lc_siman.c lc_hill.c lc_selftest.c # Subdirectories containing source files SUBDIRS = |