[Patches] Re: [Users] Cactus/src/include/cctk.h

Jonathan Thornburg jthorn at aei.mpg.de
Wed Feb 1 05:46:21 CST 2006


[[This discussion is now about a specific *code* issue, so I'm moving
over to the patches/developers at cactuscode lists.]]

On Tue, 31 Jan 2006, Frank Loeffler wrote:
> cctk.h #defines _CCTK_FARGUMENTS. This is inserted at the beginning of each 
> function argument list in Fortran. This #define contains a lot of spaces. One 
> might think that spaces do not hurt, however:
>
> Peter Diener wrote:
>> The Fortran 90 standard allows for 39 continuation lines, i.e. a total
>> of 2880 (5280) characters in a line in 72 (132) line length mode.
>
> Frank Loeffler wrote:
> ... concerning xlf (the IBM Fortran compiler) and the function argument list:
>> The length of this cannot exceed 6700 characters AFAIK, but it does in
>> Whisky (CCTK_ARGUMENTS).
[[...]]
>
> You see, we hit this limit sometimes. Some compilers are more lax about this 
> limit, some are not. In any case I think we should try to produce valid 
> Fortran code. I do not suggest that the Cactus toolkit should try to minimise 
> the character count it uses for the argument list as much as possible to 
> leave more space for the users (thorns). However, it should not waste this 
> space by inserting spaces.

As a partial solution, I suggest we convert long strings of repeated
spaces in the macro expansion to single ASCII tab characters.  In
particular, I propose the enclosed patch, which reduces the size of
the macro expansion by 1111 characters (old cctk.h = 13467 characters,
new cctk.h = 12356 characters), with (IMHO) only a tiny loss in readability.

Ok to apply to CVS?

ciao,

-- 
-- Jonathan Thornburg <jthorn at aei.mpg.de>
    Max-Planck-Institut fuer Gravitationsphysik (Albert-Einstein-Institut),
    Golm, Germany, "Old Europe"     http://www.aei.mpg.de/~jthorn/home.html
    "Washing one's hands of the conflict between the powerful and the
     powerless means to side with the powerful, not to be neutral."
                                       -- quote by Freire / poster by Oxfam
-------------- next part --------------
Index: cctk.h
===================================================================
RCS file: /cactusdevcvs/Cactus/src/include/cctk.h,v
retrieving revision 1.95
diff -u -r1.95 cctk.h
--- cctk.h	15 Dec 2005 13:28:15 -0000	1.95
+++ cctk.h	1 Feb 2006 11:45:44 -0000
@@ -33,33 +33,34 @@
 #define CCTK_PRINTSEPARATOR\
   print '("--------------------------------------------------------------------------------")'
 
-#define _CCTK_FARGUMENTS  cctk_dim, cctk_gsh, cctk_lsh, cctk_lbnd,\
-                          cctk_ubnd, cctk_lssh, cctk_from, cctk_to, cctk_bbox,\
-                          cctk_delta_time, cctk_time, cctk_delta_space,\
-                          cctk_origin_space, cctk_levfac, \
-                          cctk_levoff, cctk_levoffdenom, cctk_timefac, \
-                          cctk_convlevel, cctk_convfac, \
-                          cctk_nghostzones, cctk_iteration, cctkGH
+#define _CCTK_FARGUMENTS \
+	cctk_dim, cctk_gsh, cctk_lsh, cctk_lbnd,\
+	cctk_ubnd, cctk_lssh, cctk_from, cctk_to, cctk_bbox,\
+	cctk_delta_time, cctk_time, cctk_delta_space,\
+	cctk_origin_space, cctk_levfac, \
+	cctk_levoff, cctk_levoffdenom, cctk_timefac, \
+	cctk_convlevel, cctk_convfac, \
+	cctk_nghostzones, cctk_iteration, cctkGH
 
 #define _DECLARE_CCTK_ARGUMENTS _DECLARE_CCTK_FARGUMENTS
 #define _DECLARE_CCTK_FARGUMENTS INTEGER cctk_dim&&\
-                           INTEGER cctk_gsh(cctk_dim),cctk_lsh(cctk_dim)&&\
-                           INTEGER cctk_lbnd(cctk_dim),cctk_ubnd(cctk_dim)&&\
-                           INTEGER cctk_lssh(CCTK_NSTAGGER*cctk_dim)&&\
-                           INTEGER cctk_from(cctk_dim),cctk_to(cctk_dim)&&\
-                           INTEGER cctk_bbox(2*cctk_dim)&&\
-                           CCTK_REAL cctk_delta_time, cctk_time&&\
-                           CCTK_REAL cctk_delta_space(cctk_dim)&&\
-                           CCTK_REAL cctk_origin_space(cctk_dim)&&\
-                           INTEGER cctk_levfac(cctk_dim)&&\
-                           INTEGER cctk_levoff(cctk_dim)&&\
-                           INTEGER cctk_levoffdenom(cctk_dim)&&\
-                           INTEGER cctk_timefac&&\
-                           INTEGER cctk_convlevel&&\
-                           INTEGER cctk_convfac&&\
-                           INTEGER cctk_nghostzones(cctk_dim)&&\
-                           INTEGER cctk_iteration&&\
-                           CCTK_POINTER cctkGH&&
+	INTEGER cctk_gsh(cctk_dim),cctk_lsh(cctk_dim)&&\
+	INTEGER cctk_lbnd(cctk_dim),cctk_ubnd(cctk_dim)&&\
+	INTEGER cctk_lssh(CCTK_NSTAGGER*cctk_dim)&&\
+	INTEGER cctk_from(cctk_dim),cctk_to(cctk_dim)&&\
+	INTEGER cctk_bbox(2*cctk_dim)&&\
+	CCTK_REAL cctk_delta_time, cctk_time&&\
+	CCTK_REAL cctk_delta_space(cctk_dim)&&\
+	CCTK_REAL cctk_origin_space(cctk_dim)&&\
+	INTEGER cctk_levfac(cctk_dim)&&\
+	INTEGER cctk_levoff(cctk_dim)&&\
+	INTEGER cctk_levoffdenom(cctk_dim)&&\
+	INTEGER cctk_timefac&&\
+	INTEGER cctk_convlevel&&\
+	INTEGER cctk_convfac&&\
+	INTEGER cctk_nghostzones(cctk_dim)&&\
+	INTEGER cctk_iteration&&\
+	CCTK_POINTER cctkGH&&
 
 #define CCTK_WARN(a,b) CCTK_Warn(a,__LINE__,__FORTRANFILE__,CCTK_THORNSTRING,b)
 
@@ -80,39 +81,39 @@
 
 #ifdef F90CODE
 
-#define _DECLARE_CCTK_FUNCTIONS                   \
-  external     CCTK_PointerTo                   &&\
-  CCTK_POINTER CCTK_PointerTo                   &&\
-  interface                                     &&\
-     integer function CCTK_Equals (arg1, arg2)  &&\
-       implicit none                            &&\
-       CCTK_POINTER_TO_CONST arg1               &&\
-       character(*) arg2                        &&\
-     end function CCTK_Equals                   &&\
-     integer function CCTK_MyProc (cctkGH)      &&\
-       implicit none                            &&\
-       CCTK_POINTER_TO_CONST cctkGH             &&\
-     end function CCTK_MyProc                   &&\
-     integer function CCTK_nProcs (cctkGH)      &&\
-       implicit none                            &&\
-       CCTK_POINTER_TO_CONST cctkGH             &&\
-     end function CCTK_nProcs                   &&\
-     integer function CCTK_IsThornActive (name) &&\
-       implicit none                            &&\
-       character(*) name                        &&\
-     end function CCTK_IsThornActive            &&\
-     CCTK_POINTER function CCTK_NullPointer ()  &&\
-       implicit none                            &&\
-     end function CCTK_NullPointer              &&\
-  end interface                                 &&
+#define _DECLARE_CCTK_FUNCTIONS \
+external	CCTK_PointerTo &&\
+CCTK_POINTER	CCTK_PointerTo &&\
+interface &&\
+  integer function CCTK_Equals(arg1, arg2) &&\
+    implicit none &&\
+    CCTK_POINTER_TO_CONST arg1 &&\
+    character(*) arg2 &&\
+  end function CCTK_Equals &&\
+  integer function CCTK_MyProc(cctkGH) &&\
+    implicit none &&\
+    CCTK_POINTER_TO_CONST cctkGH &&\
+  end function CCTK_MyProc &&\
+  integer function CCTK_nProcs(cctkGH) &&\
+    implicit none &&\
+    CCTK_POINTER_TO_CONST cctkGH &&\
+  end function CCTK_nProcs &&\
+  integer function CCTK_IsThornActive(name) &&\
+    implicit none &&\
+    character(*) name &&\
+  end function CCTK_IsThornActive &&\
+  CCTK_POINTER function CCTK_NullPointer() &&\
+    implicit none &&\
+  end function CCTK_NullPointer &&\
+end interface &&
 
 #else /* ! F90CODE */
 
 #define _DECLARE_CCTK_FUNCTIONS \
-  integer      CCTK_Equals, CCTK_MyProc, CCTK_nProcs, CCTK_IsThornActive &&\
-  external     CCTK_Equals, CCTK_MyProc, CCTK_nProcs, CCTK_IsThornActive &&\
-  CCTK_POINTER CCTK_PointerTo, CCTK_NullPointer &&\
-  external     CCTK_PointerTo, CCTK_NullPointer &&
+  integer	CCTK_Equals, CCTK_MyProc, CCTK_nProcs, CCTK_IsThornActive &&\
+  external	CCTK_Equals, CCTK_MyProc, CCTK_nProcs, CCTK_IsThornActive &&\
+  CCTK_POINTER	CCTK_PointerTo, CCTK_NullPointer &&\
+  external	CCTK_PointerTo, CCTK_NullPointer &&
 
 #endif /* ! F90CODE */
 


More information about the Patches mailing list