Initial Commit
This commit is contained in:
@@ -0,0 +1,170 @@
|
||||
/*
|
||||
[auto_generated]
|
||||
boost/numeric/odeint/stepper/implicit_euler.hpp
|
||||
|
||||
[begin_description]
|
||||
Impementation of the implicit Euler method. Works with ublas::vector as state type.
|
||||
[end_description]
|
||||
|
||||
Copyright 2010-2012 Mario Mulansky
|
||||
Copyright 2010-2012 Karsten Ahnert
|
||||
Copyright 2012 Christoph Koke
|
||||
|
||||
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_ODEINT_STEPPER_IMPLICIT_EULER_HPP_INCLUDED
|
||||
#define BOOST_NUMERIC_ODEINT_STEPPER_IMPLICIT_EULER_HPP_INCLUDED
|
||||
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <boost/numeric/odeint/util/bind.hpp>
|
||||
#include <boost/numeric/odeint/util/unwrap_reference.hpp>
|
||||
#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
|
||||
|
||||
#include <boost/numeric/odeint/util/ublas_wrapper.hpp>
|
||||
#include <boost/numeric/odeint/util/is_resizeable.hpp>
|
||||
#include <boost/numeric/odeint/util/resizer.hpp>
|
||||
|
||||
#include <boost/numeric/ublas/vector.hpp>
|
||||
#include <boost/numeric/ublas/matrix.hpp>
|
||||
#include <boost/numeric/ublas/lu.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace odeint {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template< class ValueType , class Resizer = initially_resizer >
|
||||
class implicit_euler
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
typedef ValueType value_type;
|
||||
typedef value_type time_type;
|
||||
typedef boost::numeric::ublas::vector< value_type > state_type;
|
||||
typedef state_wrapper< state_type > wrapped_state_type;
|
||||
typedef state_type deriv_type;
|
||||
typedef state_wrapper< deriv_type > wrapped_deriv_type;
|
||||
typedef boost::numeric::ublas::matrix< value_type > matrix_type;
|
||||
typedef state_wrapper< matrix_type > wrapped_matrix_type;
|
||||
typedef boost::numeric::ublas::permutation_matrix< size_t > pmatrix_type;
|
||||
typedef state_wrapper< pmatrix_type > wrapped_pmatrix_type;
|
||||
typedef Resizer resizer_type;
|
||||
typedef stepper_tag stepper_category;
|
||||
typedef implicit_euler< ValueType , Resizer > stepper_type;
|
||||
|
||||
implicit_euler( value_type epsilon = 1E-6 )
|
||||
: m_epsilon( epsilon )
|
||||
{ }
|
||||
|
||||
|
||||
template< class System >
|
||||
void do_step( System system , state_type &x , time_type t , time_type dt )
|
||||
{
|
||||
typedef typename odeint::unwrap_reference< System >::type system_type;
|
||||
typedef typename odeint::unwrap_reference< typename system_type::first_type >::type deriv_func_type;
|
||||
typedef typename odeint::unwrap_reference< typename system_type::second_type >::type jacobi_func_type;
|
||||
system_type &sys = system;
|
||||
deriv_func_type &deriv_func = sys.first;
|
||||
jacobi_func_type &jacobi_func = sys.second;
|
||||
|
||||
m_resizer.adjust_size( x , detail::bind( &stepper_type::template resize_impl<state_type> , detail::ref( *this ) , detail::_1 ) );
|
||||
|
||||
for( size_t i=0 ; i<x.size() ; ++i )
|
||||
m_pm.m_v[i] = i;
|
||||
|
||||
t += dt;
|
||||
|
||||
// apply first Newton step
|
||||
deriv_func( x , m_dxdt.m_v , t );
|
||||
|
||||
m_b.m_v = dt * m_dxdt.m_v;
|
||||
|
||||
jacobi_func( x , m_jacobi.m_v , t );
|
||||
m_jacobi.m_v *= dt;
|
||||
m_jacobi.m_v -= boost::numeric::ublas::identity_matrix< value_type >( x.size() );
|
||||
|
||||
solve( m_b.m_v , m_jacobi.m_v );
|
||||
|
||||
m_x.m_v = x - m_b.m_v;
|
||||
|
||||
// iterate Newton until some precision is reached
|
||||
// ToDo: maybe we should apply only one Newton step -> linear implicit one-step scheme
|
||||
while( boost::numeric::ublas::norm_2( m_b.m_v ) > m_epsilon )
|
||||
{
|
||||
deriv_func( m_x.m_v , m_dxdt.m_v , t );
|
||||
m_b.m_v = x - m_x.m_v + dt*m_dxdt.m_v;
|
||||
|
||||
// simplified version, only the first Jacobian is used
|
||||
// jacobi( m_x , m_jacobi , t );
|
||||
// m_jacobi *= dt;
|
||||
// m_jacobi -= boost::numeric::ublas::identity_matrix< value_type >( x.size() );
|
||||
|
||||
solve( m_b.m_v , m_jacobi.m_v );
|
||||
|
||||
m_x.m_v -= m_b.m_v;
|
||||
}
|
||||
x = m_x.m_v;
|
||||
}
|
||||
|
||||
template< class StateType >
|
||||
void adjust_size( const StateType &x )
|
||||
{
|
||||
resize_impl( x );
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
template< class StateIn >
|
||||
bool resize_impl( const StateIn &x )
|
||||
{
|
||||
bool resized = false;
|
||||
resized |= adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() );
|
||||
resized |= adjust_size_by_resizeability( m_x , x , typename is_resizeable<state_type>::type() );
|
||||
resized |= adjust_size_by_resizeability( m_b , x , typename is_resizeable<deriv_type>::type() );
|
||||
resized |= adjust_size_by_resizeability( m_jacobi , x , typename is_resizeable<matrix_type>::type() );
|
||||
resized |= adjust_size_by_resizeability( m_pm , x , typename is_resizeable<pmatrix_type>::type() );
|
||||
return resized;
|
||||
}
|
||||
|
||||
|
||||
void solve( state_type &x , matrix_type &m )
|
||||
{
|
||||
int res = boost::numeric::ublas::lu_factorize( m , m_pm.m_v );
|
||||
if( res != 0 ) std::exit(0);
|
||||
boost::numeric::ublas::lu_substitute( m , m_pm.m_v , x );
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
value_type m_epsilon;
|
||||
resizer_type m_resizer;
|
||||
wrapped_deriv_type m_dxdt;
|
||||
wrapped_state_type m_x;
|
||||
wrapped_deriv_type m_b;
|
||||
wrapped_matrix_type m_jacobi;
|
||||
wrapped_pmatrix_type m_pm;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // odeint
|
||||
} // numeric
|
||||
} // boost
|
||||
|
||||
|
||||
#endif // BOOST_NUMERIC_ODEINT_STEPPER_IMPLICIT_EULER_HPP_INCLUDED
|
||||
@@ -0,0 +1,120 @@
|
||||
|
||||
// (C) Copyright Tobias Schwinger
|
||||
//
|
||||
// Use modification and distribution are subject to the boost Software License,
|
||||
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// no include guards, this file is intended for multiple inclusions
|
||||
|
||||
// this file has been generated from the master.hpp file in the same directory
|
||||
# define BOOST_FT_cc_id 1
|
||||
# define BOOST_FT_cc_name implicit_cc
|
||||
# define BOOST_FT_cc BOOST_PP_EMPTY
|
||||
# define BOOST_FT_cond BOOST_FT_CC_IMPLICIT
|
||||
# if BOOST_FT_cond
|
||||
# define BOOST_FT_config_valid 1
|
||||
# include BOOST_FT_cc_file
|
||||
# endif
|
||||
# undef BOOST_FT_cond
|
||||
# undef BOOST_FT_cc_name
|
||||
# undef BOOST_FT_cc
|
||||
# undef BOOST_FT_cc_id
|
||||
# define BOOST_FT_cc_id 2
|
||||
# define BOOST_FT_cc_name cdecl_cc
|
||||
# define BOOST_FT_cc BOOST_PP_IDENTITY(__cdecl )
|
||||
# define BOOST_FT_cond BOOST_FT_CC_CDECL
|
||||
# if BOOST_FT_cond
|
||||
# define BOOST_FT_config_valid 1
|
||||
# include BOOST_FT_cc_file
|
||||
# endif
|
||||
# undef BOOST_FT_cond
|
||||
# undef BOOST_FT_cc_name
|
||||
# undef BOOST_FT_cc
|
||||
# undef BOOST_FT_cc_id
|
||||
# define BOOST_FT_cc_id 3
|
||||
# define BOOST_FT_cc_name stdcall_cc
|
||||
# define BOOST_FT_cc BOOST_PP_IDENTITY(__stdcall )
|
||||
# define BOOST_FT_cond BOOST_FT_CC_STDCALL
|
||||
# if BOOST_FT_cond
|
||||
# define BOOST_FT_config_valid 1
|
||||
# include BOOST_FT_cc_file
|
||||
# endif
|
||||
# undef BOOST_FT_cond
|
||||
# undef BOOST_FT_cc_name
|
||||
# undef BOOST_FT_cc
|
||||
# undef BOOST_FT_cc_id
|
||||
# define BOOST_FT_cc_id 4
|
||||
# define BOOST_FT_cc_name pascal_cc
|
||||
# define BOOST_FT_cc BOOST_PP_IDENTITY(pascal )
|
||||
# define BOOST_FT_cond BOOST_FT_CC_PASCAL
|
||||
# if BOOST_FT_cond
|
||||
# define BOOST_FT_config_valid 1
|
||||
# include BOOST_FT_cc_file
|
||||
# endif
|
||||
# undef BOOST_FT_cond
|
||||
# undef BOOST_FT_cc_name
|
||||
# undef BOOST_FT_cc
|
||||
# undef BOOST_FT_cc_id
|
||||
# define BOOST_FT_cc_id 5
|
||||
# define BOOST_FT_cc_name fastcall_cc
|
||||
# define BOOST_FT_cc BOOST_PP_IDENTITY(__fastcall)
|
||||
# define BOOST_FT_cond BOOST_FT_CC_FASTCALL
|
||||
# if BOOST_FT_cond
|
||||
# define BOOST_FT_config_valid 1
|
||||
# include BOOST_FT_cc_file
|
||||
# endif
|
||||
# undef BOOST_FT_cond
|
||||
# undef BOOST_FT_cc_name
|
||||
# undef BOOST_FT_cc
|
||||
# undef BOOST_FT_cc_id
|
||||
# define BOOST_FT_cc_id 6
|
||||
# define BOOST_FT_cc_name clrcall_cc
|
||||
# define BOOST_FT_cc BOOST_PP_IDENTITY(__clrcall )
|
||||
# define BOOST_FT_cond BOOST_FT_CC_CLRCALL
|
||||
# if BOOST_FT_cond
|
||||
# define BOOST_FT_config_valid 1
|
||||
# include BOOST_FT_cc_file
|
||||
# endif
|
||||
# undef BOOST_FT_cond
|
||||
# undef BOOST_FT_cc_name
|
||||
# undef BOOST_FT_cc
|
||||
# undef BOOST_FT_cc_id
|
||||
# define BOOST_FT_cc_id 7
|
||||
# define BOOST_FT_cc_name thiscall_cc
|
||||
# define BOOST_FT_cc BOOST_PP_IDENTITY(__thiscall)
|
||||
# define BOOST_FT_cond BOOST_FT_CC_THISCALL
|
||||
# if BOOST_FT_cond
|
||||
# define BOOST_FT_config_valid 1
|
||||
# include BOOST_FT_cc_file
|
||||
# endif
|
||||
# undef BOOST_FT_cond
|
||||
# undef BOOST_FT_cc_name
|
||||
# undef BOOST_FT_cc
|
||||
# undef BOOST_FT_cc_id
|
||||
# define BOOST_FT_cc_id 8
|
||||
# define BOOST_FT_cc_name thiscall_cc
|
||||
# define BOOST_FT_cc BOOST_PP_EMPTY
|
||||
# define BOOST_FT_cond BOOST_FT_CC_IMPLICIT_THISCALL
|
||||
# if BOOST_FT_cond
|
||||
# define BOOST_FT_config_valid 1
|
||||
# include BOOST_FT_cc_file
|
||||
# endif
|
||||
# undef BOOST_FT_cond
|
||||
# undef BOOST_FT_cc_name
|
||||
# undef BOOST_FT_cc
|
||||
# undef BOOST_FT_cc_id
|
||||
# ifndef BOOST_FT_config_valid
|
||||
# define BOOST_FT_cc_id 1
|
||||
# define BOOST_FT_cc_name implicit_cc
|
||||
# define BOOST_FT_cc BOOST_PP_EMPTY
|
||||
# define BOOST_FT_cond 0x00000001
|
||||
# include BOOST_FT_cc_file
|
||||
# undef BOOST_FT_cond
|
||||
# undef BOOST_FT_cc_name
|
||||
# undef BOOST_FT_cc
|
||||
# undef BOOST_FT_cc_id
|
||||
# else
|
||||
# undef BOOST_FT_config_valid
|
||||
# endif
|
||||
@@ -0,0 +1,45 @@
|
||||
|
||||
// (C) Copyright Tobias Schwinger
|
||||
//
|
||||
// Use modification and distribution are subject to the boost Software License,
|
||||
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef BOOST_FT_DETAIL_TO_SEQUENCE_HPP_INCLUDED
|
||||
#define BOOST_FT_DETAIL_TO_SEQUENCE_HPP_INCLUDED
|
||||
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/is_sequence.hpp>
|
||||
#include <boost/mpl/placeholders.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
|
||||
#include <boost/function_types/is_callable_builtin.hpp>
|
||||
|
||||
namespace boost { namespace function_types { namespace detail {
|
||||
|
||||
// wrap first arguments in components, if callable builtin type
|
||||
template<typename T>
|
||||
struct to_sequence
|
||||
{
|
||||
typedef typename
|
||||
mpl::eval_if
|
||||
< is_callable_builtin<T>
|
||||
, to_sequence< components<T> >
|
||||
, mpl::identity< T >
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
|
||||
// reduce template instantiations, if possible
|
||||
template<typename T, typename U>
|
||||
struct to_sequence< components<T,U> >
|
||||
{
|
||||
typedef typename components<T,U>::types type;
|
||||
};
|
||||
|
||||
} } } // namespace ::boost::function_types::detail
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
#include "FileNode.hpp"
|
||||
|
||||
#include <QVariant>
|
||||
#include <QUrl>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include "Directory.hpp"
|
||||
#include "MessageBox.hpp"
|
||||
|
||||
FileNode::FileNode (QTreeWidgetItem * parent
|
||||
, QNetworkAccessManager * network_manager
|
||||
, QString const& local_file_path
|
||||
, QUrl const& url
|
||||
, bool http_only)
|
||||
: QTreeWidgetItem {parent, Type}
|
||||
, remote_file_ {this, network_manager, local_file_path, http_only}
|
||||
, block_sync_ {false}
|
||||
{
|
||||
sync_blocker b {this};
|
||||
setFlags (flags () | Qt::ItemIsUserCheckable);
|
||||
setText (0, QFileInfo {local_file_path}.fileName ()); // display
|
||||
setData (0, Qt::UserRole, url);
|
||||
setData (0, Qt::UserRole + 1, local_file_path); // local absolute path
|
||||
setCheckState (0, Qt::Unchecked);
|
||||
}
|
||||
|
||||
void FileNode::error (QString const& title, QString const& message)
|
||||
{
|
||||
MessageBox::warning_message (treeWidget (), title, message);
|
||||
}
|
||||
|
||||
bool FileNode::sync (bool local)
|
||||
{
|
||||
if (block_sync_)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return remote_file_.sync (data (0, Qt::UserRole).toUrl (), local);
|
||||
}
|
||||
|
||||
void FileNode::download_progress (qint64 bytes_received, qint64 total_bytes)
|
||||
{
|
||||
sync_blocker b {this};
|
||||
setData (1, Qt::UserRole, total_bytes);
|
||||
if (bytes_received < 0)
|
||||
{
|
||||
setData (1, Qt::DisplayRole, 0ll);
|
||||
setCheckState (0, Qt::Unchecked);
|
||||
}
|
||||
else
|
||||
{
|
||||
setData (1, Qt::DisplayRole, bytes_received);
|
||||
}
|
||||
static_cast<Directory *> (treeWidget ())->update (parent ());
|
||||
}
|
||||
|
||||
void FileNode::download_finished (bool success)
|
||||
{
|
||||
sync_blocker b {this};
|
||||
if (!success)
|
||||
{
|
||||
setData (1, Qt::UserRole, 0ll);
|
||||
setData (1, Qt::DisplayRole, 0ll);
|
||||
}
|
||||
setCheckState (0, success ? Qt::Checked : Qt::Unchecked);
|
||||
static_cast<Directory *> (treeWidget ())->update (parent ());
|
||||
}
|
||||
|
||||
void FileNode::abort ()
|
||||
{
|
||||
sync_blocker b {this};
|
||||
remote_file_.abort ();
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*==============================================================================
|
||||
Copyright (c) 2010-2011 Bryce Lelbach
|
||||
|
||||
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_DETAIL_SORTED_HPP
|
||||
#define BOOST_DETAIL_SORTED_HPP
|
||||
|
||||
#include <boost/detail/iterator.hpp>
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
|
||||
template<class Iterator, class Comp>
|
||||
inline Iterator is_sorted_until (Iterator first, Iterator last, Comp c) {
|
||||
if (first == last)
|
||||
return last;
|
||||
|
||||
Iterator it = first; ++it;
|
||||
|
||||
for (; it != last; first = it, ++it)
|
||||
if (c(*it, *first))
|
||||
return it;
|
||||
|
||||
return it;
|
||||
}
|
||||
|
||||
template<class Iterator>
|
||||
inline Iterator is_sorted_until (Iterator first, Iterator last) {
|
||||
typedef typename boost::detail::iterator_traits<Iterator>::value_type
|
||||
value_type;
|
||||
|
||||
typedef std::less<value_type> c;
|
||||
|
||||
return ::boost::detail::is_sorted_until(first, last, c());
|
||||
}
|
||||
|
||||
template<class Iterator, class Comp>
|
||||
inline bool is_sorted (Iterator first, Iterator last, Comp c) {
|
||||
return ::boost::detail::is_sorted_until(first, last, c) == last;
|
||||
}
|
||||
|
||||
template<class Iterator>
|
||||
inline bool is_sorted (Iterator first, Iterator last) {
|
||||
return ::boost::detail::is_sorted_until(first, last) == last;
|
||||
}
|
||||
|
||||
} // detail
|
||||
} // boost
|
||||
|
||||
#endif // BOOST_DETAIL_SORTED_HPP
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
// Boost.Units - A C++ library for zero-overhead dimensional analysis and
|
||||
// unit/quantity manipulation and conversion
|
||||
//
|
||||
// Copyright (C) 2003-2008 Matthias Christian Schabel
|
||||
// Copyright (C) 2008 Steven Watanabe
|
||||
//
|
||||
// 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_UNITS_ACCELERATION_DERIVED_DIMENSION_HPP
|
||||
#define BOOST_UNITS_ACCELERATION_DERIVED_DIMENSION_HPP
|
||||
|
||||
#include <boost/units/derived_dimension.hpp>
|
||||
#include <boost/units/physical_dimensions/length.hpp>
|
||||
#include <boost/units/physical_dimensions/time.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace units {
|
||||
|
||||
/// derived dimension for acceleration : L T^-2
|
||||
typedef derived_dimension<length_base_dimension,1,
|
||||
time_base_dimension,-2>::type acceleration_dimension;
|
||||
|
||||
} // namespace units
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_UNITS_ACCELERATION_DERIVED_DIMENSION_HPP
|
||||
@@ -0,0 +1,61 @@
|
||||
|
||||
// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
|
||||
// Use, modification and distribution are subject to 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).
|
||||
//
|
||||
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
|
||||
|
||||
#ifndef BOOST_TT_ADD_POINTER_HPP_INCLUDED
|
||||
#define BOOST_TT_ADD_POINTER_HPP_INCLUDED
|
||||
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
#if defined(__BORLANDC__) && (__BORLANDC__ < 0x5A0)
|
||||
//
|
||||
// For some reason this implementation stops Borlands compiler
|
||||
// from dropping cv-qualifiers, it still fails with references
|
||||
// to arrays for some reason though (shrug...) (JM 20021104)
|
||||
//
|
||||
template <typename T>
|
||||
struct add_pointer
|
||||
{
|
||||
typedef T* type;
|
||||
};
|
||||
template <typename T>
|
||||
struct add_pointer<T&>
|
||||
{
|
||||
typedef T* type;
|
||||
};
|
||||
template <typename T>
|
||||
struct add_pointer<T&const>
|
||||
{
|
||||
typedef T* type;
|
||||
};
|
||||
template <typename T>
|
||||
struct add_pointer<T&volatile>
|
||||
{
|
||||
typedef T* type;
|
||||
};
|
||||
template <typename T>
|
||||
struct add_pointer<T&const volatile>
|
||||
{
|
||||
typedef T* type;
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
template <typename T>
|
||||
struct add_pointer
|
||||
{
|
||||
typedef typename remove_reference<T>::type no_ref_type;
|
||||
typedef no_ref_type* type;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_TT_ADD_POINTER_HPP_INCLUDED
|
||||
@@ -0,0 +1,518 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#define RADS 0.0174532925199433
|
||||
#define DEGS 57.2957795130823
|
||||
#define TPI 6.28318530717959
|
||||
#define PI 3.1415927
|
||||
|
||||
/* ratio of earth radius to astronomical unit */
|
||||
#define ER_OVER_AU 0.0000426352325194252
|
||||
|
||||
/* all prototypes here */
|
||||
|
||||
double getcoord(int coord);
|
||||
void getargs(int argc, char *argv[], int *y, int *m, double *tz, double *glong, double *glat);
|
||||
double range(double y);
|
||||
double rangerad(double y);
|
||||
double days(int y, int m, int dn, double hour);
|
||||
double days_(int *y, int *m, int *dn, double *hour);
|
||||
void moonpos(double, double *, double *, double *);
|
||||
void sunpos(double , double *, double *, double *);
|
||||
double moontransit(int y, int m, int d, double timezone, double glat, double glong, int *nt);
|
||||
double atan22(double y, double x);
|
||||
double epsilon(double d);
|
||||
void equatorial(double d, double *lon, double *lat, double *r);
|
||||
void ecliptic(double d, double *lon, double *lat, double *r);
|
||||
double gst(double d);
|
||||
void topo(double lst, double glat, double *alp, double *dec, double *r);
|
||||
double alt(double glat, double ha, double dec);
|
||||
void libration(double day, double lambda, double beta, double alpha, double *l, double *b, double *p);
|
||||
void illumination(double day, double lra, double ldec, double dr, double sra, double sdec, double *pabl, double *ill);
|
||||
int daysinmonth(int y, int m);
|
||||
int isleap(int y);
|
||||
void tmoonsub_(double *day, double *glat, double *glong, double *moonalt,
|
||||
double *mrv, double *l, double *b, double *paxis);
|
||||
|
||||
static const char
|
||||
usage[] = " Usage: tmoon date[yyyymm] timz[+/-h.hh] long[+/-dddmm] lat[+/-ddmm]\n"
|
||||
"example: tmoon 200009 0 -00155 5230\n";
|
||||
|
||||
/*
|
||||
getargs() gets the arguments from the command line, does some basic error
|
||||
checking, and converts arguments into numerical form. Arguments are passed
|
||||
back in pointers. Error messages print to stderr so re-direction of output
|
||||
to file won't leave users blind. Error checking prints list of all errors
|
||||
in a command line before quitting.
|
||||
*/
|
||||
void getargs(int argc, char *argv[], int *y, int *m, double *tz,
|
||||
double *glong, double *glat) {
|
||||
|
||||
int date, latitude, longitude;
|
||||
int mflag = 0, yflag = 0, longflag = 0, latflag = 0, tzflag = 0;
|
||||
int longminflag = 0, latminflag = 0, dflag = 0;
|
||||
|
||||
/* if not right number of arguments, then print example command line */
|
||||
|
||||
if (argc !=5) {
|
||||
fprintf(stderr, usage);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
date = atoi(argv[1]);
|
||||
*y = date / 100;
|
||||
*m = date - *y * 100;
|
||||
*tz = (double) atof(argv[2]);
|
||||
longitude = atoi(argv[3]);
|
||||
latitude = atoi(argv[4]);
|
||||
*glong = RADS * getcoord(longitude);
|
||||
*glat = RADS * getcoord(latitude);
|
||||
|
||||
/* set a flag for each error found */
|
||||
|
||||
if (*m > 12 || *m < 1) mflag = 1;
|
||||
if (*y > 2500) yflag = 1;
|
||||
if (date < 150001) dflag = 1;
|
||||
if (fabs((float) *glong) > 180 * RADS) longflag = 1;
|
||||
if (abs(longitude) % 100 > 59) longminflag = 1;
|
||||
if (fabs((float) *glat) > 90 * RADS) latflag = 1;
|
||||
if (abs(latitude) % 100 > 59) latminflag = 1;
|
||||
if (fabs((float) *tz) > 12) tzflag = 1;
|
||||
|
||||
/* print all the errors found */
|
||||
|
||||
if (dflag == 1) {
|
||||
fprintf(stderr, "date: dates must be in form yyyymm, gregorian, and later than 1500 AD\n");
|
||||
}
|
||||
if (yflag == 1) {
|
||||
fprintf(stderr, "date: too far in future - accurate from 1500 to 2500\n");
|
||||
}
|
||||
if (mflag == 1) {
|
||||
fprintf(stderr, "date: month must be in range 0 to 12, eg - August 2000 is entered as 200008\n");
|
||||
}
|
||||
if (tzflag == 1) {
|
||||
fprintf(stderr, "timz: must be in range +/- 12 hours, eg -6 for Chicago\n");
|
||||
}
|
||||
if (longflag == 1) {
|
||||
fprintf(stderr, "long: must be in range +/- 180 degrees\n");
|
||||
}
|
||||
if (longminflag == 1) {
|
||||
fprintf(stderr, "long: last two digits are arcmin - max 59\n");
|
||||
}
|
||||
if (latflag == 1) {
|
||||
fprintf(stderr, " lat: must be in range +/- 90 degrees\n");
|
||||
}
|
||||
if (latminflag == 1) {
|
||||
fprintf(stderr, " lat: last two digits are arcmin - max 59\n");
|
||||
}
|
||||
|
||||
/* quits if one or more flags set */
|
||||
|
||||
if (dflag + mflag + yflag + longflag + latflag + tzflag + longminflag + latminflag > 0) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
returns coordinates in decimal degrees given the
|
||||
coord as a ddmm value stored in an integer.
|
||||
*/
|
||||
double getcoord(int coord) {
|
||||
int west = 1;
|
||||
double glg, deg;
|
||||
if (coord < 0) west = -1;
|
||||
glg = fabs((double) coord/100);
|
||||
deg = floor(glg);
|
||||
glg = west* (deg + (glg - deg)*100 / 60);
|
||||
return(glg);
|
||||
}
|
||||
|
||||
/*
|
||||
days() takes the year, month, day in the month and decimal hours
|
||||
in the day and returns the number of days since J2000.0.
|
||||
Assumes Gregorian calendar.
|
||||
*/
|
||||
double days(int y, int m, int d, double h) {
|
||||
int a, b;
|
||||
double day;
|
||||
|
||||
/*
|
||||
The lines below work from 1900 march to feb 2100
|
||||
a = 367 * y - 7 * (y + (m + 9) / 12) / 4 + 275 * m / 9 + d;
|
||||
day = (double)a - 730531.5 + hour / 24;
|
||||
*/
|
||||
|
||||
/* These lines work for any Gregorian date since 0 AD */
|
||||
if (m ==1 || m==2) {
|
||||
m +=12;
|
||||
y -= 1;
|
||||
}
|
||||
a = y / 100;
|
||||
b = 2 - a + a/4;
|
||||
day = floor(365.25*(y + 4716)) + floor(30.6001*(m + 1))
|
||||
+ d + b - 1524.5 - 2451545 + h/24;
|
||||
return(day);
|
||||
}
|
||||
double days_(int *y0, int *m0, int *d0, double *h0)
|
||||
{
|
||||
return days(*y0,*m0,*d0,*h0);
|
||||
}
|
||||
|
||||
/*
|
||||
Returns 1 if y a leap year, and 0 otherwise, according
|
||||
to the Gregorian calendar
|
||||
*/
|
||||
int isleap(int y) {
|
||||
int a = 0;
|
||||
if(y % 4 == 0) a = 1;
|
||||
if(y % 100 == 0) a = 0;
|
||||
if(y % 400 == 0) a = 1;
|
||||
return(a);
|
||||
}
|
||||
|
||||
/*
|
||||
Given the year and the month, function returns the
|
||||
number of days in the month. Valid for Gregorian
|
||||
calendar.
|
||||
*/
|
||||
int daysinmonth(int y, int m) {
|
||||
int b = 31;
|
||||
if(m == 2) {
|
||||
if(isleap(y) == 1) b= 29;
|
||||
else b = 28;
|
||||
}
|
||||
if(m == 4 || m == 6 || m == 9 || m == 11) b = 30;
|
||||
return(b);
|
||||
}
|
||||
|
||||
/*
|
||||
moonpos() takes days from J2000.0 and returns ecliptic coordinates
|
||||
of moon in the pointers. Note call by reference.
|
||||
This function is within a couple of arcminutes most of the time,
|
||||
and is truncated from the Meeus Ch45 series, themselves truncations of
|
||||
ELP-2000. Returns moon distance in earth radii.
|
||||
Terms have been written out explicitly rather than using the
|
||||
table based method as only a small number of terms is
|
||||
retained.
|
||||
*/
|
||||
void moonpos(double d, double *lambda, double *beta, double *rvec) {
|
||||
double dl, dB, dR, L, D, M, M1, F, e, lm, bm, rm, t;
|
||||
|
||||
t = d / 36525;
|
||||
|
||||
L = range(218.3164591 + 481267.88134236 * t) * RADS;
|
||||
D = range(297.8502042 + 445267.1115168 * t) * RADS;
|
||||
M = range(357.5291092 + 35999.0502909 * t) * RADS;
|
||||
M1 = range(134.9634114 + 477198.8676313 * t - .008997 * t * t) * RADS;
|
||||
F = range(93.27209929999999 + 483202.0175273 * t - .0034029*t*t)*RADS;
|
||||
e = 1 - .002516 * t;
|
||||
|
||||
dl = 6288774 * sin(M1);
|
||||
dl += 1274027 * sin(2 * D - M1);
|
||||
dl += 658314 * sin(2 * D);
|
||||
dl += 213618 * sin(2 * M1);
|
||||
dl -= e * 185116 * sin(M);
|
||||
dl -= 114332 * sin(2 * F) ;
|
||||
dl += 58793 * sin(2 * D - 2 * M1);
|
||||
dl += e * 57066 * sin(2 * D - M - M1) ;
|
||||
dl += 53322 * sin(2 * D + M1);
|
||||
dl += e * 45758 * sin(2 * D - M);
|
||||
dl -= e * 40923 * sin(M - M1);
|
||||
dl -= 34720 * sin(D) ;
|
||||
dl -= e * 30383 * sin(M + M1) ;
|
||||
dl += 15327 * sin(2 * D - 2 * F) ;
|
||||
dl -= 12528 * sin(M1 + 2 * F);
|
||||
dl += 10980 * sin(M1 - 2 * F);
|
||||
lm = rangerad(L + dl / 1000000 * RADS);
|
||||
|
||||
dB = 5128122 * sin(F);
|
||||
dB += 280602 * sin(M1 + F);
|
||||
dB += 277693 * sin(M1 - F);
|
||||
dB += 173237 * sin(2 * D - F);
|
||||
dB += 55413 * sin(2 * D - M1 + F);
|
||||
dB += 46271 * sin(2 * D - M1 - F);
|
||||
dB += 32573 * sin(2 * D + F);
|
||||
dB += 17198 * sin(2 * M1 + F);
|
||||
dB += 9266 * sin(2 * D + M1 - F);
|
||||
dB += 8822 * sin(2 * M1 - F);
|
||||
dB += e * 8216 * sin(2 * D - M - F);
|
||||
dB += 4324 * sin(2 * D - 2 * M1 - F);
|
||||
bm = dB / 1000000 * RADS;
|
||||
|
||||
dR = -20905355 * cos(M1);
|
||||
dR -= 3699111 * cos(2 * D - M1);
|
||||
dR -= 2955968 * cos(2 * D);
|
||||
dR -= 569925 * cos(2 * M1);
|
||||
dR += e * 48888 * cos(M);
|
||||
dR -= 3149 * cos(2 * F);
|
||||
dR += 246158 * cos(2 * D - 2 * M1);
|
||||
dR -= e * 152138 * cos(2 * D - M - M1) ;
|
||||
dR -= 170733 * cos(2 * D + M1);
|
||||
dR -= e * 204586 * cos(2 * D - M);
|
||||
dR -= e * 129620 * cos(M - M1);
|
||||
dR += 108743 * cos(D);
|
||||
dR += e * 104755 * cos(M + M1);
|
||||
dR += 79661 * cos(M1 - 2 * F);
|
||||
rm = 385000.56 + dR / 1000;
|
||||
|
||||
*lambda = lm;
|
||||
*beta = bm;
|
||||
/* distance to Moon must be in Earth radii */
|
||||
*rvec = rm / 6378.14;
|
||||
}
|
||||
|
||||
/*
|
||||
topomoon() takes the local siderial time, the geographical
|
||||
latitude of the observer, and pointers to the geocentric
|
||||
equatorial coordinates. The function overwrites the geocentric
|
||||
coordinates with topocentric coordinates on a simple spherical
|
||||
earth model (no polar flattening). Expects Moon-Earth distance in
|
||||
Earth radii. Formulas scavenged from Astronomical Almanac 'low
|
||||
precision formulae for Moon position' page D46.
|
||||
*/
|
||||
|
||||
void topo(double lst, double glat, double *alp, double *dec, double *r) {
|
||||
double x, y, z, r1;
|
||||
x = *r * cos(*dec) * cos(*alp) - cos(glat) * cos(lst);
|
||||
y = *r * cos(*dec) * sin(*alp) - cos(glat) * sin(lst);
|
||||
z = *r * sin(*dec) - sin(glat);
|
||||
r1 = sqrt(x*x + y*y + z*z);
|
||||
*alp = atan22(y, x);
|
||||
*dec = asin(z / r1);
|
||||
*r = r1;
|
||||
}
|
||||
|
||||
/*
|
||||
moontransit() takes date, the time zone and geographic longitude
|
||||
of observer and returns the time (decimal hours) of lunar transit
|
||||
on that day if there is one, and sets the notransit flag if there
|
||||
isn't. See Explanatory Supplement to Astronomical Almanac
|
||||
section 9.32 and 9.31 for the method.
|
||||
*/
|
||||
|
||||
double moontransit(int y, int m, int d, double tz, double glat, double glong, int *notransit) {
|
||||
double hm, ht, ht1, lon, lat, rv, dnew, lst;
|
||||
int itcount;
|
||||
|
||||
ht1 = 180 * RADS;
|
||||
ht = 0;
|
||||
itcount = 0;
|
||||
*notransit = 0;
|
||||
do {
|
||||
ht = ht1;
|
||||
itcount++;
|
||||
dnew = days(y, m, d, ht * DEGS/15) - tz/24;
|
||||
lst = gst(dnew) + glong;
|
||||
/* find the topocentric Moon ra (hence hour angle) and dec */
|
||||
moonpos(dnew, &lon, &lat, &rv);
|
||||
equatorial(dnew, &lon, &lat, &rv);
|
||||
topo(lst, glat, &lon, &lat, &rv);
|
||||
hm = rangerad(lst - lon);
|
||||
ht1 = rangerad(ht - hm);
|
||||
/* if no convergence, then no transit on that day */
|
||||
if (itcount > 30) {
|
||||
*notransit = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (fabs(ht - ht1) > 0.04 * RADS);
|
||||
return(ht1);
|
||||
}
|
||||
|
||||
/*
|
||||
Calculates the selenographic coordinates of either the sub Earth point
|
||||
(optical libration) or the sub-solar point (selen. coords of centre of
|
||||
bright hemisphere). Based on Meeus chapter 51 but neglects physical
|
||||
libration and nutation, with some simplification of the formulas.
|
||||
*/
|
||||
void libration(double day, double lambda, double beta, double alpha, double *l, double *b, double *p) {
|
||||
double i, f, omega, w, y, x, a, t, eps;
|
||||
t = day / 36525;
|
||||
i = 1.54242 * RADS;
|
||||
eps = epsilon(day);
|
||||
f = range(93.2720993 + 483202.0175273 * t - .0034029 * t * t) * RADS;
|
||||
omega = range(125.044555 - 1934.1361849 * t + .0020762 * t * t) * RADS;
|
||||
w = lambda - omega;
|
||||
y = sin(w) * cos(beta) * cos(i) - sin(beta) * sin(i);
|
||||
x = cos(w) * cos(beta);
|
||||
a = atan22(y, x);
|
||||
*l = a - f;
|
||||
|
||||
/* kludge to catch cases of 'round the back' angles */
|
||||
if (*l < -90 * RADS) *l += TPI;
|
||||
if (*l > 90 * RADS) *l -= TPI;
|
||||
*b = asin(-sin(w) * cos(beta) * sin(i) - sin(beta) * cos(i));
|
||||
|
||||
/* pa pole axis - not used for Sun stuff */
|
||||
x = sin(i) * sin(omega);
|
||||
y = sin(i) * cos(omega) * cos(eps) - cos(i) * sin(eps);
|
||||
w = atan22(x, y);
|
||||
*p = rangerad(asin(sqrt(x*x + y*y) * cos(alpha - w) / cos(*b)));
|
||||
}
|
||||
|
||||
/*
|
||||
Takes: days since J2000.0, eq coords Moon, ratio of moon to sun distance,
|
||||
eq coords Sun
|
||||
Returns: position angle of bright limb wrt NCP, percentage illumination
|
||||
of Sun
|
||||
*/
|
||||
void illumination(double day , double lra, double ldec, double dr, double sra, double sdec, double *pabl, double *ill) {
|
||||
double x, y, phi, i;
|
||||
(void)day;
|
||||
y = cos(sdec) * sin(sra - lra);
|
||||
x = sin(sdec) * cos(ldec) - cos(sdec) * sin(ldec) * cos (sra - lra);
|
||||
*pabl = atan22(y, x);
|
||||
phi = acos(sin(sdec) * sin(ldec) + cos(sdec) * cos(ldec) * cos(sra-lra));
|
||||
i = atan22(sin(phi) , (dr - cos(phi)));
|
||||
*ill = 0.5*(1 + cos(i));
|
||||
}
|
||||
|
||||
/*
|
||||
sunpos() takes days from J2000.0 and returns ecliptic longitude
|
||||
of Sun in the pointers. Latitude is zero at this level of precision,
|
||||
but pointer left in for consistency in number of arguments.
|
||||
This function is within 0.01 degree (1 arcmin) almost all the time
|
||||
for a century either side of J2000.0. This is from the 'low precision
|
||||
fomulas for the Sun' from C24 of Astronomical Alamanac
|
||||
*/
|
||||
void sunpos(double d, double *lambda, double *beta, double *rvec) {
|
||||
double L, g, ls, bs, rs;
|
||||
|
||||
L = range(280.461 + .9856474 * d) * RADS;
|
||||
g = range(357.528 + .9856003 * d) * RADS;
|
||||
ls = L + (1.915 * sin(g) + .02 * sin(2 * g)) * RADS;
|
||||
bs = 0;
|
||||
rs = 1.00014 - .01671 * cos(g) - .00014 * cos(2 * g);
|
||||
*lambda = ls;
|
||||
*beta = bs;
|
||||
*rvec = rs;
|
||||
}
|
||||
|
||||
/*
|
||||
this routine returns the altitude given the days since J2000.0
|
||||
the hour angle and declination of the object and the latitude
|
||||
of the observer. Used to find the Sun's altitude to put a letter
|
||||
code on the transit time, and to find the Moon's altitude at
|
||||
transit just to make sure that the Moon is visible.
|
||||
*/
|
||||
double alt(double glat, double ha, double dec) {
|
||||
return(asin(sin(dec) * sin(glat) + cos(dec) * cos(glat) * cos(ha)));
|
||||
}
|
||||
|
||||
/* returns an angle in degrees in the range 0 to 360 */
|
||||
double range(double x) {
|
||||
double a, b;
|
||||
b = x / 360;
|
||||
a = 360 * (b - floor(b));
|
||||
if (a < 0)
|
||||
a = 360 + a;
|
||||
return(a);
|
||||
}
|
||||
|
||||
/* returns an angle in rads in the range 0 to two pi */
|
||||
double rangerad(double x) {
|
||||
double a, b;
|
||||
b = x / TPI;
|
||||
a = TPI * (b - floor(b));
|
||||
if (a < 0)
|
||||
a = TPI + a;
|
||||
return(a);
|
||||
}
|
||||
|
||||
/*
|
||||
gets the atan2 function returning angles in the right
|
||||
order and range
|
||||
*/
|
||||
double atan22(double y, double x) {
|
||||
double a;
|
||||
|
||||
a = atan2(y, x);
|
||||
if (a < 0) a += TPI;
|
||||
return(a);
|
||||
}
|
||||
|
||||
/*
|
||||
returns mean obliquity of ecliptic in radians given days since
|
||||
J2000.0.
|
||||
*/
|
||||
double epsilon(double d) {
|
||||
double t = d/ 36525;
|
||||
return((23.4392911111111 - (t* (46.8150 + 0.00059*t)/3600)) *RADS);
|
||||
}
|
||||
|
||||
/*
|
||||
replaces ecliptic coordinates with equatorial coordinates
|
||||
note: call by reference destroys original values
|
||||
R is unchanged.
|
||||
*/
|
||||
void equatorial(double d, double *lon, double *lat, double * r) {
|
||||
double eps, ceps, seps, l, b;
|
||||
(void)r;
|
||||
|
||||
l = *lon;
|
||||
b = * lat;
|
||||
eps = epsilon(d);
|
||||
ceps = cos(eps);
|
||||
seps = sin(eps);
|
||||
*lon = atan22(sin(l)*ceps - tan(b)*seps, cos(l));
|
||||
*lat = asin(sin(b)*ceps + cos(b)*seps*sin(l));
|
||||
}
|
||||
|
||||
/*
|
||||
replaces equatorial coordinates with ecliptic ones. Inverse
|
||||
of above, but used to find topocentric ecliptic coords.
|
||||
*/
|
||||
void ecliptic(double d, double *lon, double *lat, double * r) {
|
||||
double eps, ceps, seps, alp, dec;
|
||||
(void)r;
|
||||
|
||||
alp = *lon;
|
||||
dec = *lat;
|
||||
eps = epsilon(d);
|
||||
ceps = cos(eps);
|
||||
seps = sin(eps);
|
||||
*lon = atan22(sin(alp)*ceps + tan(dec)*seps, cos(alp));
|
||||
*lat = asin(sin(dec)*ceps - cos(dec)*seps*sin(alp));
|
||||
}
|
||||
|
||||
/*
|
||||
returns the siderial time at greenwich meridian as
|
||||
an angle in radians given the days since J2000.0
|
||||
*/
|
||||
double gst( double d) {
|
||||
double t = d / 36525;
|
||||
double theta;
|
||||
theta = range(280.46061837 + 360.98564736629 * d + 0.000387933 * t * t);
|
||||
return(theta * RADS);
|
||||
}
|
||||
|
||||
void tmoonsub_(double *day, double *glat, double *glong, double *moonalt,
|
||||
double *mrv, double *l, double *b, double *paxis)
|
||||
{
|
||||
double mlambda, mbeta;
|
||||
double malpha, mdelta;
|
||||
double lst, mhr;
|
||||
double tlambda, tbeta, trv;
|
||||
|
||||
lst = gst(*day) + *glong;
|
||||
|
||||
/* find Moon topocentric coordinates for libration calculations */
|
||||
|
||||
moonpos(*day, &mlambda, &mbeta, mrv);
|
||||
malpha = mlambda;
|
||||
mdelta = mbeta;
|
||||
equatorial(*day, &malpha, &mdelta, mrv);
|
||||
topo(lst, *glat, &malpha, &mdelta, mrv);
|
||||
mhr = rangerad(lst - malpha);
|
||||
*moonalt = alt(*glat, mhr, mdelta);
|
||||
|
||||
/* Optical libration and Position angle of the Pole */
|
||||
|
||||
tlambda = malpha;
|
||||
tbeta = mdelta;
|
||||
trv = *mrv;
|
||||
ecliptic(*day, &tlambda, &tbeta, &trv);
|
||||
libration(*day, tlambda, tbeta, malpha, l, b, paxis);
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 1999-2003 Jaakko Jarvi
|
||||
Copyright (c) 1999-2003 Jeremiah Willcock
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_OUT_05052005_0121)
|
||||
#define FUSION_OUT_05052005_0121
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <ostream>
|
||||
#include <boost/fusion/sequence/io/detail/manip.hpp>
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||
#include <boost/fusion/iterator/deref.hpp>
|
||||
#include <boost/fusion/iterator/next.hpp>
|
||||
#include <boost/fusion/iterator/equal_to.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
template <typename Tag>
|
||||
struct delimiter_out
|
||||
{
|
||||
// print a delimiter
|
||||
template <typename OS>
|
||||
static void
|
||||
print(OS& os, char const* delim, mpl::false_ = mpl::false_())
|
||||
{
|
||||
detail::string_ios_manip<Tag, OS> manip(os);
|
||||
manip.print(delim);
|
||||
}
|
||||
|
||||
template <typename OS>
|
||||
static void
|
||||
print(OS&, char const*, mpl::true_)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct print_sequence_loop
|
||||
{
|
||||
template <typename OS, typename First, typename Last>
|
||||
static void
|
||||
call(OS&, First const&, Last const&, mpl::true_)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename OS, typename First, typename Last>
|
||||
static void
|
||||
call(OS& os, First const& first, Last const& last, mpl::false_)
|
||||
{
|
||||
result_of::equal_to<
|
||||
typename result_of::next<First>::type
|
||||
, Last
|
||||
>
|
||||
is_last;
|
||||
|
||||
os << *first;
|
||||
delimiter_out<tuple_delimiter_tag>::print(os, " ", is_last);
|
||||
call(os, fusion::next(first), last, is_last);
|
||||
}
|
||||
|
||||
template <typename OS, typename First, typename Last>
|
||||
static void
|
||||
call(OS& os, First const& first, Last const& last)
|
||||
{
|
||||
result_of::equal_to<First, Last> eq;
|
||||
call(os, first, last, eq);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename OS, typename Sequence>
|
||||
inline void
|
||||
print_sequence(OS& os, Sequence const& seq)
|
||||
{
|
||||
delimiter_out<tuple_open_tag>::print(os, "(");
|
||||
print_sequence_loop::call(os, fusion::begin(seq), fusion::end(seq));
|
||||
delimiter_out<tuple_close_tag>::print(os, ")");
|
||||
}
|
||||
}}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,102 @@
|
||||
|
||||
// Copyright 2000 John Maddock (john@johnmaddock.co.uk)
|
||||
// Copyright 2002 Aleksey Gurtovoy (agurtovoy@meta-comm.com)
|
||||
//
|
||||
// Use, modification and distribution are subject to 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).
|
||||
//
|
||||
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
|
||||
|
||||
#ifndef BOOST_TT_IS_FUNCTION_HPP_INCLUDED
|
||||
#define BOOST_TT_IS_FUNCTION_HPP_INCLUDED
|
||||
|
||||
#include <boost/type_traits/is_reference.hpp>
|
||||
#include <boost/type_traits/detail/config.hpp>
|
||||
|
||||
#if !defined(BOOST_TT_TEST_MS_FUNC_SIGS)
|
||||
# include <boost/type_traits/detail/is_function_ptr_helper.hpp>
|
||||
#else
|
||||
# include <boost/type_traits/detail/is_function_ptr_tester.hpp>
|
||||
# include <boost/type_traits/detail/yes_no_type.hpp>
|
||||
#endif
|
||||
|
||||
// is a type a function?
|
||||
// Please note that this implementation is unnecessarily complex:
|
||||
// we could just use !is_convertible<T*, const volatile void*>::value,
|
||||
// except that some compilers erroneously allow conversions from
|
||||
// function pointers to void*.
|
||||
|
||||
namespace boost {
|
||||
|
||||
#if !defined( __CODEGEARC__ )
|
||||
|
||||
namespace detail {
|
||||
|
||||
#if !defined(BOOST_TT_TEST_MS_FUNC_SIGS)
|
||||
template<bool is_ref = true>
|
||||
struct is_function_chooser
|
||||
{
|
||||
template< typename T > struct result_
|
||||
: public false_type {};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct is_function_chooser<false>
|
||||
{
|
||||
template< typename T > struct result_
|
||||
: public ::boost::type_traits::is_function_ptr_helper<T*> {};
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct is_function_impl
|
||||
: public is_function_chooser< ::boost::is_reference<T>::value >
|
||||
::BOOST_NESTED_TEMPLATE result_<T>
|
||||
{
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
template <typename T>
|
||||
struct is_function_impl
|
||||
{
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:6334)
|
||||
#endif
|
||||
static T* t;
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, value = sizeof(::boost::type_traits::is_function_ptr_tester(t))
|
||||
== sizeof(::boost::type_traits::yes_type)
|
||||
);
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct is_function_impl<T&> : public false_type
|
||||
{};
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
template <typename T>
|
||||
struct is_function_impl<T&&> : public false_type
|
||||
{};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
#endif // !defined( __CODEGEARC__ )
|
||||
|
||||
#if defined( __CODEGEARC__ )
|
||||
template <class T> struct is_function : integral_constant<bool, __is_function(T)> {};
|
||||
#else
|
||||
template <class T> struct is_function : integral_constant<bool, ::boost::detail::is_function_impl<T>::value> {};
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
template <class T> struct is_function<T&&> : public false_type {};
|
||||
#endif
|
||||
#endif
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_TT_IS_FUNCTION_HPP_INCLUDED
|
||||
@@ -0,0 +1,498 @@
|
||||
// Copyright Kevlin Henney, 2000-2005.
|
||||
// Copyright Alexander Nasonov, 2006-2010.
|
||||
// Copyright Antony Polukhin, 2011-2014.
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
// what: lexical_cast custom keyword cast
|
||||
// who: contributed by Kevlin Henney,
|
||||
// enhanced with contributions from Terje Slettebo,
|
||||
// with additional fixes and suggestions from Gennaro Prota,
|
||||
// Beman Dawes, Dave Abrahams, Daryle Walker, Peter Dimov,
|
||||
// Alexander Nasonov, Antony Polukhin, Justin Viiret, Michael Hofmann,
|
||||
// Cheng Yang, Matthew Bradbury, David W. Birdsall, Pavel Korzh and other Boosters
|
||||
// when: November 2000, March 2003, June 2005, June 2006, March 2011 - 2014
|
||||
|
||||
#ifndef BOOST_LEXICAL_CAST_DETAIL_CONVERTER_LEXICAL_HPP
|
||||
#define BOOST_LEXICAL_CAST_DETAIL_CONVERTER_LEXICAL_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_WSTRING)
|
||||
#define BOOST_LCAST_NO_WCHAR_T
|
||||
#endif
|
||||
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
#include <boost/type_traits/is_float.hpp>
|
||||
#include <boost/type_traits/has_left_shift.hpp>
|
||||
#include <boost/type_traits/has_right_shift.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/detail/lcast_precision.hpp>
|
||||
|
||||
#include <boost/lexical_cast/detail/widest_char.hpp>
|
||||
#include <boost/lexical_cast/detail/is_character.hpp>
|
||||
|
||||
#ifndef BOOST_NO_CXX11_HDR_ARRAY
|
||||
#include <array>
|
||||
#endif
|
||||
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
#include <boost/container/container_fwd.hpp>
|
||||
|
||||
#include <boost/lexical_cast/detail/converter_lexical_streams.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace detail // normalize_single_byte_char<Char>
|
||||
{
|
||||
// Converts signed/unsigned char to char
|
||||
template < class Char >
|
||||
struct normalize_single_byte_char
|
||||
{
|
||||
typedef Char type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct normalize_single_byte_char< signed char >
|
||||
{
|
||||
typedef char type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct normalize_single_byte_char< unsigned char >
|
||||
{
|
||||
typedef char type;
|
||||
};
|
||||
}
|
||||
|
||||
namespace detail // deduce_character_type_later<T>
|
||||
{
|
||||
// Helper type, meaning that stram character for T must be deduced
|
||||
// at Stage 2 (See deduce_source_char<T> and deduce_target_char<T>)
|
||||
template < class T > struct deduce_character_type_later {};
|
||||
}
|
||||
|
||||
namespace detail // stream_char_common<T>
|
||||
{
|
||||
// Selectors to choose stream character type (common for Source and Target)
|
||||
// Returns one of char, wchar_t, char16_t, char32_t or deduce_character_type_later<T> types
|
||||
// Executed on Stage 1 (See deduce_source_char<T> and deduce_target_char<T>)
|
||||
template < typename Type >
|
||||
struct stream_char_common: public boost::mpl::if_c<
|
||||
boost::detail::is_character< Type >::value,
|
||||
Type,
|
||||
boost::detail::deduce_character_type_later< Type >
|
||||
> {};
|
||||
|
||||
template < typename Char >
|
||||
struct stream_char_common< Char* >: public boost::mpl::if_c<
|
||||
boost::detail::is_character< Char >::value,
|
||||
Char,
|
||||
boost::detail::deduce_character_type_later< Char* >
|
||||
> {};
|
||||
|
||||
template < typename Char >
|
||||
struct stream_char_common< const Char* >: public boost::mpl::if_c<
|
||||
boost::detail::is_character< Char >::value,
|
||||
Char,
|
||||
boost::detail::deduce_character_type_later< const Char* >
|
||||
> {};
|
||||
|
||||
template < typename Char >
|
||||
struct stream_char_common< boost::iterator_range< Char* > >: public boost::mpl::if_c<
|
||||
boost::detail::is_character< Char >::value,
|
||||
Char,
|
||||
boost::detail::deduce_character_type_later< boost::iterator_range< Char* > >
|
||||
> {};
|
||||
|
||||
template < typename Char >
|
||||
struct stream_char_common< boost::iterator_range< const Char* > >: public boost::mpl::if_c<
|
||||
boost::detail::is_character< Char >::value,
|
||||
Char,
|
||||
boost::detail::deduce_character_type_later< boost::iterator_range< const Char* > >
|
||||
> {};
|
||||
|
||||
template < class Char, class Traits, class Alloc >
|
||||
struct stream_char_common< std::basic_string< Char, Traits, Alloc > >
|
||||
{
|
||||
typedef Char type;
|
||||
};
|
||||
|
||||
template < class Char, class Traits, class Alloc >
|
||||
struct stream_char_common< boost::container::basic_string< Char, Traits, Alloc > >
|
||||
{
|
||||
typedef Char type;
|
||||
};
|
||||
|
||||
template < typename Char, std::size_t N >
|
||||
struct stream_char_common< boost::array< Char, N > >: public boost::mpl::if_c<
|
||||
boost::detail::is_character< Char >::value,
|
||||
Char,
|
||||
boost::detail::deduce_character_type_later< boost::array< Char, N > >
|
||||
> {};
|
||||
|
||||
template < typename Char, std::size_t N >
|
||||
struct stream_char_common< boost::array< const Char, N > >: public boost::mpl::if_c<
|
||||
boost::detail::is_character< Char >::value,
|
||||
Char,
|
||||
boost::detail::deduce_character_type_later< boost::array< const Char, N > >
|
||||
> {};
|
||||
|
||||
#ifndef BOOST_NO_CXX11_HDR_ARRAY
|
||||
template < typename Char, std::size_t N >
|
||||
struct stream_char_common< std::array<Char, N > >: public boost::mpl::if_c<
|
||||
boost::detail::is_character< Char >::value,
|
||||
Char,
|
||||
boost::detail::deduce_character_type_later< std::array< Char, N > >
|
||||
> {};
|
||||
|
||||
template < typename Char, std::size_t N >
|
||||
struct stream_char_common< std::array< const Char, N > >: public boost::mpl::if_c<
|
||||
boost::detail::is_character< Char >::value,
|
||||
Char,
|
||||
boost::detail::deduce_character_type_later< std::array< const Char, N > >
|
||||
> {};
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_HAS_INT128
|
||||
template <> struct stream_char_common< boost::int128_type >: public boost::mpl::identity< char > {};
|
||||
template <> struct stream_char_common< boost::uint128_type >: public boost::mpl::identity< char > {};
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_LCAST_NO_WCHAR_T) && defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
||||
template <>
|
||||
struct stream_char_common< wchar_t >
|
||||
{
|
||||
typedef char type;
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace detail // deduce_source_char_impl<T>
|
||||
{
|
||||
// If type T is `deduce_character_type_later` type, then tries to deduce
|
||||
// character type using boost::has_left_shift<T> metafunction.
|
||||
// Otherwise supplied type T is a character type, that must be normalized
|
||||
// using normalize_single_byte_char<Char>.
|
||||
// Executed at Stage 2 (See deduce_source_char<T> and deduce_target_char<T>)
|
||||
template < class Char >
|
||||
struct deduce_source_char_impl
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::detail::normalize_single_byte_char< Char >::type type;
|
||||
};
|
||||
|
||||
template < class T >
|
||||
struct deduce_source_char_impl< deduce_character_type_later< T > >
|
||||
{
|
||||
typedef boost::has_left_shift< std::basic_ostream< char >, T > result_t;
|
||||
|
||||
#if defined(BOOST_LCAST_NO_WCHAR_T)
|
||||
BOOST_STATIC_ASSERT_MSG((result_t::value),
|
||||
"Source type is not std::ostream`able and std::wostream`s are not supported by your STL implementation");
|
||||
typedef char type;
|
||||
#else
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_c<
|
||||
result_t::value, char, wchar_t
|
||||
>::type type;
|
||||
|
||||
BOOST_STATIC_ASSERT_MSG((result_t::value || boost::has_left_shift< std::basic_ostream< type >, T >::value),
|
||||
"Source type is neither std::ostream`able nor std::wostream`able");
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
namespace detail // deduce_target_char_impl<T>
|
||||
{
|
||||
// If type T is `deduce_character_type_later` type, then tries to deduce
|
||||
// character type using boost::has_right_shift<T> metafunction.
|
||||
// Otherwise supplied type T is a character type, that must be normalized
|
||||
// using normalize_single_byte_char<Char>.
|
||||
// Executed at Stage 2 (See deduce_source_char<T> and deduce_target_char<T>)
|
||||
template < class Char >
|
||||
struct deduce_target_char_impl
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME normalize_single_byte_char< Char >::type type;
|
||||
};
|
||||
|
||||
template < class T >
|
||||
struct deduce_target_char_impl< deduce_character_type_later<T> >
|
||||
{
|
||||
typedef boost::has_right_shift<std::basic_istream<char>, T > result_t;
|
||||
|
||||
#if defined(BOOST_LCAST_NO_WCHAR_T)
|
||||
BOOST_STATIC_ASSERT_MSG((result_t::value),
|
||||
"Target type is not std::istream`able and std::wistream`s are not supported by your STL implementation");
|
||||
typedef char type;
|
||||
#else
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_c<
|
||||
result_t::value, char, wchar_t
|
||||
>::type type;
|
||||
|
||||
BOOST_STATIC_ASSERT_MSG((result_t::value || boost::has_right_shift<std::basic_istream<wchar_t>, T >::value),
|
||||
"Target type is neither std::istream`able nor std::wistream`able");
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
namespace detail // deduce_target_char<T> and deduce_source_char<T>
|
||||
{
|
||||
// We deduce stream character types in two stages.
|
||||
//
|
||||
// Stage 1 is common for Target and Source. At Stage 1 we get
|
||||
// non normalized character type (may contain unsigned/signed char)
|
||||
// or deduce_character_type_later<T> where T is the original type.
|
||||
// Stage 1 is executed by stream_char_common<T>
|
||||
//
|
||||
// At Stage 2 we normalize character types or try to deduce character
|
||||
// type using metafunctions.
|
||||
// Stage 2 is executed by deduce_target_char_impl<T> and
|
||||
// deduce_source_char_impl<T>
|
||||
//
|
||||
// deduce_target_char<T> and deduce_source_char<T> functions combine
|
||||
// both stages
|
||||
|
||||
template < class T >
|
||||
struct deduce_target_char
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME stream_char_common< T >::type stage1_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME deduce_target_char_impl< stage1_type >::type stage2_type;
|
||||
|
||||
typedef stage2_type type;
|
||||
};
|
||||
|
||||
template < class T >
|
||||
struct deduce_source_char
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME stream_char_common< T >::type stage1_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME deduce_source_char_impl< stage1_type >::type stage2_type;
|
||||
|
||||
typedef stage2_type type;
|
||||
};
|
||||
}
|
||||
|
||||
namespace detail // extract_char_traits template
|
||||
{
|
||||
// We are attempting to get char_traits<> from T
|
||||
// template parameter. Otherwise we'll be using std::char_traits<Char>
|
||||
template < class Char, class T >
|
||||
struct extract_char_traits
|
||||
: boost::false_type
|
||||
{
|
||||
typedef std::char_traits< Char > trait_t;
|
||||
};
|
||||
|
||||
template < class Char, class Traits, class Alloc >
|
||||
struct extract_char_traits< Char, std::basic_string< Char, Traits, Alloc > >
|
||||
: boost::true_type
|
||||
{
|
||||
typedef Traits trait_t;
|
||||
};
|
||||
|
||||
template < class Char, class Traits, class Alloc>
|
||||
struct extract_char_traits< Char, boost::container::basic_string< Char, Traits, Alloc > >
|
||||
: boost::true_type
|
||||
{
|
||||
typedef Traits trait_t;
|
||||
};
|
||||
}
|
||||
|
||||
namespace detail // array_to_pointer_decay<T>
|
||||
{
|
||||
template<class T>
|
||||
struct array_to_pointer_decay
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<class T, std::size_t N>
|
||||
struct array_to_pointer_decay<T[N]>
|
||||
{
|
||||
typedef const T * type;
|
||||
};
|
||||
}
|
||||
|
||||
namespace detail // lcast_src_length
|
||||
{
|
||||
// Return max. length of string representation of Source;
|
||||
template< class Source, // Source type of lexical_cast.
|
||||
class Enable = void // helper type
|
||||
>
|
||||
struct lcast_src_length
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(std::size_t, value = 1);
|
||||
};
|
||||
|
||||
// Helper for integral types.
|
||||
// Notes on length calculation:
|
||||
// Max length for 32bit int with grouping "\1" and thousands_sep ',':
|
||||
// "-2,1,4,7,4,8,3,6,4,7"
|
||||
// ^ - is_signed
|
||||
// ^ - 1 digit not counted by digits10
|
||||
// ^^^^^^^^^^^^^^^^^^ - digits10 * 2
|
||||
//
|
||||
// Constant is_specialized is used instead of constant 1
|
||||
// to prevent buffer overflow in a rare case when
|
||||
// <boost/limits.hpp> doesn't add missing specialization for
|
||||
// numeric_limits<T> for some integral type T.
|
||||
// When is_specialized is false, the whole expression is 0.
|
||||
template <class Source>
|
||||
struct lcast_src_length<
|
||||
Source, BOOST_DEDUCED_TYPENAME boost::enable_if<boost::is_integral<Source> >::type
|
||||
>
|
||||
{
|
||||
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||
BOOST_STATIC_CONSTANT(std::size_t, value =
|
||||
std::numeric_limits<Source>::is_signed +
|
||||
std::numeric_limits<Source>::is_specialized + /* == 1 */
|
||||
std::numeric_limits<Source>::digits10 * 2
|
||||
);
|
||||
#else
|
||||
BOOST_STATIC_CONSTANT(std::size_t, value = 156);
|
||||
BOOST_STATIC_ASSERT(sizeof(Source) * CHAR_BIT <= 256);
|
||||
#endif
|
||||
};
|
||||
|
||||
// Helper for floating point types.
|
||||
// -1.23456789e-123456
|
||||
// ^ sign
|
||||
// ^ leading digit
|
||||
// ^ decimal point
|
||||
// ^^^^^^^^ lcast_precision<Source>::value
|
||||
// ^ "e"
|
||||
// ^ exponent sign
|
||||
// ^^^^^^ exponent (assumed 6 or less digits)
|
||||
// sign + leading digit + decimal point + "e" + exponent sign == 5
|
||||
template<class Source>
|
||||
struct lcast_src_length<
|
||||
Source, BOOST_DEDUCED_TYPENAME boost::enable_if<boost::is_float<Source> >::type
|
||||
>
|
||||
{
|
||||
|
||||
#ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION
|
||||
BOOST_STATIC_ASSERT(
|
||||
std::numeric_limits<Source>::max_exponent10 <= 999999L &&
|
||||
std::numeric_limits<Source>::min_exponent10 >= -999999L
|
||||
);
|
||||
|
||||
BOOST_STATIC_CONSTANT(std::size_t, value =
|
||||
5 + lcast_precision<Source>::value + 6
|
||||
);
|
||||
#else // #ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION
|
||||
BOOST_STATIC_CONSTANT(std::size_t, value = 156);
|
||||
#endif // #ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION
|
||||
};
|
||||
}
|
||||
|
||||
namespace detail // lexical_cast_stream_traits<Source, Target>
|
||||
{
|
||||
template <class Source, class Target>
|
||||
struct lexical_cast_stream_traits {
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::detail::array_to_pointer_decay<Source>::type src;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::remove_cv<src>::type no_cv_src;
|
||||
|
||||
typedef boost::detail::deduce_source_char<no_cv_src> deduce_src_char_metafunc;
|
||||
typedef BOOST_DEDUCED_TYPENAME deduce_src_char_metafunc::type src_char_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::detail::deduce_target_char<Target>::type target_char_t;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::detail::widest_char<
|
||||
target_char_t, src_char_t
|
||||
>::type char_type;
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_CHAR16_T) && defined(BOOST_NO_CXX11_UNICODE_LITERALS)
|
||||
BOOST_STATIC_ASSERT_MSG(( !boost::is_same<char16_t, src_char_t>::value
|
||||
&& !boost::is_same<char16_t, target_char_t>::value),
|
||||
"Your compiler does not have full support for char16_t" );
|
||||
#endif
|
||||
#if !defined(BOOST_NO_CXX11_CHAR32_T) && defined(BOOST_NO_CXX11_UNICODE_LITERALS)
|
||||
BOOST_STATIC_ASSERT_MSG(( !boost::is_same<char32_t, src_char_t>::value
|
||||
&& !boost::is_same<char32_t, target_char_t>::value),
|
||||
"Your compiler does not have full support for char32_t" );
|
||||
#endif
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_c<
|
||||
boost::detail::extract_char_traits<char_type, Target>::value,
|
||||
BOOST_DEDUCED_TYPENAME boost::detail::extract_char_traits<char_type, Target>,
|
||||
BOOST_DEDUCED_TYPENAME boost::detail::extract_char_traits<char_type, no_cv_src>
|
||||
>::type::trait_t traits;
|
||||
|
||||
typedef boost::mpl::bool_
|
||||
<
|
||||
boost::is_same<char, src_char_t>::value && // source is not a wide character based type
|
||||
(sizeof(char) != sizeof(target_char_t)) && // target type is based on wide character
|
||||
(!(boost::detail::is_character<no_cv_src>::value))
|
||||
> is_string_widening_required_t;
|
||||
|
||||
typedef boost::mpl::bool_
|
||||
<
|
||||
!(boost::is_integral<no_cv_src>::value ||
|
||||
boost::detail::is_character<
|
||||
BOOST_DEDUCED_TYPENAME deduce_src_char_metafunc::stage1_type // if we did not get character type at stage1
|
||||
>::value // then we have no optimization for that type
|
||||
)
|
||||
> is_source_input_not_optimized_t;
|
||||
|
||||
// If we have an optimized conversion for
|
||||
// Source, we do not need to construct stringbuf.
|
||||
BOOST_STATIC_CONSTANT(bool, requires_stringbuf =
|
||||
(is_string_widening_required_t::value || is_source_input_not_optimized_t::value)
|
||||
);
|
||||
|
||||
typedef boost::detail::lcast_src_length<no_cv_src> len_t;
|
||||
};
|
||||
}
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template<typename Target, typename Source>
|
||||
struct lexical_converter_impl
|
||||
{
|
||||
typedef lexical_cast_stream_traits<Source, Target> stream_trait;
|
||||
|
||||
typedef detail::lexical_istream_limited_src<
|
||||
BOOST_DEDUCED_TYPENAME stream_trait::char_type,
|
||||
BOOST_DEDUCED_TYPENAME stream_trait::traits,
|
||||
stream_trait::requires_stringbuf,
|
||||
stream_trait::len_t::value + 1
|
||||
> i_interpreter_type;
|
||||
|
||||
typedef detail::lexical_ostream_limited_src<
|
||||
BOOST_DEDUCED_TYPENAME stream_trait::char_type,
|
||||
BOOST_DEDUCED_TYPENAME stream_trait::traits
|
||||
> o_interpreter_type;
|
||||
|
||||
static inline bool try_convert(const Source& arg, Target& result) {
|
||||
i_interpreter_type i_interpreter;
|
||||
|
||||
// Disabling ADL, by directly specifying operators.
|
||||
if (!(i_interpreter.operator <<(arg)))
|
||||
return false;
|
||||
|
||||
o_interpreter_type out(i_interpreter.cbegin(), i_interpreter.cend());
|
||||
|
||||
// Disabling ADL, by directly specifying operators.
|
||||
if(!(out.operator >>(result)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#undef BOOST_LCAST_NO_WCHAR_T
|
||||
|
||||
#endif // BOOST_LEXICAL_CAST_DETAIL_CONVERTER_LEXICAL_HPP
|
||||
|
||||
@@ -0,0 +1,329 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See http://boostorg.github.com/compute for more information.
|
||||
//---------------------------------------------------------------------------//
|
||||
|
||||
#ifndef BOOST_COMPUTE_LAMBDA_CONTEXT_HPP
|
||||
#define BOOST_COMPUTE_LAMBDA_CONTEXT_HPP
|
||||
|
||||
#include <boost/proto/core.hpp>
|
||||
#include <boost/proto/context.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <boost/preprocessor/repetition.hpp>
|
||||
|
||||
#include <boost/compute/config.hpp>
|
||||
#include <boost/compute/function.hpp>
|
||||
#include <boost/compute/lambda/result_of.hpp>
|
||||
#include <boost/compute/lambda/functional.hpp>
|
||||
#include <boost/compute/type_traits/result_of.hpp>
|
||||
#include <boost/compute/type_traits/type_name.hpp>
|
||||
#include <boost/compute/detail/meta_kernel.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
namespace lambda {
|
||||
|
||||
namespace mpl = boost::mpl;
|
||||
namespace proto = boost::proto;
|
||||
|
||||
#define BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(tag, op) \
|
||||
template<class LHS, class RHS> \
|
||||
void operator()(tag, const LHS &lhs, const RHS &rhs) \
|
||||
{ \
|
||||
if(proto::arity_of<LHS>::value > 0){ \
|
||||
stream << '('; \
|
||||
proto::eval(lhs, *this); \
|
||||
stream << ')'; \
|
||||
} \
|
||||
else { \
|
||||
proto::eval(lhs, *this); \
|
||||
} \
|
||||
\
|
||||
stream << op; \
|
||||
\
|
||||
if(proto::arity_of<RHS>::value > 0){ \
|
||||
stream << '('; \
|
||||
proto::eval(rhs, *this); \
|
||||
stream << ')'; \
|
||||
} \
|
||||
else { \
|
||||
proto::eval(rhs, *this); \
|
||||
} \
|
||||
}
|
||||
|
||||
// lambda expression context
|
||||
template<class Args>
|
||||
struct context : proto::callable_context<context<Args> >
|
||||
{
|
||||
typedef void result_type;
|
||||
typedef Args args_tuple;
|
||||
|
||||
// create a lambda context for kernel with args
|
||||
context(boost::compute::detail::meta_kernel &kernel, const Args &args_)
|
||||
: stream(kernel),
|
||||
args(args_)
|
||||
{
|
||||
}
|
||||
|
||||
// handle terminals
|
||||
template<class T>
|
||||
void operator()(proto::tag::terminal, const T &x)
|
||||
{
|
||||
// terminal values in lambda expressions are always literals
|
||||
stream << stream.lit(x);
|
||||
}
|
||||
|
||||
// handle placeholders
|
||||
template<int I>
|
||||
void operator()(proto::tag::terminal, placeholder<I>)
|
||||
{
|
||||
stream << boost::get<I>(args);
|
||||
}
|
||||
|
||||
// handle functions
|
||||
#define BOOST_COMPUTE_LAMBDA_CONTEXT_FUNCTION_ARG(z, n, unused) \
|
||||
BOOST_PP_COMMA_IF(n) BOOST_PP_CAT(const Arg, n) BOOST_PP_CAT(&arg, n)
|
||||
|
||||
#define BOOST_COMPUTE_LAMBDA_CONTEXT_FUNCTION(z, n, unused) \
|
||||
template<class F, BOOST_PP_ENUM_PARAMS(n, class Arg)> \
|
||||
void operator()( \
|
||||
proto::tag::function, \
|
||||
const F &function, \
|
||||
BOOST_PP_REPEAT(n, BOOST_COMPUTE_LAMBDA_CONTEXT_FUNCTION_ARG, ~) \
|
||||
) \
|
||||
{ \
|
||||
proto::value(function).apply(*this, BOOST_PP_ENUM_PARAMS(n, arg)); \
|
||||
}
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(1, BOOST_COMPUTE_MAX_ARITY, BOOST_COMPUTE_LAMBDA_CONTEXT_FUNCTION, ~)
|
||||
|
||||
#undef BOOST_COMPUTE_LAMBDA_CONTEXT_FUNCTION
|
||||
|
||||
// operators
|
||||
BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::plus, '+')
|
||||
BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::minus, '-')
|
||||
BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::multiplies, '*')
|
||||
BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::divides, '/')
|
||||
BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::modulus, '%')
|
||||
BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::less, '<')
|
||||
BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::greater, '>')
|
||||
BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::less_equal, "<=")
|
||||
BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::greater_equal, ">=")
|
||||
BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::equal_to, "==")
|
||||
BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::not_equal_to, "!=")
|
||||
BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::logical_and, "&&")
|
||||
BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::logical_or, "||")
|
||||
BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::bitwise_and, '&')
|
||||
BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::bitwise_or, '|')
|
||||
BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::bitwise_xor, '^')
|
||||
BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::assign, '=')
|
||||
|
||||
// subscript operator
|
||||
template<class LHS, class RHS>
|
||||
void operator()(proto::tag::subscript, const LHS &lhs, const RHS &rhs)
|
||||
{
|
||||
proto::eval(lhs, *this);
|
||||
stream << '[';
|
||||
proto::eval(rhs, *this);
|
||||
stream << ']';
|
||||
}
|
||||
|
||||
// ternary conditional operator
|
||||
template<class Pred, class Arg1, class Arg2>
|
||||
void operator()(proto::tag::if_else_, const Pred &p, const Arg1 &x, const Arg2 &y)
|
||||
{
|
||||
proto::eval(p, *this);
|
||||
stream << '?';
|
||||
proto::eval(x, *this);
|
||||
stream << ':';
|
||||
proto::eval(y, *this);
|
||||
}
|
||||
|
||||
boost::compute::detail::meta_kernel &stream;
|
||||
Args args;
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<class Expr, class Arg>
|
||||
struct invoked_unary_expression
|
||||
{
|
||||
typedef typename ::boost::compute::result_of<Expr(Arg)>::type result_type;
|
||||
|
||||
invoked_unary_expression(const Expr &expr, const Arg &arg)
|
||||
: m_expr(expr),
|
||||
m_arg(arg)
|
||||
{
|
||||
}
|
||||
|
||||
Expr m_expr;
|
||||
Arg m_arg;
|
||||
};
|
||||
|
||||
template<class Expr, class Arg>
|
||||
boost::compute::detail::meta_kernel&
|
||||
operator<<(boost::compute::detail::meta_kernel &kernel,
|
||||
const invoked_unary_expression<Expr, Arg> &expr)
|
||||
{
|
||||
context<boost::tuple<Arg> > ctx(kernel, boost::make_tuple(expr.m_arg));
|
||||
proto::eval(expr.m_expr, ctx);
|
||||
|
||||
return kernel;
|
||||
}
|
||||
|
||||
template<class Expr, class Arg1, class Arg2>
|
||||
struct invoked_binary_expression
|
||||
{
|
||||
typedef typename ::boost::compute::result_of<Expr(Arg1, Arg2)>::type result_type;
|
||||
|
||||
invoked_binary_expression(const Expr &expr,
|
||||
const Arg1 &arg1,
|
||||
const Arg2 &arg2)
|
||||
: m_expr(expr),
|
||||
m_arg1(arg1),
|
||||
m_arg2(arg2)
|
||||
{
|
||||
}
|
||||
|
||||
Expr m_expr;
|
||||
Arg1 m_arg1;
|
||||
Arg2 m_arg2;
|
||||
};
|
||||
|
||||
template<class Expr, class Arg1, class Arg2>
|
||||
boost::compute::detail::meta_kernel&
|
||||
operator<<(boost::compute::detail::meta_kernel &kernel,
|
||||
const invoked_binary_expression<Expr, Arg1, Arg2> &expr)
|
||||
{
|
||||
context<boost::tuple<Arg1, Arg2> > ctx(
|
||||
kernel,
|
||||
boost::make_tuple(expr.m_arg1, expr.m_arg2)
|
||||
);
|
||||
proto::eval(expr.m_expr, ctx);
|
||||
|
||||
return kernel;
|
||||
}
|
||||
|
||||
} // end detail namespace
|
||||
|
||||
// forward declare domain
|
||||
struct domain;
|
||||
|
||||
// lambda expression wrapper
|
||||
template<class Expr>
|
||||
struct expression : proto::extends<Expr, expression<Expr>, domain>
|
||||
{
|
||||
typedef proto::extends<Expr, expression<Expr>, domain> base_type;
|
||||
|
||||
BOOST_PROTO_EXTENDS_USING_ASSIGN(expression)
|
||||
|
||||
expression(const Expr &expr = Expr())
|
||||
: base_type(expr)
|
||||
{
|
||||
}
|
||||
|
||||
// result_of protocol
|
||||
template<class Signature>
|
||||
struct result
|
||||
{
|
||||
};
|
||||
|
||||
template<class This>
|
||||
struct result<This()>
|
||||
{
|
||||
typedef
|
||||
typename ::boost::compute::lambda::result_of<Expr>::type type;
|
||||
};
|
||||
|
||||
template<class This, class Arg>
|
||||
struct result<This(Arg)>
|
||||
{
|
||||
typedef
|
||||
typename ::boost::compute::lambda::result_of<
|
||||
Expr,
|
||||
typename boost::tuple<Arg>
|
||||
>::type type;
|
||||
};
|
||||
|
||||
template<class This, class Arg1, class Arg2>
|
||||
struct result<This(Arg1, Arg2)>
|
||||
{
|
||||
typedef typename
|
||||
::boost::compute::lambda::result_of<
|
||||
Expr,
|
||||
typename boost::tuple<Arg1, Arg2>
|
||||
>::type type;
|
||||
};
|
||||
|
||||
template<class Arg>
|
||||
detail::invoked_unary_expression<expression<Expr>, Arg>
|
||||
operator()(const Arg &x) const
|
||||
{
|
||||
return detail::invoked_unary_expression<expression<Expr>, Arg>(*this, x);
|
||||
}
|
||||
|
||||
template<class Arg1, class Arg2>
|
||||
detail::invoked_binary_expression<expression<Expr>, Arg1, Arg2>
|
||||
operator()(const Arg1 &x, const Arg2 &y) const
|
||||
{
|
||||
return detail::invoked_binary_expression<
|
||||
expression<Expr>,
|
||||
Arg1,
|
||||
Arg2
|
||||
>(*this, x, y);
|
||||
}
|
||||
|
||||
// function<> conversion operator
|
||||
template<class R, class A1>
|
||||
operator function<R(A1)>() const
|
||||
{
|
||||
using ::boost::compute::detail::meta_kernel;
|
||||
|
||||
std::stringstream source;
|
||||
|
||||
::boost::compute::detail::meta_kernel_variable<A1> arg1("x");
|
||||
|
||||
source << "inline " << type_name<R>() << " lambda"
|
||||
<< ::boost::compute::detail::generate_argument_list<R(A1)>('x')
|
||||
<< "{\n"
|
||||
<< " return " << meta_kernel::expr_to_string((*this)(arg1)) << ";\n"
|
||||
<< "}\n";
|
||||
|
||||
return make_function_from_source<R(A1)>("lambda", source.str());
|
||||
}
|
||||
|
||||
template<class R, class A1, class A2>
|
||||
operator function<R(A1, A2)>() const
|
||||
{
|
||||
using ::boost::compute::detail::meta_kernel;
|
||||
|
||||
std::stringstream source;
|
||||
|
||||
::boost::compute::detail::meta_kernel_variable<A1> arg1("x");
|
||||
::boost::compute::detail::meta_kernel_variable<A1> arg2("y");
|
||||
|
||||
source << "inline " << type_name<R>() << " lambda"
|
||||
<< ::boost::compute::detail::generate_argument_list<R(A1, A2)>('x')
|
||||
<< "{\n"
|
||||
<< " return " << meta_kernel::expr_to_string((*this)(arg1, arg2)) << ";\n"
|
||||
<< "}\n";
|
||||
|
||||
return make_function_from_source<R(A1, A2)>("lambda", source.str());
|
||||
}
|
||||
};
|
||||
|
||||
// lambda expression domain
|
||||
struct domain : proto::domain<proto::generator<expression> >
|
||||
{
|
||||
};
|
||||
|
||||
} // end lambda namespace
|
||||
} // end compute namespace
|
||||
} // end boost namespace
|
||||
|
||||
#endif // BOOST_COMPUTE_LAMBDA_CONTEXT_HPP
|
||||
@@ -0,0 +1,66 @@
|
||||
program QRA64code
|
||||
|
||||
! Provides examples of message packing, bit and symbol ordering,
|
||||
! QRA (63,12) encoding, and other necessary details of the QRA64
|
||||
! protocol.
|
||||
|
||||
use packjt
|
||||
character*22 msg,msg0,msg1,decoded,cok*3,msgtype*10,arg*12
|
||||
character*6 mycall
|
||||
logical ltext
|
||||
integer dgen(12),sent(63),dec(12)
|
||||
integer icos7(0:6)
|
||||
data icos7/2,5,6,0,4,1,3/ !Defines a 7x7 Costas array
|
||||
|
||||
include 'testmsg.f90'
|
||||
|
||||
nargs=iargc()
|
||||
if(nargs.lt.1) then
|
||||
print*,'Usage: qra64code "message"'
|
||||
print*,' qra64code -t'
|
||||
go to 999
|
||||
endif
|
||||
|
||||
call getarg(1,msg) !Get message from command line
|
||||
nmsg=1
|
||||
if(msg(1:2).eq."-t") nmsg=NTEST
|
||||
|
||||
write(*,1010)
|
||||
1010 format(" Message Decoded Err? Type"/74("-"))
|
||||
|
||||
do imsg=1,nmsg
|
||||
if(nmsg.gt.1) msg=testmsg(imsg)
|
||||
call fmtmsg(msg,iz) !To upper, collapse mult blanks
|
||||
msg0=msg !Input message
|
||||
call chkmsg(msg,cok,nspecial,flip) !See if it includes "OOO" report
|
||||
msg1=msg !Message without "OOO"
|
||||
call packmsg(msg1,dgen,itype,.false.) !Pack message into 12 six-bit bytes
|
||||
msgtype=""
|
||||
if(itype.eq.1) msgtype="Std Msg"
|
||||
if(itype.eq.2) msgtype="Type 1 pfx"
|
||||
if(itype.eq.3) msgtype="Type 1 sfx"
|
||||
if(itype.eq.4) msgtype="Type 2 pfx"
|
||||
if(itype.eq.5) msgtype="Type 2 sfx"
|
||||
if(itype.eq.6) msgtype="Free text"
|
||||
|
||||
call qra64_enc(dgen,sent) !Encode using QRA64
|
||||
|
||||
call unpackmsg(dgen,decoded,.false.,' ') !Unpack the user message
|
||||
call fmtmsg(decoded,iz)
|
||||
ii=imsg
|
||||
write(*,1020) ii,msg0,decoded,itype,msgtype
|
||||
1020 format(i4,1x,a22,2x,a22,4x,i3,": ",a13)
|
||||
enddo
|
||||
|
||||
if(nmsg.eq.1) then
|
||||
write(*,1030) dgen
|
||||
1030 format(/'Packed message, 6-bit symbols ',12i3) !Display packed symbols
|
||||
|
||||
write(*,1040) sent
|
||||
1040 format(/'Information-carrying channel symbols'/(i5,29i3))
|
||||
|
||||
write(*,1050) 10*icos7,sent(1:32),10*icos7,sent(33:63),10*icos7
|
||||
1050 format(/'Channel symbols including sync'/(i5,29i3))
|
||||
endif
|
||||
|
||||
999 end program QRA64code
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef BOOST_WEAK_PTR_HPP_INCLUDED
|
||||
#define BOOST_WEAK_PTR_HPP_INCLUDED
|
||||
|
||||
//
|
||||
// weak_ptr.hpp
|
||||
//
|
||||
// Copyright (c) 2001, 2002, 2003 Peter Dimov
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See http://www.boost.org/libs/smart_ptr/weak_ptr.htm for documentation.
|
||||
//
|
||||
|
||||
#include <boost/smart_ptr/weak_ptr.hpp>
|
||||
|
||||
#endif // #ifndef BOOST_WEAK_PTR_HPP_INCLUDED
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,62 @@
|
||||
subroutine watterson(c,npts,fs,delay,fspread)
|
||||
|
||||
complex c(0:npts-1)
|
||||
complex c2(0:npts-1)
|
||||
complex cs1(0:npts-1)
|
||||
complex cs2(0:npts-1)
|
||||
|
||||
nonzero=0
|
||||
df=fs/npts
|
||||
if(fspread.gt.0.0) then
|
||||
do i=0,npts-1
|
||||
xx=gran()
|
||||
yy=gran()
|
||||
cs1(i)=0.707*cmplx(xx,yy)
|
||||
xx=gran()
|
||||
yy=gran()
|
||||
cs2(i)=0.707*cmplx(xx,yy)
|
||||
enddo
|
||||
call four2a(cs1,npts,1,-1,1) !To freq domain
|
||||
call four2a(cs2,npts,1,-1,1)
|
||||
do i=0,npts-1
|
||||
f=i*df
|
||||
if(i.gt.npts/2) f=(i-npts)*df
|
||||
x=(f/(0.5*fspread))**2
|
||||
a=0.
|
||||
if(x.le.50.0) then
|
||||
a=exp(-x)
|
||||
endif
|
||||
cs1(i)=a*cs1(i)
|
||||
cs2(i)=a*cs2(i)
|
||||
if(abs(f).lt.10.0) then
|
||||
p1=real(cs1(i))**2 + aimag(cs1(i))**2
|
||||
p2=real(cs2(i))**2 + aimag(cs2(i))**2
|
||||
if(p1.gt.0.0) nonzero=nonzero+1
|
||||
! write(62,3101) f,p1,p2,db(p1+1.e-12)-60,db(p2+1.e-12)-60
|
||||
!3101 format(f10.3,2f12.3,2f10.3)
|
||||
endif
|
||||
enddo
|
||||
call four2a(cs1,npts,1,1,1) !Back to time domain
|
||||
call four2a(cs2,npts,1,1,1)
|
||||
cs1(0:npts-1)=cs1(0:npts-1)/npts
|
||||
cs2(0:npts-1)=cs2(0:npts-1)/npts
|
||||
endif
|
||||
|
||||
nshift=nint(0.001*delay*fs)
|
||||
c2(0:npts-1)=cshift(c(0:npts-1),nshift)
|
||||
sq=0.
|
||||
do i=0,npts-1
|
||||
if(nonzero.gt.1) then
|
||||
c(i)=0.5*(cs1(i)*c(i) + cs2(i)*c2(i))
|
||||
else
|
||||
c(i)=0.5*(c(i) + c2(i))
|
||||
endif
|
||||
sq=sq + real(c(i))**2 + aimag(c(i))**2
|
||||
! write(61,3001) i/12000.0,c(i)
|
||||
!3001 format(3f12.6)
|
||||
enddo
|
||||
rms=sqrt(sq/npts)
|
||||
c=c/rms
|
||||
|
||||
return
|
||||
end subroutine watterson
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,189 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2007 Dan Marsden
|
||||
Copyright (c) 2009-2010 Christopher Schmidt
|
||||
|
||||
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)
|
||||
|
||||
This is an auto-generated file. Do not edit!
|
||||
==============================================================================*/
|
||||
# if BOOST_WORKAROUND (BOOST_MSVC, < 1500)
|
||||
# define BOOST_FUSION_FOLD_IMPL_ENABLER(T) void
|
||||
# else
|
||||
# define BOOST_FUSION_FOLD_IMPL_ENABLER(T) typename T::type
|
||||
# endif
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
template<int SeqSize, typename It, typename State, typename F, typename = void
|
||||
# if BOOST_WORKAROUND (BOOST_MSVC, < 1500)
|
||||
|
||||
, bool = SeqSize == 0
|
||||
# endif
|
||||
>
|
||||
struct result_of_it_fold
|
||||
{};
|
||||
template<typename It, typename State, typename F>
|
||||
struct result_of_it_fold<0,It,State,F
|
||||
, typename boost::enable_if_has_type<BOOST_FUSION_FOLD_IMPL_ENABLER(State)>::type
|
||||
# if BOOST_WORKAROUND (BOOST_MSVC, < 1500)
|
||||
, true
|
||||
# endif
|
||||
>
|
||||
{
|
||||
typedef typename State::type type;
|
||||
};
|
||||
template<int SeqSize, typename It, typename State, typename F>
|
||||
struct result_of_it_fold<SeqSize,It,State,F
|
||||
, typename boost::enable_if_has_type<
|
||||
# if BOOST_WORKAROUND (BOOST_MSVC, >= 1500)
|
||||
|
||||
|
||||
|
||||
typename boost::disable_if_c<SeqSize == 0, State>::type::type
|
||||
# else
|
||||
BOOST_FUSION_FOLD_IMPL_ENABLER(State)
|
||||
# endif
|
||||
>::type
|
||||
# if BOOST_WORKAROUND (BOOST_MSVC, < 1500)
|
||||
, false
|
||||
# endif
|
||||
>
|
||||
: result_of_it_fold<
|
||||
SeqSize-1
|
||||
, typename result_of::next<It>::type
|
||||
, boost::result_of<
|
||||
F(
|
||||
typename add_reference<typename State::type>::type,
|
||||
typename fusion::result_of::deref<It const>::type
|
||||
)
|
||||
>
|
||||
, F
|
||||
>
|
||||
{};
|
||||
template<typename It, typename State, typename F>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline typename result_of_it_fold<
|
||||
0
|
||||
, It
|
||||
, State
|
||||
, F
|
||||
>::type
|
||||
it_fold(mpl::int_<0>, It const&, typename State::type state, F&)
|
||||
{
|
||||
return state;
|
||||
}
|
||||
template<typename It, typename State, typename F, int SeqSize>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline typename lazy_enable_if_c<
|
||||
SeqSize != 0
|
||||
, result_of_it_fold<
|
||||
SeqSize
|
||||
, It
|
||||
, State
|
||||
, F
|
||||
>
|
||||
>::type
|
||||
it_fold(mpl::int_<SeqSize>, It const& it, typename State::type state, F& f)
|
||||
{
|
||||
return it_fold<
|
||||
typename result_of::next<It>::type
|
||||
, boost::result_of<
|
||||
F(
|
||||
typename add_reference<typename State::type>::type,
|
||||
typename fusion::result_of::deref<It const>::type
|
||||
)
|
||||
>
|
||||
, F
|
||||
>(
|
||||
mpl::int_<SeqSize-1>()
|
||||
, fusion::next(it)
|
||||
, f(state, fusion::deref(it))
|
||||
, f
|
||||
);
|
||||
}
|
||||
template<typename Seq, typename State, typename F
|
||||
, bool = traits::is_sequence<Seq>::value
|
||||
, bool = traits::is_segmented<Seq>::value>
|
||||
struct result_of_fold
|
||||
{};
|
||||
template<typename Seq, typename State, typename F>
|
||||
struct result_of_fold<Seq, State, F, true, false>
|
||||
: result_of_it_fold<
|
||||
result_of::size<Seq>::value
|
||||
, typename result_of::begin<Seq>::type
|
||||
, add_reference<State>
|
||||
, F
|
||||
>
|
||||
{};
|
||||
template<typename Seq, typename State, typename F>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline typename result_of_fold<Seq, State, F>::type
|
||||
fold(Seq& seq, State& state, F& f)
|
||||
{
|
||||
return it_fold<
|
||||
typename result_of::begin<Seq>::type
|
||||
, add_reference<State>
|
||||
, F
|
||||
>(
|
||||
typename result_of::size<Seq>::type()
|
||||
, fusion::begin(seq)
|
||||
, state
|
||||
, f
|
||||
);
|
||||
}
|
||||
}
|
||||
namespace result_of
|
||||
{
|
||||
template<typename Seq, typename State, typename F>
|
||||
struct fold
|
||||
: detail::result_of_fold<Seq, State, F>
|
||||
{};
|
||||
}
|
||||
template<typename Seq, typename State, typename F>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline typename result_of::fold<
|
||||
Seq
|
||||
, State const
|
||||
, F
|
||||
>::type
|
||||
fold(Seq& seq, State const& state, F f)
|
||||
{
|
||||
return detail::fold<Seq, State const, F>(seq, state, f);
|
||||
}
|
||||
template<typename Seq, typename State, typename F>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline typename result_of::fold<
|
||||
Seq const
|
||||
, State const
|
||||
, F
|
||||
>::type
|
||||
fold(Seq const& seq, State const& state, F f)
|
||||
{
|
||||
return detail::fold<Seq const, State const, F>(seq, state, f);
|
||||
}
|
||||
template<typename Seq, typename State, typename F>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline typename result_of::fold<
|
||||
Seq
|
||||
, State
|
||||
, F
|
||||
>::type
|
||||
fold(Seq& seq, State& state, F f)
|
||||
{
|
||||
return detail::fold<Seq, State, F>(seq, state, f);
|
||||
}
|
||||
template<typename Seq, typename State, typename F>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline typename result_of::fold<
|
||||
Seq const
|
||||
, State
|
||||
, F
|
||||
>::type
|
||||
fold(Seq const& seq, State& state, F f)
|
||||
{
|
||||
return detail::fold<Seq const, State, F>(seq, state, f);
|
||||
}
|
||||
}}
|
||||
@@ -0,0 +1,21 @@
|
||||
# /* Copyright (C) 2001
|
||||
# * Housemarque Oy
|
||||
# * http://www.housemarque.com
|
||||
# *
|
||||
# * 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)
|
||||
# */
|
||||
#
|
||||
# /* Revised by Paul Mensonides (2002) */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# ifndef BOOST_PREPROCESSOR_PUNCTUATION_COMMA_HPP
|
||||
# define BOOST_PREPROCESSOR_PUNCTUATION_COMMA_HPP
|
||||
#
|
||||
# /* BOOST_PP_COMMA */
|
||||
#
|
||||
# define BOOST_PP_COMMA() ,
|
||||
#
|
||||
# endif
|
||||
@@ -0,0 +1,25 @@
|
||||
/*==============================================================================
|
||||
Copyright (c) 2011 Hartmut Kaiser
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
|
||||
#if !defined(BOOST_PHOENIX_PREPROCESSED_NEW_EVAL)
|
||||
#define BOOST_PHOENIX_PREPROCESSED_NEW_EVAL
|
||||
|
||||
#if BOOST_PHOENIX_LIMIT <= 10
|
||||
#include <boost/phoenix/object/detail/cpp03/preprocessed/new_eval_10.hpp>
|
||||
#elif BOOST_PHOENIX_LIMIT <= 20
|
||||
#include <boost/phoenix/object/detail/cpp03/preprocessed/new_eval_20.hpp>
|
||||
#elif BOOST_PHOENIX_LIMIT <= 30
|
||||
#include <boost/phoenix/object/detail/cpp03/preprocessed/new_eval_30.hpp>
|
||||
#elif BOOST_PHOENIX_LIMIT <= 40
|
||||
#include <boost/phoenix/object/detail/cpp03/preprocessed/new_eval_40.hpp>
|
||||
#elif BOOST_PHOENIX_LIMIT <= 50
|
||||
#include <boost/phoenix/object/detail/cpp03/preprocessed/new_eval_50.hpp>
|
||||
#else
|
||||
#error "BOOST_PHOENIX_LIMIT out of bounds for preprocessed headers"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,267 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Paul Mensonides 2002.
|
||||
# * 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)
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# include <boost/preprocessor/slot/detail/shared.hpp>
|
||||
#
|
||||
# undef BOOST_PP_SLOT_3
|
||||
#
|
||||
# undef BOOST_PP_SLOT_3_DIGIT_1
|
||||
# undef BOOST_PP_SLOT_3_DIGIT_2
|
||||
# undef BOOST_PP_SLOT_3_DIGIT_3
|
||||
# undef BOOST_PP_SLOT_3_DIGIT_4
|
||||
# undef BOOST_PP_SLOT_3_DIGIT_5
|
||||
# undef BOOST_PP_SLOT_3_DIGIT_6
|
||||
# undef BOOST_PP_SLOT_3_DIGIT_7
|
||||
# undef BOOST_PP_SLOT_3_DIGIT_8
|
||||
# undef BOOST_PP_SLOT_3_DIGIT_9
|
||||
# undef BOOST_PP_SLOT_3_DIGIT_10
|
||||
#
|
||||
# if BOOST_PP_SLOT_TEMP_10 == 0
|
||||
# define BOOST_PP_SLOT_3_DIGIT_10 0
|
||||
# elif BOOST_PP_SLOT_TEMP_10 == 1
|
||||
# define BOOST_PP_SLOT_3_DIGIT_10 1
|
||||
# elif BOOST_PP_SLOT_TEMP_10 == 2
|
||||
# define BOOST_PP_SLOT_3_DIGIT_10 2
|
||||
# elif BOOST_PP_SLOT_TEMP_10 == 3
|
||||
# define BOOST_PP_SLOT_3_DIGIT_10 3
|
||||
# elif BOOST_PP_SLOT_TEMP_10 == 4
|
||||
# define BOOST_PP_SLOT_3_DIGIT_10 4
|
||||
# elif BOOST_PP_SLOT_TEMP_10 == 5
|
||||
# define BOOST_PP_SLOT_3_DIGIT_10 5
|
||||
# elif BOOST_PP_SLOT_TEMP_10 == 6
|
||||
# define BOOST_PP_SLOT_3_DIGIT_10 6
|
||||
# elif BOOST_PP_SLOT_TEMP_10 == 7
|
||||
# define BOOST_PP_SLOT_3_DIGIT_10 7
|
||||
# elif BOOST_PP_SLOT_TEMP_10 == 8
|
||||
# define BOOST_PP_SLOT_3_DIGIT_10 8
|
||||
# elif BOOST_PP_SLOT_TEMP_10 == 9
|
||||
# define BOOST_PP_SLOT_3_DIGIT_10 9
|
||||
# endif
|
||||
#
|
||||
# if BOOST_PP_SLOT_TEMP_9 == 0
|
||||
# define BOOST_PP_SLOT_3_DIGIT_9 0
|
||||
# elif BOOST_PP_SLOT_TEMP_9 == 1
|
||||
# define BOOST_PP_SLOT_3_DIGIT_9 1
|
||||
# elif BOOST_PP_SLOT_TEMP_9 == 2
|
||||
# define BOOST_PP_SLOT_3_DIGIT_9 2
|
||||
# elif BOOST_PP_SLOT_TEMP_9 == 3
|
||||
# define BOOST_PP_SLOT_3_DIGIT_9 3
|
||||
# elif BOOST_PP_SLOT_TEMP_9 == 4
|
||||
# define BOOST_PP_SLOT_3_DIGIT_9 4
|
||||
# elif BOOST_PP_SLOT_TEMP_9 == 5
|
||||
# define BOOST_PP_SLOT_3_DIGIT_9 5
|
||||
# elif BOOST_PP_SLOT_TEMP_9 == 6
|
||||
# define BOOST_PP_SLOT_3_DIGIT_9 6
|
||||
# elif BOOST_PP_SLOT_TEMP_9 == 7
|
||||
# define BOOST_PP_SLOT_3_DIGIT_9 7
|
||||
# elif BOOST_PP_SLOT_TEMP_9 == 8
|
||||
# define BOOST_PP_SLOT_3_DIGIT_9 8
|
||||
# elif BOOST_PP_SLOT_TEMP_9 == 9
|
||||
# define BOOST_PP_SLOT_3_DIGIT_9 9
|
||||
# endif
|
||||
#
|
||||
# if BOOST_PP_SLOT_TEMP_8 == 0
|
||||
# define BOOST_PP_SLOT_3_DIGIT_8 0
|
||||
# elif BOOST_PP_SLOT_TEMP_8 == 1
|
||||
# define BOOST_PP_SLOT_3_DIGIT_8 1
|
||||
# elif BOOST_PP_SLOT_TEMP_8 == 2
|
||||
# define BOOST_PP_SLOT_3_DIGIT_8 2
|
||||
# elif BOOST_PP_SLOT_TEMP_8 == 3
|
||||
# define BOOST_PP_SLOT_3_DIGIT_8 3
|
||||
# elif BOOST_PP_SLOT_TEMP_8 == 4
|
||||
# define BOOST_PP_SLOT_3_DIGIT_8 4
|
||||
# elif BOOST_PP_SLOT_TEMP_8 == 5
|
||||
# define BOOST_PP_SLOT_3_DIGIT_8 5
|
||||
# elif BOOST_PP_SLOT_TEMP_8 == 6
|
||||
# define BOOST_PP_SLOT_3_DIGIT_8 6
|
||||
# elif BOOST_PP_SLOT_TEMP_8 == 7
|
||||
# define BOOST_PP_SLOT_3_DIGIT_8 7
|
||||
# elif BOOST_PP_SLOT_TEMP_8 == 8
|
||||
# define BOOST_PP_SLOT_3_DIGIT_8 8
|
||||
# elif BOOST_PP_SLOT_TEMP_8 == 9
|
||||
# define BOOST_PP_SLOT_3_DIGIT_8 9
|
||||
# endif
|
||||
#
|
||||
# if BOOST_PP_SLOT_TEMP_7 == 0
|
||||
# define BOOST_PP_SLOT_3_DIGIT_7 0
|
||||
# elif BOOST_PP_SLOT_TEMP_7 == 1
|
||||
# define BOOST_PP_SLOT_3_DIGIT_7 1
|
||||
# elif BOOST_PP_SLOT_TEMP_7 == 2
|
||||
# define BOOST_PP_SLOT_3_DIGIT_7 2
|
||||
# elif BOOST_PP_SLOT_TEMP_7 == 3
|
||||
# define BOOST_PP_SLOT_3_DIGIT_7 3
|
||||
# elif BOOST_PP_SLOT_TEMP_7 == 4
|
||||
# define BOOST_PP_SLOT_3_DIGIT_7 4
|
||||
# elif BOOST_PP_SLOT_TEMP_7 == 5
|
||||
# define BOOST_PP_SLOT_3_DIGIT_7 5
|
||||
# elif BOOST_PP_SLOT_TEMP_7 == 6
|
||||
# define BOOST_PP_SLOT_3_DIGIT_7 6
|
||||
# elif BOOST_PP_SLOT_TEMP_7 == 7
|
||||
# define BOOST_PP_SLOT_3_DIGIT_7 7
|
||||
# elif BOOST_PP_SLOT_TEMP_7 == 8
|
||||
# define BOOST_PP_SLOT_3_DIGIT_7 8
|
||||
# elif BOOST_PP_SLOT_TEMP_7 == 9
|
||||
# define BOOST_PP_SLOT_3_DIGIT_7 9
|
||||
# endif
|
||||
#
|
||||
# if BOOST_PP_SLOT_TEMP_6 == 0
|
||||
# define BOOST_PP_SLOT_3_DIGIT_6 0
|
||||
# elif BOOST_PP_SLOT_TEMP_6 == 1
|
||||
# define BOOST_PP_SLOT_3_DIGIT_6 1
|
||||
# elif BOOST_PP_SLOT_TEMP_6 == 2
|
||||
# define BOOST_PP_SLOT_3_DIGIT_6 2
|
||||
# elif BOOST_PP_SLOT_TEMP_6 == 3
|
||||
# define BOOST_PP_SLOT_3_DIGIT_6 3
|
||||
# elif BOOST_PP_SLOT_TEMP_6 == 4
|
||||
# define BOOST_PP_SLOT_3_DIGIT_6 4
|
||||
# elif BOOST_PP_SLOT_TEMP_6 == 5
|
||||
# define BOOST_PP_SLOT_3_DIGIT_6 5
|
||||
# elif BOOST_PP_SLOT_TEMP_6 == 6
|
||||
# define BOOST_PP_SLOT_3_DIGIT_6 6
|
||||
# elif BOOST_PP_SLOT_TEMP_6 == 7
|
||||
# define BOOST_PP_SLOT_3_DIGIT_6 7
|
||||
# elif BOOST_PP_SLOT_TEMP_6 == 8
|
||||
# define BOOST_PP_SLOT_3_DIGIT_6 8
|
||||
# elif BOOST_PP_SLOT_TEMP_6 == 9
|
||||
# define BOOST_PP_SLOT_3_DIGIT_6 9
|
||||
# endif
|
||||
#
|
||||
# if BOOST_PP_SLOT_TEMP_5 == 0
|
||||
# define BOOST_PP_SLOT_3_DIGIT_5 0
|
||||
# elif BOOST_PP_SLOT_TEMP_5 == 1
|
||||
# define BOOST_PP_SLOT_3_DIGIT_5 1
|
||||
# elif BOOST_PP_SLOT_TEMP_5 == 2
|
||||
# define BOOST_PP_SLOT_3_DIGIT_5 2
|
||||
# elif BOOST_PP_SLOT_TEMP_5 == 3
|
||||
# define BOOST_PP_SLOT_3_DIGIT_5 3
|
||||
# elif BOOST_PP_SLOT_TEMP_5 == 4
|
||||
# define BOOST_PP_SLOT_3_DIGIT_5 4
|
||||
# elif BOOST_PP_SLOT_TEMP_5 == 5
|
||||
# define BOOST_PP_SLOT_3_DIGIT_5 5
|
||||
# elif BOOST_PP_SLOT_TEMP_5 == 6
|
||||
# define BOOST_PP_SLOT_3_DIGIT_5 6
|
||||
# elif BOOST_PP_SLOT_TEMP_5 == 7
|
||||
# define BOOST_PP_SLOT_3_DIGIT_5 7
|
||||
# elif BOOST_PP_SLOT_TEMP_5 == 8
|
||||
# define BOOST_PP_SLOT_3_DIGIT_5 8
|
||||
# elif BOOST_PP_SLOT_TEMP_5 == 9
|
||||
# define BOOST_PP_SLOT_3_DIGIT_5 9
|
||||
# endif
|
||||
#
|
||||
# if BOOST_PP_SLOT_TEMP_4 == 0
|
||||
# define BOOST_PP_SLOT_3_DIGIT_4 0
|
||||
# elif BOOST_PP_SLOT_TEMP_4 == 1
|
||||
# define BOOST_PP_SLOT_3_DIGIT_4 1
|
||||
# elif BOOST_PP_SLOT_TEMP_4 == 2
|
||||
# define BOOST_PP_SLOT_3_DIGIT_4 2
|
||||
# elif BOOST_PP_SLOT_TEMP_4 == 3
|
||||
# define BOOST_PP_SLOT_3_DIGIT_4 3
|
||||
# elif BOOST_PP_SLOT_TEMP_4 == 4
|
||||
# define BOOST_PP_SLOT_3_DIGIT_4 4
|
||||
# elif BOOST_PP_SLOT_TEMP_4 == 5
|
||||
# define BOOST_PP_SLOT_3_DIGIT_4 5
|
||||
# elif BOOST_PP_SLOT_TEMP_4 == 6
|
||||
# define BOOST_PP_SLOT_3_DIGIT_4 6
|
||||
# elif BOOST_PP_SLOT_TEMP_4 == 7
|
||||
# define BOOST_PP_SLOT_3_DIGIT_4 7
|
||||
# elif BOOST_PP_SLOT_TEMP_4 == 8
|
||||
# define BOOST_PP_SLOT_3_DIGIT_4 8
|
||||
# elif BOOST_PP_SLOT_TEMP_4 == 9
|
||||
# define BOOST_PP_SLOT_3_DIGIT_4 9
|
||||
# endif
|
||||
#
|
||||
# if BOOST_PP_SLOT_TEMP_3 == 0
|
||||
# define BOOST_PP_SLOT_3_DIGIT_3 0
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 1
|
||||
# define BOOST_PP_SLOT_3_DIGIT_3 1
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 2
|
||||
# define BOOST_PP_SLOT_3_DIGIT_3 2
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 3
|
||||
# define BOOST_PP_SLOT_3_DIGIT_3 3
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 4
|
||||
# define BOOST_PP_SLOT_3_DIGIT_3 4
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 5
|
||||
# define BOOST_PP_SLOT_3_DIGIT_3 5
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 6
|
||||
# define BOOST_PP_SLOT_3_DIGIT_3 6
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 7
|
||||
# define BOOST_PP_SLOT_3_DIGIT_3 7
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 8
|
||||
# define BOOST_PP_SLOT_3_DIGIT_3 8
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 9
|
||||
# define BOOST_PP_SLOT_3_DIGIT_3 9
|
||||
# endif
|
||||
#
|
||||
# if BOOST_PP_SLOT_TEMP_2 == 0
|
||||
# define BOOST_PP_SLOT_3_DIGIT_2 0
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 1
|
||||
# define BOOST_PP_SLOT_3_DIGIT_2 1
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 2
|
||||
# define BOOST_PP_SLOT_3_DIGIT_2 2
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 3
|
||||
# define BOOST_PP_SLOT_3_DIGIT_2 3
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 4
|
||||
# define BOOST_PP_SLOT_3_DIGIT_2 4
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 5
|
||||
# define BOOST_PP_SLOT_3_DIGIT_2 5
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 6
|
||||
# define BOOST_PP_SLOT_3_DIGIT_2 6
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 7
|
||||
# define BOOST_PP_SLOT_3_DIGIT_2 7
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 8
|
||||
# define BOOST_PP_SLOT_3_DIGIT_2 8
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 9
|
||||
# define BOOST_PP_SLOT_3_DIGIT_2 9
|
||||
# endif
|
||||
#
|
||||
# if BOOST_PP_SLOT_TEMP_1 == 0
|
||||
# define BOOST_PP_SLOT_3_DIGIT_1 0
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 1
|
||||
# define BOOST_PP_SLOT_3_DIGIT_1 1
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 2
|
||||
# define BOOST_PP_SLOT_3_DIGIT_1 2
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 3
|
||||
# define BOOST_PP_SLOT_3_DIGIT_1 3
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 4
|
||||
# define BOOST_PP_SLOT_3_DIGIT_1 4
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 5
|
||||
# define BOOST_PP_SLOT_3_DIGIT_1 5
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 6
|
||||
# define BOOST_PP_SLOT_3_DIGIT_1 6
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 7
|
||||
# define BOOST_PP_SLOT_3_DIGIT_1 7
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 8
|
||||
# define BOOST_PP_SLOT_3_DIGIT_1 8
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 9
|
||||
# define BOOST_PP_SLOT_3_DIGIT_1 9
|
||||
# endif
|
||||
#
|
||||
# if BOOST_PP_SLOT_3_DIGIT_10
|
||||
# define BOOST_PP_SLOT_3() BOOST_PP_SLOT_CC_10(BOOST_PP_SLOT_3_DIGIT_10, BOOST_PP_SLOT_3_DIGIT_9, BOOST_PP_SLOT_3_DIGIT_8, BOOST_PP_SLOT_3_DIGIT_7, BOOST_PP_SLOT_3_DIGIT_6, BOOST_PP_SLOT_3_DIGIT_5, BOOST_PP_SLOT_3_DIGIT_4, BOOST_PP_SLOT_3_DIGIT_3, BOOST_PP_SLOT_3_DIGIT_2, BOOST_PP_SLOT_3_DIGIT_1)
|
||||
# elif BOOST_PP_SLOT_3_DIGIT_9
|
||||
# define BOOST_PP_SLOT_3() BOOST_PP_SLOT_CC_9(BOOST_PP_SLOT_3_DIGIT_9, BOOST_PP_SLOT_3_DIGIT_8, BOOST_PP_SLOT_3_DIGIT_7, BOOST_PP_SLOT_3_DIGIT_6, BOOST_PP_SLOT_3_DIGIT_5, BOOST_PP_SLOT_3_DIGIT_4, BOOST_PP_SLOT_3_DIGIT_3, BOOST_PP_SLOT_3_DIGIT_2, BOOST_PP_SLOT_3_DIGIT_1)
|
||||
# elif BOOST_PP_SLOT_3_DIGIT_8
|
||||
# define BOOST_PP_SLOT_3() BOOST_PP_SLOT_CC_8(BOOST_PP_SLOT_3_DIGIT_8, BOOST_PP_SLOT_3_DIGIT_7, BOOST_PP_SLOT_3_DIGIT_6, BOOST_PP_SLOT_3_DIGIT_5, BOOST_PP_SLOT_3_DIGIT_4, BOOST_PP_SLOT_3_DIGIT_3, BOOST_PP_SLOT_3_DIGIT_2, BOOST_PP_SLOT_3_DIGIT_1)
|
||||
# elif BOOST_PP_SLOT_3_DIGIT_7
|
||||
# define BOOST_PP_SLOT_3() BOOST_PP_SLOT_CC_7(BOOST_PP_SLOT_3_DIGIT_7, BOOST_PP_SLOT_3_DIGIT_6, BOOST_PP_SLOT_3_DIGIT_5, BOOST_PP_SLOT_3_DIGIT_4, BOOST_PP_SLOT_3_DIGIT_3, BOOST_PP_SLOT_3_DIGIT_2, BOOST_PP_SLOT_3_DIGIT_1)
|
||||
# elif BOOST_PP_SLOT_3_DIGIT_6
|
||||
# define BOOST_PP_SLOT_3() BOOST_PP_SLOT_CC_6(BOOST_PP_SLOT_3_DIGIT_6, BOOST_PP_SLOT_3_DIGIT_5, BOOST_PP_SLOT_3_DIGIT_4, BOOST_PP_SLOT_3_DIGIT_3, BOOST_PP_SLOT_3_DIGIT_2, BOOST_PP_SLOT_3_DIGIT_1)
|
||||
# elif BOOST_PP_SLOT_3_DIGIT_5
|
||||
# define BOOST_PP_SLOT_3() BOOST_PP_SLOT_CC_5(BOOST_PP_SLOT_3_DIGIT_5, BOOST_PP_SLOT_3_DIGIT_4, BOOST_PP_SLOT_3_DIGIT_3, BOOST_PP_SLOT_3_DIGIT_2, BOOST_PP_SLOT_3_DIGIT_1)
|
||||
# elif BOOST_PP_SLOT_3_DIGIT_4
|
||||
# define BOOST_PP_SLOT_3() BOOST_PP_SLOT_CC_4(BOOST_PP_SLOT_3_DIGIT_4, BOOST_PP_SLOT_3_DIGIT_3, BOOST_PP_SLOT_3_DIGIT_2, BOOST_PP_SLOT_3_DIGIT_1)
|
||||
# elif BOOST_PP_SLOT_3_DIGIT_3
|
||||
# define BOOST_PP_SLOT_3() BOOST_PP_SLOT_CC_3(BOOST_PP_SLOT_3_DIGIT_3, BOOST_PP_SLOT_3_DIGIT_2, BOOST_PP_SLOT_3_DIGIT_1)
|
||||
# elif BOOST_PP_SLOT_3_DIGIT_2
|
||||
# define BOOST_PP_SLOT_3() BOOST_PP_SLOT_CC_2(BOOST_PP_SLOT_3_DIGIT_2, BOOST_PP_SLOT_3_DIGIT_1)
|
||||
# else
|
||||
# define BOOST_PP_SLOT_3() BOOST_PP_SLOT_3_DIGIT_1
|
||||
# endif
|
||||
@@ -0,0 +1,177 @@
|
||||
/*==============================================================================
|
||||
Copyright (c) 2005-2010 Joel de Guzman
|
||||
Copyright (c) 2010 Thomas Heller
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0>
|
||||
inline
|
||||
typename expression::new_<detail::target<T>, A0>::type const
|
||||
new_(A0 const& a0)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
new_<detail::target<T>, A0>::
|
||||
make(detail::target<T>(), a0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1>
|
||||
inline
|
||||
typename expression::new_<detail::target<T>, A0 , A1>::type const
|
||||
new_(A0 const& a0 , A1 const& a1)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
new_<detail::target<T>, A0 , A1>::
|
||||
make(detail::target<T>(), a0 , a1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2>
|
||||
inline
|
||||
typename expression::new_<detail::target<T>, A0 , A1 , A2>::type const
|
||||
new_(A0 const& a0 , A1 const& a1 , A2 const& a2)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
new_<detail::target<T>, A0 , A1 , A2>::
|
||||
make(detail::target<T>(), a0 , a1 , a2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3>
|
||||
inline
|
||||
typename expression::new_<detail::target<T>, A0 , A1 , A2 , A3>::type const
|
||||
new_(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
new_<detail::target<T>, A0 , A1 , A2 , A3>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
|
||||
inline
|
||||
typename expression::new_<detail::target<T>, A0 , A1 , A2 , A3 , A4>::type const
|
||||
new_(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
new_<detail::target<T>, A0 , A1 , A2 , A3 , A4>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
|
||||
inline
|
||||
typename expression::new_<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5>::type const
|
||||
new_(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
new_<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
|
||||
inline
|
||||
typename expression::new_<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6>::type const
|
||||
new_(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
new_<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
|
||||
inline
|
||||
typename expression::new_<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7>::type const
|
||||
new_(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
new_<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
|
||||
inline
|
||||
typename expression::new_<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8>::type const
|
||||
new_(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
new_<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
|
||||
inline
|
||||
typename expression::new_<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9>::type const
|
||||
new_(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
new_<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9);
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
// Preprocessed version of "boost/mpl/vector/vector20_c.hpp" header
|
||||
// -- DO NOT modify by hand!
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<
|
||||
typename T
|
||||
, T C0, T C1, T C2, T C3, T C4, T C5, T C6, T C7, T C8, T C9, T C10
|
||||
>
|
||||
struct vector11_c
|
||||
: vector11<
|
||||
integral_c< T,C0 >, integral_c< T,C1 >, integral_c< T,C2 >
|
||||
, integral_c< T,C3 >, integral_c< T,C4 >, integral_c< T,C5 >, integral_c< T,C6 >
|
||||
, integral_c< T,C7 >, integral_c< T,C8 >, integral_c< T,C9 >, integral_c<T
|
||||
, C10>
|
||||
>
|
||||
{
|
||||
typedef vector11_c type;
|
||||
typedef T value_type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T
|
||||
, T C0, T C1, T C2, T C3, T C4, T C5, T C6, T C7, T C8, T C9, T C10
|
||||
, T C11
|
||||
>
|
||||
struct vector12_c
|
||||
: vector12<
|
||||
integral_c< T,C0 >, integral_c< T,C1 >, integral_c< T,C2 >
|
||||
, integral_c< T,C3 >, integral_c< T,C4 >, integral_c< T,C5 >, integral_c< T,C6 >
|
||||
, integral_c< T,C7 >, integral_c< T,C8 >, integral_c< T,C9 >
|
||||
, integral_c< T,C10 >, integral_c< T,C11 >
|
||||
>
|
||||
{
|
||||
typedef vector12_c type;
|
||||
typedef T value_type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T
|
||||
, T C0, T C1, T C2, T C3, T C4, T C5, T C6, T C7, T C8, T C9, T C10
|
||||
, T C11, T C12
|
||||
>
|
||||
struct vector13_c
|
||||
: vector13<
|
||||
integral_c< T,C0 >, integral_c< T,C1 >, integral_c< T,C2 >
|
||||
, integral_c< T,C3 >, integral_c< T,C4 >, integral_c< T,C5 >, integral_c< T,C6 >
|
||||
, integral_c< T,C7 >, integral_c< T,C8 >, integral_c< T,C9 >
|
||||
, integral_c< T,C10 >, integral_c< T,C11 >, integral_c< T,C12 >
|
||||
>
|
||||
{
|
||||
typedef vector13_c type;
|
||||
typedef T value_type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T
|
||||
, T C0, T C1, T C2, T C3, T C4, T C5, T C6, T C7, T C8, T C9, T C10
|
||||
, T C11, T C12, T C13
|
||||
>
|
||||
struct vector14_c
|
||||
: vector14<
|
||||
integral_c< T,C0 >, integral_c< T,C1 >, integral_c< T,C2 >
|
||||
, integral_c< T,C3 >, integral_c< T,C4 >, integral_c< T,C5 >, integral_c< T,C6 >
|
||||
, integral_c< T,C7 >, integral_c< T,C8 >, integral_c< T,C9 >
|
||||
, integral_c< T,C10 >, integral_c< T,C11 >, integral_c< T,C12 >, integral_c<T
|
||||
, C13>
|
||||
>
|
||||
{
|
||||
typedef vector14_c type;
|
||||
typedef T value_type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T
|
||||
, T C0, T C1, T C2, T C3, T C4, T C5, T C6, T C7, T C8, T C9, T C10
|
||||
, T C11, T C12, T C13, T C14
|
||||
>
|
||||
struct vector15_c
|
||||
: vector15<
|
||||
integral_c< T,C0 >, integral_c< T,C1 >, integral_c< T,C2 >
|
||||
, integral_c< T,C3 >, integral_c< T,C4 >, integral_c< T,C5 >, integral_c< T,C6 >
|
||||
, integral_c< T,C7 >, integral_c< T,C8 >, integral_c< T,C9 >
|
||||
, integral_c< T,C10 >, integral_c< T,C11 >, integral_c< T,C12 >
|
||||
, integral_c< T,C13 >, integral_c< T,C14 >
|
||||
>
|
||||
{
|
||||
typedef vector15_c type;
|
||||
typedef T value_type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T
|
||||
, T C0, T C1, T C2, T C3, T C4, T C5, T C6, T C7, T C8, T C9, T C10
|
||||
, T C11, T C12, T C13, T C14, T C15
|
||||
>
|
||||
struct vector16_c
|
||||
: vector16<
|
||||
integral_c< T,C0 >, integral_c< T,C1 >, integral_c< T,C2 >
|
||||
, integral_c< T,C3 >, integral_c< T,C4 >, integral_c< T,C5 >, integral_c< T,C6 >
|
||||
, integral_c< T,C7 >, integral_c< T,C8 >, integral_c< T,C9 >
|
||||
, integral_c< T,C10 >, integral_c< T,C11 >, integral_c< T,C12 >
|
||||
, integral_c< T,C13 >, integral_c< T,C14 >, integral_c< T,C15 >
|
||||
>
|
||||
{
|
||||
typedef vector16_c type;
|
||||
typedef T value_type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T
|
||||
, T C0, T C1, T C2, T C3, T C4, T C5, T C6, T C7, T C8, T C9, T C10
|
||||
, T C11, T C12, T C13, T C14, T C15, T C16
|
||||
>
|
||||
struct vector17_c
|
||||
: vector17<
|
||||
integral_c< T,C0 >, integral_c< T,C1 >, integral_c< T,C2 >
|
||||
, integral_c< T,C3 >, integral_c< T,C4 >, integral_c< T,C5 >, integral_c< T,C6 >
|
||||
, integral_c< T,C7 >, integral_c< T,C8 >, integral_c< T,C9 >
|
||||
, integral_c< T,C10 >, integral_c< T,C11 >, integral_c< T,C12 >
|
||||
, integral_c< T,C13 >, integral_c< T,C14 >, integral_c< T,C15 >, integral_c<T
|
||||
, C16>
|
||||
>
|
||||
{
|
||||
typedef vector17_c type;
|
||||
typedef T value_type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T
|
||||
, T C0, T C1, T C2, T C3, T C4, T C5, T C6, T C7, T C8, T C9, T C10
|
||||
, T C11, T C12, T C13, T C14, T C15, T C16, T C17
|
||||
>
|
||||
struct vector18_c
|
||||
: vector18<
|
||||
integral_c< T,C0 >, integral_c< T,C1 >, integral_c< T,C2 >
|
||||
, integral_c< T,C3 >, integral_c< T,C4 >, integral_c< T,C5 >, integral_c< T,C6 >
|
||||
, integral_c< T,C7 >, integral_c< T,C8 >, integral_c< T,C9 >
|
||||
, integral_c< T,C10 >, integral_c< T,C11 >, integral_c< T,C12 >
|
||||
, integral_c< T,C13 >, integral_c< T,C14 >, integral_c< T,C15 >
|
||||
, integral_c< T,C16 >, integral_c< T,C17 >
|
||||
>
|
||||
{
|
||||
typedef vector18_c type;
|
||||
typedef T value_type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T
|
||||
, T C0, T C1, T C2, T C3, T C4, T C5, T C6, T C7, T C8, T C9, T C10
|
||||
, T C11, T C12, T C13, T C14, T C15, T C16, T C17, T C18
|
||||
>
|
||||
struct vector19_c
|
||||
: vector19<
|
||||
integral_c< T,C0 >, integral_c< T,C1 >, integral_c< T,C2 >
|
||||
, integral_c< T,C3 >, integral_c< T,C4 >, integral_c< T,C5 >, integral_c< T,C6 >
|
||||
, integral_c< T,C7 >, integral_c< T,C8 >, integral_c< T,C9 >
|
||||
, integral_c< T,C10 >, integral_c< T,C11 >, integral_c< T,C12 >
|
||||
, integral_c< T,C13 >, integral_c< T,C14 >, integral_c< T,C15 >
|
||||
, integral_c< T,C16 >, integral_c< T,C17 >, integral_c< T,C18 >
|
||||
>
|
||||
{
|
||||
typedef vector19_c type;
|
||||
typedef T value_type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T
|
||||
, T C0, T C1, T C2, T C3, T C4, T C5, T C6, T C7, T C8, T C9, T C10
|
||||
, T C11, T C12, T C13, T C14, T C15, T C16, T C17, T C18, T C19
|
||||
>
|
||||
struct vector20_c
|
||||
: vector20<
|
||||
integral_c< T,C0 >, integral_c< T,C1 >, integral_c< T,C2 >
|
||||
, integral_c< T,C3 >, integral_c< T,C4 >, integral_c< T,C5 >, integral_c< T,C6 >
|
||||
, integral_c< T,C7 >, integral_c< T,C8 >, integral_c< T,C9 >
|
||||
, integral_c< T,C10 >, integral_c< T,C11 >, integral_c< T,C12 >
|
||||
, integral_c< T,C13 >, integral_c< T,C14 >, integral_c< T,C15 >
|
||||
, integral_c< T,C16 >, integral_c< T,C17 >, integral_c< T,C18 >, integral_c<T
|
||||
, C19>
|
||||
>
|
||||
{
|
||||
typedef vector20_c type;
|
||||
typedef T value_type;
|
||||
};
|
||||
|
||||
}}
|
||||
@@ -0,0 +1,117 @@
|
||||
subroutine ccf65(ss,nhsym,ssmax,sync1,dt1,flipk,syncshort,snr2,dt2)
|
||||
|
||||
parameter (NFFT=512,NH=NFFT/2)
|
||||
real ss(322) !Input: half-symbol normalized powers
|
||||
real s(NFFT) !CCF = ss*pr
|
||||
complex cs(0:NH) !Complex FT of s
|
||||
real s2(NFFT) !CCF = ss*pr2
|
||||
complex cs2(0:NH) !Complex FT of s2
|
||||
real pr(NFFT) !JT65 pseudo-random sync pattern
|
||||
complex cpr(0:NH) !Complex FT of pr
|
||||
real pr2(NFFT) !JT65 shorthand pattern
|
||||
complex cpr2(0:NH) !Complex FT of pr2
|
||||
real tmp1(322)
|
||||
real ccf(-11:54)
|
||||
logical first
|
||||
integer npr(126)
|
||||
data first/.true./
|
||||
equivalence (s,cs),(pr,cpr),(s2,cs2),(pr2,cpr2)
|
||||
save
|
||||
|
||||
! The JT65 pseudo-random sync pattern:
|
||||
data npr/ &
|
||||
1,0,0,1,1,0,0,0,1,1,1,1,1,1,0,1,0,1,0,0, &
|
||||
0,1,0,1,1,0,0,1,0,0,0,1,1,1,0,0,1,1,1,1, &
|
||||
0,1,1,0,1,1,1,1,0,0,0,1,1,0,1,0,1,0,1,1, &
|
||||
0,0,1,1,0,1,0,1,0,1,0,0,1,0,0,0,0,0,0,1, &
|
||||
1,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0,1,1,0,1, &
|
||||
0,1,0,1,0,0,1,1,0,0,1,0,0,1,0,0,0,0,1,1, &
|
||||
1,1,1,1,1,1/
|
||||
|
||||
if(first) then
|
||||
! Initialize pr, pr2; compute cpr, cpr2.
|
||||
fac=1.0/NFFT
|
||||
do i=1,NFFT
|
||||
pr(i)=0.
|
||||
pr2(i)=0.
|
||||
k=2*mod((i-1)/8,2)-1
|
||||
if(i.le.NH) pr2(i)=fac*k
|
||||
enddo
|
||||
do i=1,126
|
||||
j=2*i
|
||||
pr(j)=fac*(2*npr(i)-1)
|
||||
! Not sure why, but it works significantly better without the following line:
|
||||
! pr(j-1)=pr(j)
|
||||
enddo
|
||||
call four2a(cpr,NFFT,1,-1,0)
|
||||
call four2a(cpr2,NFFT,1,-1,0)
|
||||
first=.false.
|
||||
endif
|
||||
|
||||
! Look for JT65 sync pattern and shorthand square-wave pattern.
|
||||
ccfbest=0.
|
||||
ccfbest2=0.
|
||||
do i=1,nhsym-1
|
||||
s(i)=min(ssmax,ss(i)+ss(i+1))
|
||||
! s(i)=ss(i)+ss(i+1)
|
||||
enddo
|
||||
|
||||
call pctile(s,nhsym-1,50,base)
|
||||
s(1:nhsym-1)=s(1:nhsym-1)-base
|
||||
s(nhsym:NFFT)=0.
|
||||
call four2a(cs,NFFT,1,-1,0) !Real-to-complex FFT
|
||||
do i=0,NH
|
||||
! cs2(i)=cs(i)*conjg(cpr2(i)) !Mult by complex FFT of pr2
|
||||
cs(i)=cs(i)*conjg(cpr(i)) !Mult by complex FFT of pr
|
||||
enddo
|
||||
call four2a(cs,NFFT,1,1,-1) !Complex-to-real inv-FFT
|
||||
! call four2a(cs2,NFFT,1,1,-1) !Complex-to-real inv-FFT
|
||||
|
||||
do lag=-11,54 !Check for best JT65 sync
|
||||
j=lag
|
||||
if(j.lt.1) j=j+NFFT
|
||||
ccf(lag)=s(j)
|
||||
! if(abs(ccf(lag)).gt.ccfbest) then
|
||||
if(ccf(lag).gt.ccfbest) then !No inverted sync for use at HF
|
||||
! ccfbest=abs(ccf(lag))
|
||||
ccfbest=ccf(lag)
|
||||
lagpk=lag
|
||||
flipk=1.0
|
||||
! if(ccf(lag).lt.0.0) flipk=-1.0
|
||||
endif
|
||||
enddo
|
||||
|
||||
! do lag=-11,54 !Check for best shorthand
|
||||
! ccf2=s2(lag+28)
|
||||
! if(ccf2.gt.ccfbest2) then
|
||||
! ccfbest2=ccf2
|
||||
! lagpk2=lag
|
||||
! endif
|
||||
! enddo
|
||||
|
||||
! Find rms level on baseline of "ccfblue", for normalization.
|
||||
sum=0.
|
||||
do lag=-11,54
|
||||
if(abs(lag-lagpk).gt.1) sum=sum + ccf(lag)
|
||||
enddo
|
||||
base=sum/50.0
|
||||
sq=0.
|
||||
do lag=-11,54
|
||||
if(abs(lag-lagpk).gt.1) sq=sq + (ccf(lag)-base)**2
|
||||
enddo
|
||||
rms=sqrt(sq/49.0)
|
||||
sync1=ccfbest/rms - 4.0
|
||||
dt1=lagpk*(2048.0/11025.0) - 2.5
|
||||
|
||||
! Find base level for normalizing snr2.
|
||||
do i=1,nhsym
|
||||
tmp1(i)=ss(i)
|
||||
enddo
|
||||
call pctile(tmp1,nhsym,40,base)
|
||||
snr2=0.398107*ccfbest2/base !### empirical
|
||||
syncshort=0.5*ccfbest2/rms - 4.0 !### better normalizer than rms?
|
||||
! dt2=(2.5 + lagpk2*(2048.0/11025.0))
|
||||
dt2=0.
|
||||
|
||||
return
|
||||
end subroutine ccf65
|
||||
@@ -0,0 +1,31 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_IS_SEQUENCE_IMPL_09242011_1744)
|
||||
#define BOOST_FUSION_IS_SEQUENCE_IMPL_09242011_1744
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct std_tuple_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct is_sequence_impl;
|
||||
|
||||
template<>
|
||||
struct is_sequence_impl<std_tuple_tag>
|
||||
{
|
||||
template<typename Sequence>
|
||||
struct apply : mpl::true_ {};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,96 @@
|
||||
#ifndef BOOST_SERIALIZATION_STATE_SAVER_HPP
|
||||
#define BOOST_SERIALIZATION_STATE_SAVER_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// state_saver.hpp:
|
||||
|
||||
// (C) Copyright 2003-4 Pavel Vozenilek and Robert Ramey - http://www.rrsd.com.
|
||||
// Use, modification and distribution is subject to 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)
|
||||
|
||||
// See http://www.boost.org/libs/serialization for updates, documentation, and revision history.
|
||||
|
||||
// Inspired by Daryle Walker's iostate_saver concept. This saves the original
|
||||
// value of a variable when a state_saver is constructed and restores
|
||||
// upon destruction. Useful for being sure that state is restored to
|
||||
// variables upon exit from scope.
|
||||
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
#include <exception>
|
||||
#endif
|
||||
|
||||
#include <boost/call_traits.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/type_traits/has_nothrow_copy.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
|
||||
template<class T>
|
||||
// T requirements:
|
||||
// - POD or object semantic (cannot be reference, function, ...)
|
||||
// - copy constructor
|
||||
// - operator = (no-throw one preferred)
|
||||
class state_saver : private boost::noncopyable
|
||||
{
|
||||
private:
|
||||
const T previous_value;
|
||||
T & previous_ref;
|
||||
|
||||
struct restore {
|
||||
static void invoke(T & previous_ref, const T & previous_value){
|
||||
previous_ref = previous_value; // won't throw
|
||||
}
|
||||
};
|
||||
|
||||
struct restore_with_exception {
|
||||
static void invoke(T & previous_ref, const T & previous_value){
|
||||
BOOST_TRY{
|
||||
previous_ref = previous_value;
|
||||
}
|
||||
BOOST_CATCH(::std::exception &) {
|
||||
// we must ignore it - we are in destructor
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
state_saver(
|
||||
T & object
|
||||
) :
|
||||
previous_value(object),
|
||||
previous_ref(object)
|
||||
{}
|
||||
|
||||
~state_saver() {
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
typedef typename mpl::eval_if<
|
||||
has_nothrow_copy< T >,
|
||||
mpl::identity<restore>,
|
||||
mpl::identity<restore_with_exception>
|
||||
>::type typex;
|
||||
typex::invoke(previous_ref, previous_value);
|
||||
#else
|
||||
previous_ref = previous_value;
|
||||
#endif
|
||||
}
|
||||
|
||||
}; // state_saver<>
|
||||
|
||||
} // serialization
|
||||
} // boost
|
||||
|
||||
#endif //BOOST_SERIALIZATION_STATE_SAVER_HPP
|
||||
@@ -0,0 +1,35 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See http://boostorg.github.com/compute for more information.
|
||||
//---------------------------------------------------------------------------//
|
||||
|
||||
#ifndef BOOST_COMPUTE_ALGORITHM_FIND_IF_HPP
|
||||
#define BOOST_COMPUTE_ALGORITHM_FIND_IF_HPP
|
||||
|
||||
#include <boost/compute/system.hpp>
|
||||
#include <boost/compute/command_queue.hpp>
|
||||
#include <boost/compute/algorithm/detail/find_if_with_atomics.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
|
||||
/// Returns an iterator pointing to the first element in the range
|
||||
/// [\p first, \p last) for which \p predicate returns \c true.
|
||||
template<class InputIterator, class UnaryPredicate>
|
||||
inline InputIterator find_if(InputIterator first,
|
||||
InputIterator last,
|
||||
UnaryPredicate predicate,
|
||||
command_queue &queue = system::default_queue())
|
||||
{
|
||||
return detail::find_if_with_atomics(first, last, predicate, queue);
|
||||
}
|
||||
|
||||
} // end compute namespace
|
||||
} // end boost namespace
|
||||
|
||||
#endif // BOOST_COMPUTE_ALGORITHM_FIND_IF_HPP
|
||||
@@ -0,0 +1,79 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_DEREF_IMPL_07162005_1026)
|
||||
#define FUSION_DEREF_IMPL_07162005_1026
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/mpl/apply.hpp>
|
||||
#include <boost/fusion/iterator/deref.hpp>
|
||||
#include <boost/fusion/iterator/value_of.hpp>
|
||||
#include <boost/fusion/view/transform_view/detail/apply_transform_result.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct transform_view_iterator_tag;
|
||||
struct transform_view_iterator2_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct deref_impl;
|
||||
|
||||
// Unary Version
|
||||
template <>
|
||||
struct deref_impl<transform_view_iterator_tag>
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
typedef typename
|
||||
result_of::deref<typename Iterator::first_type>::type
|
||||
value_type;
|
||||
|
||||
typedef detail::apply_transform_result<typename Iterator::transform_type> transform_type;
|
||||
typedef typename mpl::apply<transform_type, value_type>::type type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type
|
||||
call(Iterator const& i)
|
||||
{
|
||||
return i.f(*i.first);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// Binary Version
|
||||
template <>
|
||||
struct deref_impl<transform_view_iterator2_tag>
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
typedef typename
|
||||
result_of::deref<typename Iterator::first1_type>::type
|
||||
value1_type;
|
||||
typedef typename
|
||||
result_of::deref<typename Iterator::first2_type>::type
|
||||
value2_type;
|
||||
|
||||
typedef detail::apply_transform_result<typename Iterator::transform_type> transform_type;
|
||||
typedef typename mpl::apply<transform_type, value1_type, value2_type>::type type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type
|
||||
call(Iterator const& i)
|
||||
{
|
||||
return i.f(*i.first1, *i.first2);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,374 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2013-2013
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
// See http://www.boost.org/libs/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_PACK_OPTIONS_HPP
|
||||
#define BOOST_INTRUSIVE_PACK_OPTIONS_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
|
||||
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
|
||||
template<class Prev, class Next>
|
||||
struct do_pack
|
||||
{
|
||||
//Use "pack" member template to pack options
|
||||
typedef typename Next::template pack<Prev> type;
|
||||
};
|
||||
|
||||
template<class Prev>
|
||||
struct do_pack<Prev, void>
|
||||
{
|
||||
//Avoid packing "void" to shorten template names
|
||||
typedef Prev type;
|
||||
};
|
||||
|
||||
template
|
||||
< class DefaultOptions
|
||||
, class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
, class O7 = void
|
||||
, class O8 = void
|
||||
, class O9 = void
|
||||
, class O10 = void
|
||||
, class O11 = void
|
||||
>
|
||||
struct pack_options
|
||||
{
|
||||
// join options
|
||||
typedef
|
||||
typename do_pack
|
||||
< typename do_pack
|
||||
< typename do_pack
|
||||
< typename do_pack
|
||||
< typename do_pack
|
||||
< typename do_pack
|
||||
< typename do_pack
|
||||
< typename do_pack
|
||||
< typename do_pack
|
||||
< typename do_pack
|
||||
< typename do_pack
|
||||
< DefaultOptions
|
||||
, O1
|
||||
>::type
|
||||
, O2
|
||||
>::type
|
||||
, O3
|
||||
>::type
|
||||
, O4
|
||||
>::type
|
||||
, O5
|
||||
>::type
|
||||
, O6
|
||||
>::type
|
||||
, O7
|
||||
>::type
|
||||
, O8
|
||||
>::type
|
||||
, O9
|
||||
>::type
|
||||
, O10
|
||||
>::type
|
||||
, O11
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
#else
|
||||
|
||||
//index_tuple
|
||||
template<int... Indexes>
|
||||
struct index_tuple{};
|
||||
|
||||
//build_number_seq
|
||||
template<std::size_t Num, typename Tuple = index_tuple<> >
|
||||
struct build_number_seq;
|
||||
|
||||
template<std::size_t Num, int... Indexes>
|
||||
struct build_number_seq<Num, index_tuple<Indexes...> >
|
||||
: build_number_seq<Num - 1, index_tuple<Indexes..., sizeof...(Indexes)> >
|
||||
{};
|
||||
|
||||
template<int... Indexes>
|
||||
struct build_number_seq<0, index_tuple<Indexes...> >
|
||||
{ typedef index_tuple<Indexes...> type; };
|
||||
|
||||
template<class ...Types>
|
||||
struct typelist
|
||||
{};
|
||||
|
||||
//invert_typelist
|
||||
template<class T>
|
||||
struct invert_typelist;
|
||||
|
||||
template<int I, typename Tuple>
|
||||
struct typelist_element;
|
||||
|
||||
template<int I, typename Head, typename... Tail>
|
||||
struct typelist_element<I, typelist<Head, Tail...> >
|
||||
{
|
||||
typedef typename typelist_element<I-1, typelist<Tail...> >::type type;
|
||||
};
|
||||
|
||||
template<typename Head, typename... Tail>
|
||||
struct typelist_element<0, typelist<Head, Tail...> >
|
||||
{
|
||||
typedef Head type;
|
||||
};
|
||||
|
||||
template<int ...Ints, class ...Types>
|
||||
typelist<typename typelist_element<(sizeof...(Types) - 1) - Ints, typelist<Types...> >::type...>
|
||||
inverted_typelist(index_tuple<Ints...>, typelist<Types...>)
|
||||
{
|
||||
return typelist<typename typelist_element<(sizeof...(Types) - 1) - Ints, typelist<Types...> >::type...>();
|
||||
}
|
||||
|
||||
//sizeof_typelist
|
||||
template<class Typelist>
|
||||
struct sizeof_typelist;
|
||||
|
||||
template<class ...Types>
|
||||
struct sizeof_typelist< typelist<Types...> >
|
||||
{
|
||||
static const std::size_t value = sizeof...(Types);
|
||||
};
|
||||
|
||||
//invert_typelist_impl
|
||||
template<class Typelist, class Indexes>
|
||||
struct invert_typelist_impl;
|
||||
|
||||
|
||||
template<class Typelist, int ...Ints>
|
||||
struct invert_typelist_impl< Typelist, index_tuple<Ints...> >
|
||||
{
|
||||
static const std::size_t last_idx = sizeof_typelist<Typelist>::value - 1;
|
||||
typedef typelist
|
||||
<typename typelist_element<last_idx - Ints, Typelist>::type...> type;
|
||||
};
|
||||
|
||||
template<class Typelist, int Int>
|
||||
struct invert_typelist_impl< Typelist, index_tuple<Int> >
|
||||
{
|
||||
typedef Typelist type;
|
||||
};
|
||||
|
||||
template<class Typelist>
|
||||
struct invert_typelist_impl< Typelist, index_tuple<> >
|
||||
{
|
||||
typedef Typelist type;
|
||||
};
|
||||
|
||||
//invert_typelist
|
||||
template<class Typelist>
|
||||
struct invert_typelist;
|
||||
|
||||
template<class ...Types>
|
||||
struct invert_typelist< typelist<Types...> >
|
||||
{
|
||||
typedef typelist<Types...> typelist_t;
|
||||
typedef typename build_number_seq<sizeof...(Types)>::type indexes_t;
|
||||
typedef typename invert_typelist_impl<typelist_t, indexes_t>::type type;
|
||||
};
|
||||
|
||||
//Do pack
|
||||
template<class Typelist>
|
||||
struct do_pack;
|
||||
|
||||
template<>
|
||||
struct do_pack<typelist<> >;
|
||||
|
||||
template<class Prev>
|
||||
struct do_pack<typelist<Prev> >
|
||||
{
|
||||
typedef Prev type;
|
||||
};
|
||||
|
||||
template<class Prev, class Last>
|
||||
struct do_pack<typelist<Prev, Last> >
|
||||
{
|
||||
typedef typename Prev::template pack<Last> type;
|
||||
};
|
||||
|
||||
template<class Prev, class ...Others>
|
||||
struct do_pack<typelist<Prev, Others...> >
|
||||
{
|
||||
typedef typename Prev::template pack
|
||||
<typename do_pack<typelist<Others...> >::type> type;
|
||||
};
|
||||
|
||||
|
||||
template<class DefaultOptions, class ...Options>
|
||||
struct pack_options
|
||||
{
|
||||
typedef typelist<DefaultOptions, Options...> typelist_t;
|
||||
typedef typename invert_typelist<typelist_t>::type inverted_typelist;
|
||||
typedef typename do_pack<inverted_typelist>::type type;
|
||||
};
|
||||
|
||||
#endif //!defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
|
||||
#define BOOST_INTRUSIVE_OPTION_TYPE(OPTION_NAME, TYPE, TYPEDEF_EXPR, TYPEDEF_NAME) \
|
||||
template< class TYPE> \
|
||||
struct OPTION_NAME \
|
||||
{ \
|
||||
template<class Base> \
|
||||
struct pack : Base \
|
||||
{ \
|
||||
typedef TYPEDEF_EXPR TYPEDEF_NAME; \
|
||||
}; \
|
||||
}; \
|
||||
//
|
||||
|
||||
#define BOOST_INTRUSIVE_OPTION_CONSTANT(OPTION_NAME, TYPE, VALUE, CONSTANT_NAME) \
|
||||
template< TYPE VALUE> \
|
||||
struct OPTION_NAME \
|
||||
{ \
|
||||
template<class Base> \
|
||||
struct pack : Base \
|
||||
{ \
|
||||
static const TYPE CONSTANT_NAME = VALUE; \
|
||||
}; \
|
||||
}; \
|
||||
//
|
||||
|
||||
#else //#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! This class is a utility that takes:
|
||||
//! - a default options class defining initial static constant
|
||||
//! and typedefs
|
||||
//! - several options defined with BOOST_INTRUSIVE_OPTION_CONSTANT and
|
||||
//! BOOST_INTRUSIVE_OPTION_TYPE
|
||||
//!
|
||||
//! and packs them together in a new type that defines all options as
|
||||
//! member typedefs or static constant values. Given options of form:
|
||||
//!
|
||||
//! \code
|
||||
//! BOOST_INTRUSIVE_OPTION_TYPE(my_pointer, VoidPointer, VoidPointer, my_pointer_type)
|
||||
//! BOOST_INTRUSIVE_OPTION_CONSTANT(incremental, bool, Enabled, is_incremental)
|
||||
//! \endcode
|
||||
//!
|
||||
//! the following expression
|
||||
//!
|
||||
//! \code
|
||||
//!
|
||||
//! struct default_options
|
||||
//! {
|
||||
//! typedef long int_type;
|
||||
//! static const int int_constant = -1;
|
||||
//! };
|
||||
//!
|
||||
//! pack_options< default_options, my_pointer<void*>, incremental<true> >::type
|
||||
//! \endcode
|
||||
//!
|
||||
//! will create a type that will contain the following typedefs/constants
|
||||
//!
|
||||
//! \code
|
||||
//! struct unspecified_type
|
||||
//! {
|
||||
//! //Default options
|
||||
//! typedef long int_type;
|
||||
//! static const int int_constant = -1;
|
||||
//!
|
||||
//! //Packed options (will ovewrite any default option)
|
||||
//! typedef void* my_pointer_type;
|
||||
//! static const bool is_incremental = true;
|
||||
//! };
|
||||
//! \endcode
|
||||
//!
|
||||
//! If an option is specified in the default options argument and later
|
||||
//! redefined as an option, the last definition will prevail.
|
||||
template<class DefaultOptions, class ...Options>
|
||||
struct pack_options
|
||||
{
|
||||
typedef unspecified_type type;
|
||||
};
|
||||
|
||||
//! Defines an option class of name OPTION_NAME that can be used to specify a type
|
||||
//! of type TYPE...
|
||||
//!
|
||||
//! \code
|
||||
//! struct OPTION_NAME<class TYPE>
|
||||
//! { unspecified_content };
|
||||
//! \endcode
|
||||
//!
|
||||
//! ...that after being combined with
|
||||
//! <code>boost::intrusive::pack_options</code>,
|
||||
//! will typedef TYPE as a typedef of name TYPEDEF_NAME. Example:
|
||||
//!
|
||||
//! \code
|
||||
//! //[includes and namespaces omitted for brevity]
|
||||
//!
|
||||
//! //This macro will create the following class:
|
||||
//! // template<class VoidPointer>
|
||||
//! // struct my_pointer
|
||||
//! // { unspecified_content };
|
||||
//! BOOST_INTRUSIVE_OPTION_TYPE(my_pointer, VoidPointer, boost::remove_pointer<VoidPointer>::type, my_pointer_type)
|
||||
//!
|
||||
//! struct empty_default{};
|
||||
//!
|
||||
//! typedef pack_options< empty_default, typename my_pointer<void*> >::type::my_pointer_type type;
|
||||
//!
|
||||
//! BOOST_STATIC_ASSERT(( boost::is_same<type, void>::value ));
|
||||
//!
|
||||
//! \endcode
|
||||
#define BOOST_INTRUSIVE_OPTION_TYPE(OPTION_NAME, TYPE, TYPEDEF_EXPR, TYPEDEF_NAME)
|
||||
|
||||
//! Defines an option class of name OPTION_NAME that can be used to specify a constant
|
||||
//! of type TYPE with value VALUE...
|
||||
//!
|
||||
//! \code
|
||||
//! struct OPTION_NAME<TYPE VALUE>
|
||||
//! { unspecified_content };
|
||||
//! \endcode
|
||||
//!
|
||||
//! ...that after being combined with
|
||||
//! <code>boost::intrusive::pack_options</code>,
|
||||
//! will contain a CONSTANT_NAME static constant of value VALUE. Example:
|
||||
//!
|
||||
//! \code
|
||||
//! //[includes and namespaces omitted for brevity]
|
||||
//!
|
||||
//! //This macro will create the following class:
|
||||
//! // template<bool Enabled>
|
||||
//! // struct incremental
|
||||
//! // { unspecified_content };
|
||||
//! BOOST_INTRUSIVE_OPTION_CONSTANT(incremental, bool, Enabled, is_incremental)
|
||||
//!
|
||||
//! struct empty_default{};
|
||||
//!
|
||||
//! const bool is_incremental = pack_options< empty_default, incremental<true> >::type::is_incremental;
|
||||
//!
|
||||
//! BOOST_STATIC_ASSERT(( is_incremental == true ));
|
||||
//!
|
||||
//! \endcode
|
||||
#define BOOST_INTRUSIVE_OPTION_CONSTANT(OPTION_NAME, TYPE, VALUE, CONSTANT_NAME)
|
||||
|
||||
#endif //#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
|
||||
} //namespace intrusive {
|
||||
} //namespace boost {
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //#ifndef BOOST_INTRUSIVE_PACK_OPTIONS_HPP
|
||||
@@ -0,0 +1,85 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
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_SPIRIT_ACTOR_SWAP_ACTOR_HPP
|
||||
#define BOOST_SPIRIT_ACTOR_SWAP_ACTOR_HPP
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
#include <boost/spirit/home/classic/actor/ref_value_actor.hpp>
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Summary:
|
||||
// A semantic action policy that swaps values.
|
||||
// (This doc uses convention available in actors.hpp)
|
||||
//
|
||||
// Actions (what it does):
|
||||
// ref.swap( value_ref );
|
||||
//
|
||||
// Policy name:
|
||||
// swap_action
|
||||
//
|
||||
// Policy holder, corresponding helper method:
|
||||
// ref_value_actor, swap_a( ref );
|
||||
// ref_const_ref_actor, swap_a( ref, value_ref );
|
||||
//
|
||||
// () operators: both
|
||||
//
|
||||
// See also ref_value_actor and ref_const_ref_actor for more details.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template<
|
||||
typename T
|
||||
>
|
||||
class swap_actor
|
||||
{
|
||||
private:
|
||||
T& ref;
|
||||
T& swap_ref;
|
||||
|
||||
public:
|
||||
swap_actor(
|
||||
T& ref_,
|
||||
T& swap_ref_)
|
||||
: ref(ref_), swap_ref(swap_ref_)
|
||||
{};
|
||||
|
||||
template<typename T2>
|
||||
void operator()(T2 const& /*val*/) const
|
||||
{
|
||||
ref.swap(swap_ref);
|
||||
}
|
||||
|
||||
|
||||
template<typename IteratorT>
|
||||
void operator()(
|
||||
IteratorT const& /*first*/,
|
||||
IteratorT const& /*last*/
|
||||
) const
|
||||
{
|
||||
ref.swap(swap_ref);
|
||||
}
|
||||
};
|
||||
|
||||
template<
|
||||
typename T
|
||||
>
|
||||
inline swap_actor<T> swap_a(
|
||||
T& ref_,
|
||||
T& swap_ref_
|
||||
)
|
||||
{
|
||||
return swap_actor<T>(ref_,swap_ref_);
|
||||
}
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,34 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2009 Christopher Schmidt
|
||||
|
||||
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_FUSION_VIEW_REVERSE_VIEW_DETAIL_VALUE_AT_IMPL_HPP
|
||||
#define BOOST_FUSION_VIEW_REVERSE_VIEW_DETAIL_VALUE_AT_IMPL_HPP
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/value_at.hpp>
|
||||
#include <boost/mpl/minus.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
template <typename>
|
||||
struct value_at_impl;
|
||||
|
||||
template <>
|
||||
struct value_at_impl<reverse_view_tag>
|
||||
{
|
||||
template <typename Seq, typename N>
|
||||
struct apply
|
||||
: result_of::value_at<
|
||||
typename Seq::seq_type
|
||||
, mpl::minus<typename Seq::size, mpl::int_<1>, N>
|
||||
>
|
||||
{};
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
Copyright Rene Rivera 2011-2015
|
||||
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_PREDEF_OS_OS400_H
|
||||
#define BOOST_PREDEF_OS_OS400_H
|
||||
|
||||
#include <boost/predef/version_number.h>
|
||||
#include <boost/predef/make.h>
|
||||
|
||||
/*`
|
||||
[heading `BOOST_OS_OS400`]
|
||||
|
||||
[@http://en.wikipedia.org/wiki/IBM_i IBM OS/400] operating system.
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`__OS400__`] [__predef_detection__]]
|
||||
]
|
||||
*/
|
||||
|
||||
#define BOOST_OS_OS400 BOOST_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \
|
||||
defined(__OS400__) \
|
||||
)
|
||||
# undef BOOST_OS_OS400
|
||||
# define BOOST_OS_OS400 BOOST_VERSION_NUMBER_AVAILABLE
|
||||
#endif
|
||||
|
||||
#if BOOST_OS_OS400
|
||||
# define BOOST_OS_OS400_AVAILABLE
|
||||
# include <boost/predef/detail/os_detected.h>
|
||||
#endif
|
||||
|
||||
#define BOOST_OS_OS400_NAME "IBM OS/400"
|
||||
|
||||
#endif
|
||||
|
||||
#include <boost/predef/detail/test.h>
|
||||
BOOST_PREDEF_DECLARE_TEST(BOOST_OS_OS400,BOOST_OS_OS400_NAME)
|
||||
@@ -0,0 +1,49 @@
|
||||
// (C) Copyright 2009-2011 Frederic Bron.
|
||||
//
|
||||
// Use, modification and distribution are subject to 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).
|
||||
//
|
||||
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
|
||||
|
||||
#ifndef BOOST_TT_HAS_NOT_EQUAL_TO_HPP_INCLUDED
|
||||
#define BOOST_TT_HAS_NOT_EQUAL_TO_HPP_INCLUDED
|
||||
|
||||
#define BOOST_TT_TRAIT_NAME has_not_equal_to
|
||||
#define BOOST_TT_TRAIT_OP !=
|
||||
#define BOOST_TT_FORBIDDEN_IF\
|
||||
(\
|
||||
/* Lhs==pointer and Rhs==fundamental */\
|
||||
(\
|
||||
::boost::is_pointer< Lhs_noref >::value && \
|
||||
::boost::is_fundamental< Rhs_nocv >::value\
|
||||
) || \
|
||||
/* Rhs==pointer and Lhs==fundamental */\
|
||||
(\
|
||||
::boost::is_pointer< Rhs_noref >::value && \
|
||||
::boost::is_fundamental< Lhs_nocv >::value\
|
||||
) || \
|
||||
/* Lhs==pointer and Rhs==pointer and Lhs!=base(Rhs) and Rhs!=base(Lhs) and Lhs!=void* and Rhs!=void* */\
|
||||
(\
|
||||
::boost::is_pointer< Lhs_noref >::value && \
|
||||
::boost::is_pointer< Rhs_noref >::value && \
|
||||
(! \
|
||||
(\
|
||||
::boost::is_base_of< Lhs_noptr, Rhs_noptr >::value || \
|
||||
::boost::is_base_of< Rhs_noptr, Lhs_noptr >::value || \
|
||||
::boost::is_same< Lhs_noptr, Rhs_noptr >::value || \
|
||||
::boost::is_void< Lhs_noptr >::value || \
|
||||
::boost::is_void< Rhs_noptr >::value\
|
||||
)\
|
||||
)\
|
||||
)\
|
||||
)
|
||||
|
||||
|
||||
#include <boost/type_traits/detail/has_binary_operator.hpp>
|
||||
|
||||
#undef BOOST_TT_TRAIT_NAME
|
||||
#undef BOOST_TT_TRAIT_OP
|
||||
#undef BOOST_TT_FORBIDDEN_IF
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user