[petsc-dev] two quick questions on Fortran style/includes

Ethan Coon ecoon at lanl.gov
Tue May 10 11:46:14 CDT 2011


1. Is there a reason that both .F and .F90 examples are in fixed format,
even though .F90 files should be interpreted as free format?  I guess
the fixed format works for either a fixed/free compiler, but it's ugly.
I wouldn't be surprised if there was a portability issue with free
format .F90 files, so I figured I'd check.

2. Is there a reason PETSC_SCALAR is defined in finclude/petscsysdef.h,
but PETSC_REAL is not?  Using PETSC_USE_FORTRAN_MODULES and "use petsc",
I get implicit declaration errors when using PETSC_REAL (but
PETSC_SCALAR is defined as expected).  

The below patch fixes this issue, assuming I'm not missing something...

diff -r b702b1062e33 include/finclude/petscsysdef.h
--- a/include/finclude/petscsysdef.h	Mon May 09 15:26:40 2011 -0600
+++ b/include/finclude/petscsysdef.h	Tue May 10 10:41:35 2011 -0600
@@ -115,7 +115,14 @@
 #define PETSC_SCALAR PETSC_LONG_DOUBLE
 #elif defined(PETSC_USE_REAL_DOUBLE)
 #define PETSC_SCALAR PETSC_DOUBLE
-#endif     
+#endif
+#endif
+#if defined(PETSC_USE_REAL_SINGLE)
+#define  PETSC_REAL  PETSC_FLOAT
+#elif defined(PETSC_USE_REAL_LONG_DOUBLE)
+#define  PETSC_REAL  PETSC_LONG_DOUBLE
+#else
+#define  PETSC_REAL  PETSC_DOUBLE
 #endif
 !
 !     Macro for templating between real and complex




-- 
------------------------------------
Ethan Coon
Post-Doctoral Researcher
Applied Mathematics - T-5
Los Alamos National Laboratory
505-665-8289

http://www.ldeo.columbia.edu/~ecoon/
------------------------------------




More information about the petsc-dev mailing list