Use Boost.Math to provide 'erf' when it is not provided by math.h
This commit is contained in:
parent
ef617af524
commit
96f93bbac7
3 changed files with 23 additions and 0 deletions
|
|
@ -1,5 +1,11 @@
|
|||
#include "ct_defs.h"
|
||||
#include <math.h>
|
||||
|
||||
#ifdef USE_BOOST_MATH
|
||||
#include <boost/math/special_functions/erf.hpp>
|
||||
using boost::math::erf;
|
||||
#endif
|
||||
|
||||
#include "LineBroadener.h"
|
||||
|
||||
using namespace std;
|
||||
|
|
|
|||
14
SConstruct
14
SConstruct
|
|
@ -446,11 +446,16 @@ elif env['CC'] == 'cl':
|
|||
else:
|
||||
assert False
|
||||
|
||||
if env['boost_inc_dir']:
|
||||
env.Append(CPPPATH=env['boost_inc_dir'])
|
||||
|
||||
conf = Configure(env)
|
||||
|
||||
env['HAS_SSTREAM'] = conf.CheckCXXHeader('sstream', '<>')
|
||||
env['HAS_TIMES_H'] = conf.CheckCHeader('sys/times.h', '""')
|
||||
env['HAS_UNISTD_H'] = conf.CheckCHeader('unistd.h', '""')
|
||||
env['HAS_MATH_H_ERF'] = conf.CheckDeclaration('erf', '#include <math.h>', 'C++')
|
||||
env['HAS_BOOST_MATH'] = conf.CheckCXXHeader('boost/math/special_functions/erf.hpp', '<>')
|
||||
env = conf.Finish()
|
||||
|
||||
if env['cantera_python_home'] == '' and env['prefix'] != defaults.prefix:
|
||||
|
|
@ -547,6 +552,15 @@ cdefine('THREAD_SAFE_CANTERA', 'build_thread_safe')
|
|||
cdefine('HAS_SSTREAM', 'HAS_SSTREAM')
|
||||
configh['CANTERA_DATA'] = quoted(os.path.join(env['prefix'], 'data'))
|
||||
|
||||
if not env['HAS_MATH_H_ERF']:
|
||||
if env['HAS_BOOST_MATH']:
|
||||
configh['USE_BOOST_MATH'] = 1
|
||||
else:
|
||||
print "Error: Couldn't find 'erf' in either <math.h> or Boost.Math"
|
||||
sys.exit(1)
|
||||
else:
|
||||
configh['USE_BOOST_MATH'] = None
|
||||
|
||||
config_h = env.Command('config.h', 'config.h.in.scons', ConfigBuilder(configh))
|
||||
env.AlwaysBuild(config_h)
|
||||
|
||||
|
|
|
|||
|
|
@ -61,6 +61,9 @@ typedef int ftnlen; // Fortran hidden string length type
|
|||
%(LAPACK_NAMES_LOWERCASE)s
|
||||
%(LAPACK_FTN_TRAILING_UNDERSCORE)s
|
||||
|
||||
//-------- BOOST --------
|
||||
%(USE_BOOST_MATH)s
|
||||
|
||||
//--------- operating system --------------------------------------
|
||||
|
||||
// The configure script defines this if the operatiing system is Mac
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue