mirror of
http://172.16.200.102/MOISE/Timed-Altarica-To-Fiacre-Translator.git
synced 2025-11-26 06:17:57 +01:00
Initial commit.
This commit is contained in:
63
sdk/boost/numeric/bindings/traits/detail/utils.hpp
Normal file
63
sdk/boost/numeric/bindings/traits/detail/utils.hpp
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) Kresimir Fresl 2003
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* Author acknowledges the support of the Faculty of Civil Engineering,
|
||||
* University of Zagreb, Croatia.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef BOOST_NUMERIC_BINDINGS_TRAITS_DETAIL_UTILS_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_TRAITS_DETAIL_UTILS_HPP
|
||||
|
||||
#include <iterator>
|
||||
#include <boost/numeric/bindings/traits/type_traits.hpp>
|
||||
|
||||
namespace boost { namespace numeric { namespace bindings { namespace traits {
|
||||
|
||||
namespace detail {
|
||||
|
||||
// complex array => real & imaginary arrays
|
||||
template <typename CIt, typename RIt>
|
||||
void disentangle (CIt c, CIt c_end, RIt rr, RIt ri) {
|
||||
for (; c != c_end; ++c, ++rr, ++ri) {
|
||||
*rr = traits::real (*c);
|
||||
*ri = traits::imag (*c);
|
||||
}
|
||||
}
|
||||
// real & imaginary arrays => complex array
|
||||
template <typename RIt, typename CIt>
|
||||
void interlace (RIt r, RIt r_end, RIt ri, CIt c) {
|
||||
typedef typename std::iterator_traits<CIt>::value_type cmplx_t;
|
||||
#ifdef BOOST_NUMERIC_BINDINGS_BY_THE_BOOK
|
||||
for (; r != r_end; ++r, ++ri, ++c)
|
||||
*c = cmplx_t (*r, *ri);
|
||||
#else
|
||||
typedef typename type_traits<cmplx_t>::real_type real_t;
|
||||
real_t *cp = reinterpret_cast<real_t*> (&*c);
|
||||
for (; r != r_end; ++r, ++ri) {
|
||||
*cp = *r; ++cp;
|
||||
*cp = *ri; ++cp;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// converts real/complex to std::ptrdiff_t
|
||||
inline std::ptrdiff_t to_int (float f) { return static_cast<std::ptrdiff_t> (f); }
|
||||
inline std::ptrdiff_t to_int (double d) { return static_cast<std::ptrdiff_t> (d); }
|
||||
inline std::ptrdiff_t to_int (traits::complex_f const& cf) {
|
||||
return static_cast<std::ptrdiff_t> (traits::real (cf));
|
||||
}
|
||||
inline std::ptrdiff_t to_int (traits::complex_d const& cd) {
|
||||
return static_cast<std::ptrdiff_t> (traits::real (cd));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}}}}
|
||||
|
||||
#endif
|
||||
44
sdk/boost/numeric/bindings/traits/type.h
Normal file
44
sdk/boost/numeric/bindings/traits/type.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (C) 2000,2001,2002,2003 Si-Lab b.v.b.a. and Toon Knapen
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef BOOST_NUMERIC_BINDINGS_TRAITS_TYPE_H
|
||||
#define BOOST_NUMERIC_BINDINGS_TRAITS_TYPE_H
|
||||
|
||||
/*
|
||||
* This header defines the C types that will be mapped to
|
||||
* COMPLEX and COMPLEX*16 of Fortran
|
||||
*/
|
||||
|
||||
#ifndef BOOST_NUMERIC_BINDINGS_USE_COMPLEX_STRUCT
|
||||
|
||||
#if defined(__GNUC__)
|
||||
typedef _Complex float fcomplex_t ;
|
||||
typedef _Complex double dcomplex_t ;
|
||||
#else
|
||||
#include <complex>
|
||||
typedef std::complex<float> fcomplex_t ;
|
||||
typedef std::complex<double> dcomplex_t ;
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
typedef
|
||||
union {
|
||||
float cmplx[2] ;
|
||||
double align_struct_ ;
|
||||
} fcomplex_t ;
|
||||
|
||||
typedef
|
||||
struct {
|
||||
double cmplx[2] ;
|
||||
} dcomplex_t ;
|
||||
|
||||
#endif /* BOOST_NUMERIC_BINDINGS_USE_COMPLEX_STRUCT */
|
||||
|
||||
#endif /* BOOST_NUMERIC_BINDINGS_TRAITS_TYPE_H */
|
||||
34
sdk/boost/numeric/bindings/traits/type.hpp
Normal file
34
sdk/boost/numeric/bindings/traits/type.hpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifndef boost_numeric_bindings_type_hpp
|
||||
#define boost_numeric_bindings_type_hpp
|
||||
|
||||
// This header provides typedefs to float complex and double complex.
|
||||
// This makes it possible to redefine the complex class being used.
|
||||
|
||||
#include <complex>
|
||||
|
||||
namespace boost { namespace numeric { namespace bindings { namespace traits {
|
||||
|
||||
/* The types for single and double precision complex numbers.
|
||||
* You can use your own types if you define
|
||||
* BOOST_NUMERIC_BINDINGS_USE_CUSTOM_COMPLEX_TYPE.
|
||||
* Note that these types must have the same memory layout as the
|
||||
* corresponding FORTRAN types.
|
||||
* For that reason you can even use a different type in each translation
|
||||
* unit and the resulting binary will still work!
|
||||
*/
|
||||
#ifndef BOOST_NUMERIC_BINDINGS_USE_CUSTOM_COMPLEX_TYPE
|
||||
typedef std::complex< float > complex_f ;
|
||||
typedef std::complex< double > complex_d ;
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
T real (std::complex<T> const& c) { return std::real (c); }
|
||||
template <typename T>
|
||||
T imag (std::complex<T> const& c) { return std::imag (c); }
|
||||
|
||||
|
||||
struct null_t {};
|
||||
|
||||
}}}}
|
||||
|
||||
#endif // boost_numeric_bindings_type_hpp
|
||||
64
sdk/boost/numeric/bindings/traits/type_traits.hpp
Normal file
64
sdk/boost/numeric/bindings/traits/type_traits.hpp
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) Kresimir Fresl and Toon Knapen 2002, 2003
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* First author acknowledges the support of the Faculty of Civil Engineering,
|
||||
* University of Zagreb, Croatia.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef BOOST_NUMERIC_BINDINGS_TRAITS_TYPE_TRAITS_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_TRAITS_TYPE_TRAITS_HPP
|
||||
|
||||
#include <boost/numeric/bindings/traits/type.h>
|
||||
#include <boost/numeric/bindings/traits/type.hpp>
|
||||
|
||||
namespace boost { namespace numeric { namespace bindings { namespace traits {
|
||||
|
||||
template <typename Real>
|
||||
struct type_traits {
|
||||
};
|
||||
template<>
|
||||
struct type_traits<float> {
|
||||
typedef float type;
|
||||
typedef float real_type;
|
||||
};
|
||||
template<>
|
||||
struct type_traits<double> {
|
||||
typedef double type;
|
||||
typedef double real_type;
|
||||
};
|
||||
template<>
|
||||
struct type_traits<complex_f> {
|
||||
typedef complex_f type;
|
||||
typedef float real_type;
|
||||
};
|
||||
template<>
|
||||
struct type_traits<complex_d> {
|
||||
typedef complex_d type;
|
||||
typedef double real_type;
|
||||
};
|
||||
|
||||
|
||||
inline const fcomplex_t* complex_ptr(const complex_f* c) { return reinterpret_cast<const fcomplex_t*>( c ) ; }
|
||||
inline const dcomplex_t* complex_ptr(const complex_d* c) { return reinterpret_cast<const dcomplex_t*>( c ) ; }
|
||||
|
||||
inline fcomplex_t* complex_ptr( complex_f* c) { return reinterpret_cast< fcomplex_t*>( c ) ; }
|
||||
inline dcomplex_t* complex_ptr( complex_d* c) { return reinterpret_cast< dcomplex_t*>( c ) ; }
|
||||
|
||||
template< typename Type >
|
||||
inline void* void_ptr( Type* p) { return static_cast<void*>( p ); }
|
||||
template< typename Type >
|
||||
inline const void* void_ptr( const Type* p) { return static_cast<const void*>( p ); }
|
||||
|
||||
inline complex_f complex_ret(const fcomplex_t& ret) { return reinterpret_cast<const complex_f&>( ret ) ; }
|
||||
inline complex_d complex_ret(const dcomplex_t& ret) { return reinterpret_cast<const complex_d&>( ret ) ; }
|
||||
|
||||
}}}}
|
||||
|
||||
#endif // BOOST_NUMERIC_BINDINGS_TRAITS_TYPE_TRAITS_HPP
|
||||
|
||||
Reference in New Issue
Block a user