30 # error You must use C++ for Feel
38 #include <boost/mpl/multiplies.hpp>
39 #include <boost/mpl/list.hpp>
40 #include <boost/mpl/lower_bound.hpp>
41 #include <boost/mpl/transform_view.hpp>
42 #include <boost/mpl/sizeof.hpp>
43 #include <boost/mpl/int.hpp>
44 #include <boost/mpl/identity.hpp>
45 #include <boost/mpl/base.hpp>
46 #include <boost/mpl/deref.hpp>
47 #include <boost/mpl/begin_end.hpp>
48 #include <boost/mpl/comparison.hpp>
50 #include <boost/tokenizer.hpp>
51 #include <boost/token_functions.hpp>
52 #include <boost/algorithm/string/split.hpp>
53 #include <boost/algorithm/string/classification.hpp>
55 #include <boost/assign/list_of.hpp>
57 #include <boost/math/constants/constants.hpp>
59 #include <boost/lambda/lambda.hpp>
60 #include <boost/lambda/bind.hpp>
62 #include <boost/mpi.hpp>
64 #include <boost/program_options.hpp>
66 #include <boost/cstdint.hpp>
68 #include <boost/filesystem/operations.hpp>
69 #include <boost/filesystem/fstream.hpp>
71 #include <boost/format.hpp>
72 #include <boost/foreach.hpp>
80 #include <glog/logging.h>
82 #include <feel/feelconfig.h>
90 #if defined( FEELPP_HAS_TBB )
91 #include <tbb/tick_count.h>
92 #include <tbb/blocked_range.h>
93 #include <tbb/parallel_for.h>
94 #include <tbb/parallel_reduce.h>
95 #include <tbb/task_scheduler_init.h>
96 #include <tbb/mutex.h>
97 #endif // FEELPP_HAS_TBB
103 namespace assign = boost::assign;
104 namespace fs = boost::filesystem;
105 namespace mpl = boost::mpl;
106 namespace lambda = boost::lambda;
107 namespace po = boost::program_options;
108 namespace mpi=boost::mpi;
109 namespace constants=boost::math::constants;
112 const double pi = constants::pi<double>();
113 const double two_pi = constants::two_pi<double>();
115 namespace algorithm=boost::algorithm;
116 using google::WARNING;
142 template <
class T>
inline void ignore_unused_variable_warning(
const T& ) { }
182 typedef double scalar_type;
183 typedef std::complex<double> complex_type;
190 #include <boost/mpl/eval_if.hpp>
197 template<
int bit_size>
204 template<
int bit_size >
207 typedef mpl::list<signed char,signed short, signed int, signed long int, signed long long> builtins_;
208 typedef typename mpl::base<
typename mpl::lower_bound<
209 mpl::transform_view< builtins_, mpl::multiplies< mpl::sizeof_<mpl::placeholders::_1>, mpl::int_<8> >
211 , mpl::integral_c<size_t, bit_size>
212 >::type >::type iter_;
214 typedef typename mpl::end<builtins_>::type last_;
215 typedef typename mpl::eval_if<
216 boost::is_same<iter_,last_>
217 , mpl::identity< no_int<bit_size> >
222 template<
int bit_size >
225 typedef mpl::list<float, double, long double> builtins_;
226 typedef typename mpl::base<
typename mpl::lower_bound<
227 mpl::transform_view< builtins_, mpl::multiplies< mpl::sizeof_<mpl::placeholders::_1>, mpl::int_<8> >
229 , mpl::integral_c<size_t, bit_size>
230 >::type >::type iter_;
232 typedef typename mpl::end<builtins_>::type last_;
233 typedef typename mpl::eval_if<
234 boost::is_same<iter_,last_>
235 , mpl::identity< no_int<bit_size> >
241 typedef detail::integer<1>::type int1_type;
243 typedef detail::integer<8>::type int8_type;
244 typedef detail::integer<16>::type int16_type;
245 typedef detail::integer<32>::type int32_type;
246 typedef detail::integer<64>::type int64_type;
247 typedef detail::integer<128>::type int128_type;
249 typedef boost::int8_t int8_type;
250 typedef boost::int16_t int16_type;
251 typedef boost::int32_t int32_type;
252 #if !defined( BOOST_NO_INT64_T )
253 typedef boost::int64_t int64_type;
254 #endif // BOOST_NO_INT64_T
256 typedef detail::real<32>::type real32_type;
257 typedef detail::real<64>::type real64_type;
259 BOOST_STATIC_ASSERT( ( boost::is_same<real32_type, float>::value ) );
260 BOOST_STATIC_ASSERT( ( boost::is_same<real64_type, double>::value ) );
267 template<
int bit_size >
268 struct unsigned_integer
271 typedef mpl::list<unsigned char,unsigned short, unsigned int, unsigned long int, unsigned long long> builtins_;
272 typedef typename mpl::base<
typename mpl::lower_bound<
273 mpl::transform_view< builtins_
274 , mpl::multiplies< mpl::sizeof_<mpl::placeholders::_1>, mpl::int_<8> >
276 , mpl::integral_c<size_t, bit_size>
277 >::type >::type iter_;
279 typedef typename mpl::end<builtins_>::type last_;
280 typedef typename mpl::eval_if<
281 boost::is_same<iter_,last_>
282 , mpl::identity< no_int<bit_size> >
288 typedef detail::unsigned_integer<1>::type uint1_type;
289 typedef detail::unsigned_integer<8>::type uint8_type;
290 typedef detail::unsigned_integer<16>::type uint16_type;
291 typedef detail::unsigned_integer<32>::type uint32_type;
292 typedef detail::unsigned_integer<64>::type uint64_type;
293 typedef detail::unsigned_integer<128>::type uint128_type;
295 typedef boost::uint8_t uint8_type;
296 typedef boost::uint16_t uint16_type;
297 typedef boost::uint32_t uint32_type;
298 #if !defined( BOOST_NO_INT64_T )
299 typedef boost::uint64_t uint64_type;
306 typedef int64_type flag_type;
308 const int64_type invalid_flag_type_value = std::numeric_limits<int32_type>::min();
310 typedef int32_type flag_type;
312 const int32_type invalid_flag_type_value = std::numeric_limits<int32_type>::min();
313 #endif // BOOST_NO_INT64_T
321 #if defined( __APPLE__ )
322 typedef unsigned int uint;
345 #if !defined( BOOST_NO_INT64_T )
350 #endif // BOOST_NO_INT64_T
366 #include <boost/program_options.hpp>
367 #include <boost/date_time/posix_time/posix_time.hpp>
372 namespace po = boost::program_options;
375 prefixvm( std::string
const& prefix,
376 std::string
const& opt,
377 std::string
const& sep=
"." );
381 namespace posix_time = boost::posix_time;
382 namespace gregorian = boost::gregorian;
386 template<
typename TheArgs>
389 typedef typename boost::remove_pointer<
390 typename boost::remove_const<
391 typename boost::remove_reference<
400 #if defined( FEELPP_HAS_ARPREC)
401 # define FEELPP_HAS_MP_REAL 1
402 #include <mp/mpreal.h>
407 #if defined( FEELPP_HAS_QDLIB ) || defined( FEELPP_HAS_QD_H )
408 # define FEELPP_HAS_DD_REAL 1
409 # define FEELPP_HAS_QD_REAL 1
419 struct numeric_limits<dd_real>
421 static const bool is_specialized =
true;
423 static const int digits = 32;
424 static const int digits10 = 32;
425 static const bool is_signed =
true;
426 static const bool is_integer =
false;
427 static const bool is_exact =
false;
428 static const int radix = __FLT_RADIX__;
429 static dd_real epsilon() throw()
431 return dd_real::_eps;
433 static dd_real round_error() throw()
437 static dd_real min() throw()
439 return dd_real::_eps;
445 struct numeric_limits<qd_real>
447 static const bool is_specialized =
true;
449 static const int digits = 64;
450 static const int digits10 = 64;
451 static const bool is_signed =
true;
452 static const bool is_integer =
false;
453 static const bool is_exact =
false;
454 static const int radix = __FLT_RADIX__;
455 static qd_real epsilon() throw()
457 return qd_real::_eps;
459 static qd_real round_error() throw()
464 static qd_real min() throw()
466 return qd_real::_eps;
475 #if defined( FEELPP_HAS_MPFR )
476 #include <feel/feelcore/mpfr.hpp>
483 typedef mpfr::MpfrClass mp_type;
490 typedef mp_prec_t mp_precision_type;
501 inline void setMpPrecision( mp_precision_type __prec )
503 mpfr_set_default_prec ( __prec );
506 const mp_type mp_eps = mpfr::pow( mp_type( 2 ), -mp_type::GetDefaultPrecision()+1 );
509 #endif // FEELPP_HAS_MPFR
512 #include <boost/shared_ptr.hpp>
513 #include <boost/detail/is_xxx.hpp>
519 BOOST_DETAIL_IS_XXX_DEF( shared_ptr, boost::shared_ptr, 1 )
523 #if defined(FEELPP_HAS_OPENMP)
526 #define OMP_SET_NUM_THREADS(num) omp_set_num_threads(num)
527 #define OMP_GET_NUM_THREADS omp_get_num_threads()
528 #define OMP_SET_DYNAMIC(num) omp_set_dynamic(num)
529 #define OMP_SET_NESTED(num) omp_set_nested(num)
532 #define OMP_GET_WTIME omp_get_wtime()
533 #define OMP_GET_WTICK omp_get_wtick()
536 #define OMP_SET_NUM_THREADS(num)
537 #define OMP_GET_NUM_THREADS 1
538 #define OMP_SET_DYNAMIC(num)
539 #define OMP_SET_NESTED(num)
541 #define OMP_GET_WTIME 0
542 #define OMP_GET_WTICK 0
546 #if !defined( DVLOG_IF )
549 #define DVLOG_IF(verboselevel, condition) VLOG(verboselevel)
551 #define DVLOG_IF(verboselevel,condition) \
552 (true || ( !VLOG_IS_ON(verboselevel) && !(condition))) ? \
553 (void) 0 : google::LogMessageVoidify() & LOG(INFO)