[ET Trac] [Einstein Toolkit] #1377: Cacus could/should provide M_PI

Einstein Toolkit trac-noreply at einsteintoolkit.org
Thu Jun 6 07:39:18 CDT 2013


#1377: Cacus could/should provide M_PI
--------------------------+-------------------------------------------------
  Reporter:  sbrandt      |       Owner:                     
      Type:  enhancement  |      Status:  new                
  Priority:  minor        |   Milestone:                     
 Component:  Cactus       |     Version:  development version
Resolution:               |    Keywords:  GRHydro M_PI       
--------------------------+-------------------------------------------------

Comment (by eschnett):

 Defining _BSD_SOURCE in a header file doesn't work because we would have
 to be sure that this header file is always included before math.h.

 This is not only about M_PI -- there are several other constants and
 several functions outside the C standard that we use in thorns. The POSIX
 standard <http://en.wikipedia.org/wiki/POSIX> is widely accepted, and is
 available everywhere (even Windows is POSIX compatible). I don't know why
 that page implies that M_PI is not defined by POSIX -- it is. But then,
 there are several releases of the POSIX standard.

 Another issue is that we follow the C99 standard in Cactus, not C89 (this
 also requires some compiler flags), with the exception of trigraphs (no
 one likes them, although they are in the C standard).  Cactus works find
 out of the box on most common systems. All supercomputers are special and
 often require a large set of flags to make things work, and I'm sure that
 Tianhe is not different. What compiler are you using there? There are
 fewer compilers than system architectures, and we are probably using the
 same compiler already on some other system, so you should be able to copy
 the options we use there.

 You are right; Cactus should ensure that M_PI is defined. This should be
 done via autoconf. This could at least be used to generate an error
 message with an explanation if M_PI is not present.

 Finally, thorn writers can also use C++ or OpenCL, which do define this
 constant...

-- 
Ticket URL: <https://trac.einsteintoolkit.org/ticket/1377#comment:8>
Einstein Toolkit <http://einsteintoolkit.org>
The Einstein Toolkit


More information about the Trac mailing list