diff options
author | schnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2007-04-27 19:41:24 +0000 |
---|---|---|
committer | schnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2007-04-27 19:41:24 +0000 |
commit | 934ebfc5904fec1cd74181849e0c1964dcb60d07 (patch) | |
tree | 283215c1e056dad7c07015a2085150978fd407f0 /src/main/ConfigData.c | |
parent | f4093eb1aeacd91454abd938a021b64409878d45 (diff) |
This patch makes complex arithmetic in C and C++ more efficient, and
makes it much more convenient for C++, expecially when templates are
used.
The flesh functions for complex arithmetic are defined (not only
declared) by including Complex.c from the header file cctk_Complex.h.
They are declared "static inline", so the the compiler can inline
them, but does not have to create an out-of-line copy for every source
file. Complex.c is also compiled stand-alone without the "static
inline" prefix, so that out-of-line copies exist as well.
Add some new complex arithmetic functions, e.g. ComplexNeg to change
the sign.
Make some complex arithmetic functions more efficient by using
algorithms from glibc. These algorithms are LGPL. They should be
faster and/or more accurate than the existing implementations.
For C++, define the usual arithmetic operators (+-*/ etc.) as inline
functions calling the corresponding complex arithmetic functions.
This makes it possible to use complex numbers in the same way as real
numbers, which makes it possible to instantiate templates for both
CCTK_REAL and CCTK_COMPLEX. This leads to much code reduction in
Carpet.
The patch also appends a type postfix to the names of math functions
called in the inlined routines: 'f' for HAVE_CCTK_REAL4, nothing for
HAVE_CCTK_REAL8, and 'l' for HAVE_CCTK_REAL16. This avoids compiler
warnings about conversions from "double" to "float" which may lose
significant bits.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@4418 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/main/ConfigData.c')
0 files changed, 0 insertions, 0 deletions