diff options
-rw-r--r-- | src/CODESTYLE | 31 | ||||
-rw-r--r-- | src/elliptic/Jacobian.hh | 8 | ||||
-rw-r--r-- | src/elliptic/dense_Jacobian.hh | 8 | ||||
-rw-r--r-- | src/elliptic/row_sparse_Jacobian.hh | 8 | ||||
-rw-r--r-- | src/include/config.h | 5 | ||||
-rw-r--r-- | src/include/fake_cctk.h | 5 | ||||
-rw-r--r-- | src/include/stdc.h | 9 | ||||
-rw-r--r-- | src/jtutil/array.hh | 7 | ||||
-rw-r--r-- | src/jtutil/cpm_map.hh | 7 | ||||
-rw-r--r-- | src/jtutil/linear_map.hh | 7 | ||||
-rw-r--r-- | src/jtutil/util.hh | 5 |
11 files changed, 91 insertions, 9 deletions
diff --git a/src/CODESTYLE b/src/CODESTYLE index ed92163..56be3ea 100644 --- a/src/CODESTYLE +++ b/src/CODESTYLE @@ -1,6 +1,6 @@ AHFinderDirect Code Style ========================= -$Header: /usr/local/svn/cvs-repositories/numrelcvs/AEIThorns/AHFinderDirect/src/CODESTYLE,v 1.1 2003-03-22 18:56:49 jthorn Exp $ +$Header: /usr/local/svn/cvs-repositories/numrelcvs/AEIThorns/AHFinderDirect/src/CODESTYLE,v 1.2 2003-05-06 15:43:54 jthorn Exp $ This file documents some general programming conventions used in this thorn. @@ -17,6 +17,13 @@ so I've written my own (src/mpp). *.minc Maple headers to be @included by my Maple preprocessor *.mm Maple code (output from my Maple preprocessr) +None of my header files ever #includes another file, so in theory there's +no problem with multiple inclusion. However, see "C++ Templates" below +for some ugly compiler problems with this... + + +Configuration +============= Only a few options are configured at compile-time; these use #defines in src/include/config.h. @@ -143,6 +150,28 @@ boost::array, and my jtutil::array[1234]d<> classes should be converted to boost::multi_array. +C++ Templates +============= + +I use C++ templates, but not for anything fancy, just simple containers. +I instantiate all templates explicitly. + +Some C++ compilers offer "automatic" template instantiation. In practice +this often causes compilation to fail when the compiler can't find .cc +files in other directories. So, I highly recommend turning *off* all +automatic template instantiation "features". + +When using the DEC/Compaq/HP/whatever-their-corporate-name-is-this-week +C++ compiler (version 6.3.6.8) under Alpha Linux, even with automatic +template instiation disabled, the compiler *still* seems to include some +header files multiple times. To avoid duplicate-definition errors caused +by this, I have protected all the header files in the subdirectories + include/ + jtutil/ + elliptic/ +against multiple inclusion with the standard #ifndef trick. + + Miscellaneous ============= diff --git a/src/elliptic/Jacobian.hh b/src/elliptic/Jacobian.hh index 0cb43a2..0e16182 100644 --- a/src/elliptic/Jacobian.hh +++ b/src/elliptic/Jacobian.hh @@ -1,12 +1,14 @@ // Jacobian.hh -- generic data structures for the Jacobian matrix // $Header$ - // // Jacobian -- ABC to describe Jacobian matrix // decode_Jacobian_store_solve_method - decode string into internal enum // new_Jacobian - factory method // +#ifndef AHFINDERDIRECT__JACOBIAN_HH +#define AHFINDERDIRECT__JACOBIAN_HH + // // prerequisites: // "../patch/patch_system.hh" @@ -186,3 +188,7 @@ enum Jacobian_store_solve_method Jacobian* new_Jacobian(enum Jacobian_store_solve_method Jac_method, patch_system& ps, bool print_msg_flag = false); + +//****************************************************************************** + +#endif // AHFINDERDIRECT__JACOBIAN_HH diff --git a/src/elliptic/dense_Jacobian.hh b/src/elliptic/dense_Jacobian.hh index e6227a6..883f2ea 100644 --- a/src/elliptic/dense_Jacobian.hh +++ b/src/elliptic/dense_Jacobian.hh @@ -1,6 +1,5 @@ // dense_Jacobian.hh -- dense-matrix Jacobian // $Header$ - // #ifdef HAVE_DENSE_JACOBIAN // dense_Jacobian -- Jacobian stored as a dense matrix @@ -10,6 +9,9 @@ #endif // +#ifndef AHFINDERDIRECT__DENSE_JACOBIAN_HH +#define AHFINDERDIRECT__DENSE_JACOBIAN_HH + // // prerequisites: // "../patch/patch_system.hh" @@ -107,3 +109,7 @@ private: fp *rwork_; // size 4*N_rows_ }; #endif // HAVE_DENSE_JACOBIAN__LAPACK + +//****************************************************************************** + +#endif // AHFINDERDIRECT__DENSE_JACOBIAN_HH diff --git a/src/elliptic/row_sparse_Jacobian.hh b/src/elliptic/row_sparse_Jacobian.hh index 5bbc8e7..1c11878 100644 --- a/src/elliptic/row_sparse_Jacobian.hh +++ b/src/elliptic/row_sparse_Jacobian.hh @@ -1,6 +1,5 @@ // Jacobian.hh -- data structures for the Jacobian matrix // $Header$ - // #ifdef HAVE_ROW_SPARSE_JACOBIAN // row_sparse_Jacobian -- Jacobian stored as row-oriented sparse matrix @@ -10,6 +9,9 @@ #endif // +#ifndef AHFINDERDIRECT__ROW_SPARSE_JACOBIAN_HH +#define AHFINDERDIRECT__ROW_SPARSE_JACOBIAN_HH + // // prerequisites: // "../patch/patch_system.hh" @@ -205,3 +207,7 @@ private: fp* rtemp_; }; #endif // HAVE_ROW_SPARSE_JACOBIAN__ILUCG + +//****************************************************************************** + +#endif // AHFINDERDIRECT__ROW_SPARSE_JACOBIAN_HH diff --git a/src/include/config.h b/src/include/config.h index e761015..f5312fd 100644 --- a/src/include/config.h +++ b/src/include/config.h @@ -1,6 +1,9 @@ /* config.h -- compile-time configuration for AHFinderDirect */ /* $Header$ */ +#ifndef AHFINDERDIRECT__CONFIG_H +#define AHFINDERDIRECT__CONFIG_H + /* * This header file is #included by C++ and C files, and also by * Fortran 77 files which are run through a C-like preprocessor. Alas, @@ -97,3 +100,5 @@ typedef CCTK_INT integer; #ifdef HAVE_ROW_SPARSE_JACOBIAN__ILUCG #define HAVE_ROW_SPARSE_JACOBIAN #endif + +#endif /* AHFINDERDIRECT__CONFIG_H */ diff --git a/src/include/fake_cctk.h b/src/include/fake_cctk.h index 9c33a96..d294c66 100644 --- a/src/include/fake_cctk.h +++ b/src/include/fake_cctk.h @@ -1,6 +1,11 @@ /* fake_cctk.h -- fake "cctk.h" for non-Cactus standalone compilations */ /* $Header$ */ +#ifndef AHFINDERDIRECT__FAKE_CCTK_H +#define AHFINDERDIRECT__FAKE_CCTK_H + #define CCODE typedef int CCTK_INT; typedef double CCTK_REAL; + +#endif /* AHFINDERDIRECT__FAKE_CCTK_H */ diff --git a/src/include/stdc.h b/src/include/stdc.h index 872c012..7a3ad4d 100644 --- a/src/include/stdc.h +++ b/src/include/stdc.h @@ -1,14 +1,13 @@ /* stdc.h -- JT standard C/C++ header file, cut-down for modern code only */ /* $Header$ */ +#ifndef AHFINDERDIRECT__STDC_H +#define AHFINDERDIRECT__STDC_H + /* * ***** THIS VERSION IS FOR ANSI/ISO C AND C++ ***** */ -/* this header file is idempotent */ -#ifndef STDC_H_SEEN -#define STDC_H_SEEN - /******************************************************************************/ /* @@ -93,4 +92,4 @@ int error_exit(int msg_level, const char *format, ...) /******************************************************************************/ -#endif /* STDC_H_SEEN */ +#endif /* AHFINDERDIRECT__STDC_H */ diff --git a/src/jtutil/array.hh b/src/jtutil/array.hh index bff4aa7..4c62b55 100644 --- a/src/jtutil/array.hh +++ b/src/jtutil/array.hh @@ -9,6 +9,9 @@ #endif // +#ifndef AHFINDERDIRECT__ARRAY_HH +#define AHFINDERDIRECT__ARRAY_HH + // // prerequisites: // <assert.h> @@ -468,3 +471,7 @@ private: }; } // namespace jtutil:: #endif // NOT_USED + +//****************************************************************************** + +#endif // AHFINDERDIRECT__ARRAY_HH diff --git a/src/jtutil/cpm_map.hh b/src/jtutil/cpm_map.hh index 4853820..2ad291b 100644 --- a/src/jtutil/cpm_map.hh +++ b/src/jtutil/cpm_map.hh @@ -4,6 +4,9 @@ // cpm_map - "integer +/-" mapping // +#ifndef AHFINDERDIRECT__CPM_MAP_HH +#define AHFINDERDIRECT__CPM_MAP_HH + // // prerequisites // <assert.h> @@ -130,3 +133,7 @@ private: bool map_is_plus_; }; } // namespace jtutil:: + +//****************************************************************************** + +#endif // AHFINDERDIRECT__CPM_MAP_HH diff --git a/src/jtutil/linear_map.hh b/src/jtutil/linear_map.hh index a04ee0a..f1ed3a1 100644 --- a/src/jtutil/linear_map.hh +++ b/src/jtutil/linear_map.hh @@ -4,6 +4,9 @@ // jtutil::linear_map - linear mapping from integers <--> floating point values // +#ifndef AHFINDERDIRECT__LINEAR_MAP_HH +#define AHFINDERDIRECT__LINEAR_MAP_HH + // // prerequisites // <assert.h> @@ -137,3 +140,7 @@ private: const int min_int_, max_int_; }; } // namespace jtutil:: + +//****************************************************************************** + +#endif // AHFINDERDIRECT__LINEAR_MAP_HH diff --git a/src/jtutil/util.hh b/src/jtutil/util.hh index c9af42c..4b5c281 100644 --- a/src/jtutil/util.hh +++ b/src/jtutil/util.hh @@ -1,6 +1,9 @@ // util.hh -- utility stuff for this thorn (all lives in namespace jtutil::) // $Header$ +#ifndef AHFINDERDIRECT__UTIL_HH +#define AHFINDERDIRECT__UTIL_HH + // // prerequisites: // "stdc.h" @@ -205,3 +208,5 @@ public: //****************************************************************************** } // namespace jtutil + +#endif // AHFINDERDIRECT__UTIL_HH |