Initial Commit
This commit is contained in:
@@ -0,0 +1,221 @@
|
||||
// Boost result_of library
|
||||
|
||||
// Copyright Douglas Gregor 2004. 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)
|
||||
|
||||
// Copyright Daniel Walker, Eric Niebler, Michel Morin 2008-2012.
|
||||
// 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)
|
||||
|
||||
// For more information, see http://www.boost.org/libs/utility
|
||||
#if !defined(BOOST_PP_IS_ITERATING)
|
||||
# error Boost result_of - do not include this file!
|
||||
#endif
|
||||
|
||||
// CWPro8 requires an argument in a function type specialization
|
||||
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3002)) && BOOST_PP_ITERATION() == 0
|
||||
# define BOOST_RESULT_OF_ARGS void
|
||||
#else
|
||||
# define BOOST_RESULT_OF_ARGS BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)
|
||||
#endif
|
||||
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
|
||||
template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||
struct tr1_result_of<F(BOOST_RESULT_OF_ARGS)>
|
||||
: mpl::if_<
|
||||
mpl::or_< is_pointer<F>, is_member_function_pointer<F> >
|
||||
, boost::detail::tr1_result_of_impl<
|
||||
typename remove_cv<F>::type,
|
||||
typename remove_cv<F>::type(BOOST_RESULT_OF_ARGS),
|
||||
(boost::detail::has_result_type<F>::value)>
|
||||
, boost::detail::tr1_result_of_impl<
|
||||
F,
|
||||
F(BOOST_RESULT_OF_ARGS),
|
||||
(boost::detail::has_result_type<F>::value)> >::type { };
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_RESULT_OF_USE_DECLTYPE
|
||||
template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||
struct result_of<F(BOOST_RESULT_OF_ARGS)>
|
||||
: detail::cpp0x_result_of<F(BOOST_RESULT_OF_ARGS)> { };
|
||||
#endif // BOOST_RESULT_OF_USE_DECLTYPE
|
||||
|
||||
#ifdef BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK
|
||||
template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||
struct result_of<F(BOOST_RESULT_OF_ARGS)>
|
||||
: mpl::if_<mpl::or_<detail::has_result_type<F>, detail::has_result<F> >,
|
||||
tr1_result_of<F(BOOST_RESULT_OF_ARGS)>,
|
||||
detail::cpp0x_result_of<F(BOOST_RESULT_OF_ARGS)> >::type { };
|
||||
#endif // BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK
|
||||
|
||||
#if defined(BOOST_RESULT_OF_USE_DECLTYPE) || defined(BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK)
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||
struct cpp0x_result_of<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T))>
|
||||
: mpl::if_<
|
||||
is_member_function_pointer<F>
|
||||
, detail::tr1_result_of_impl<
|
||||
typename remove_cv<F>::type,
|
||||
typename remove_cv<F>::type(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), false
|
||||
>
|
||||
, detail::cpp0x_result_of_impl<
|
||||
F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T))
|
||||
>
|
||||
>::type
|
||||
{};
|
||||
|
||||
#ifdef BOOST_NO_SFINAE_EXPR
|
||||
|
||||
template<typename F>
|
||||
struct BOOST_PP_CAT(result_of_callable_fun_2_, BOOST_PP_ITERATION());
|
||||
|
||||
template<typename R BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), typename T)>
|
||||
struct BOOST_PP_CAT(result_of_callable_fun_2_, BOOST_PP_ITERATION())<R(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T))> {
|
||||
R operator()(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)) const;
|
||||
typedef result_of_private_type const &(*pfn_t)(...);
|
||||
operator pfn_t() const volatile;
|
||||
};
|
||||
|
||||
template<typename F>
|
||||
struct BOOST_PP_CAT(result_of_callable_fun_, BOOST_PP_ITERATION());
|
||||
|
||||
template<typename F>
|
||||
struct BOOST_PP_CAT(result_of_callable_fun_, BOOST_PP_ITERATION())<F *>
|
||||
: BOOST_PP_CAT(result_of_callable_fun_2_, BOOST_PP_ITERATION())<F>
|
||||
{};
|
||||
|
||||
template<typename F>
|
||||
struct BOOST_PP_CAT(result_of_callable_fun_, BOOST_PP_ITERATION())<F &>
|
||||
: BOOST_PP_CAT(result_of_callable_fun_2_, BOOST_PP_ITERATION())<F>
|
||||
{};
|
||||
|
||||
template<typename F>
|
||||
struct BOOST_PP_CAT(result_of_select_call_wrapper_type_, BOOST_PP_ITERATION())
|
||||
: mpl::eval_if<
|
||||
is_class<typename remove_reference<F>::type>,
|
||||
result_of_wrap_callable_class<F>,
|
||||
mpl::identity<BOOST_PP_CAT(result_of_callable_fun_, BOOST_PP_ITERATION())<typename remove_cv<F>::type> >
|
||||
>
|
||||
{};
|
||||
|
||||
template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), typename T)>
|
||||
struct BOOST_PP_CAT(result_of_is_callable_, BOOST_PP_ITERATION()) {
|
||||
typedef typename BOOST_PP_CAT(result_of_select_call_wrapper_type_, BOOST_PP_ITERATION())<F>::type wrapper_t;
|
||||
static const bool value = (
|
||||
sizeof(result_of_no_type) == sizeof(detail::result_of_is_private_type(
|
||||
(boost::declval<wrapper_t>()(BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), boost::declval<T, >() BOOST_PP_INTERCEPT)), result_of_weird_type())
|
||||
))
|
||||
);
|
||||
typedef mpl::bool_<value> type;
|
||||
};
|
||||
|
||||
template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||
struct cpp0x_result_of_impl<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), true>
|
||||
: lazy_enable_if<
|
||||
BOOST_PP_CAT(result_of_is_callable_, BOOST_PP_ITERATION())<F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), T)>
|
||||
, cpp0x_result_of_impl<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), false>
|
||||
>
|
||||
{};
|
||||
|
||||
template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||
struct cpp0x_result_of_impl<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), false>
|
||||
{
|
||||
typedef decltype(
|
||||
boost::declval<F>()(
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), boost::declval<T, >() BOOST_PP_INTERCEPT)
|
||||
)
|
||||
) type;
|
||||
};
|
||||
|
||||
#else // BOOST_NO_SFINAE_EXPR
|
||||
|
||||
template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||
struct cpp0x_result_of_impl<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)),
|
||||
typename result_of_always_void<decltype(
|
||||
boost::declval<F>()(
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), boost::declval<T, >() BOOST_PP_INTERCEPT)
|
||||
)
|
||||
)>::type> {
|
||||
typedef decltype(
|
||||
boost::declval<F>()(
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), boost::declval<T, >() BOOST_PP_INTERCEPT)
|
||||
)
|
||||
) type;
|
||||
};
|
||||
|
||||
#endif // BOOST_NO_SFINAE_EXPR
|
||||
|
||||
} // namespace detail
|
||||
|
||||
#else // defined(BOOST_RESULT_OF_USE_DECLTYPE) || defined(BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK)
|
||||
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
|
||||
template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||
struct result_of<F(BOOST_RESULT_OF_ARGS)>
|
||||
: tr1_result_of<F(BOOST_RESULT_OF_ARGS)> { };
|
||||
#endif
|
||||
|
||||
#endif // defined(BOOST_RESULT_OF_USE_DECLTYPE)
|
||||
|
||||
#undef BOOST_RESULT_OF_ARGS
|
||||
|
||||
#if BOOST_PP_ITERATION() >= 1
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<typename R, typename FArgs BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||
struct tr1_result_of_impl<R (*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), FArgs, false>
|
||||
{
|
||||
typedef R type;
|
||||
};
|
||||
|
||||
template<typename R, typename FArgs BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||
struct tr1_result_of_impl<R (&)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), FArgs, false>
|
||||
{
|
||||
typedef R type;
|
||||
};
|
||||
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
|
||||
template<typename R, typename FArgs BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||
struct tr1_result_of_impl<R (T0::*)
|
||||
(BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T)),
|
||||
FArgs, false>
|
||||
{
|
||||
typedef R type;
|
||||
};
|
||||
|
||||
template<typename R, typename FArgs BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||
struct tr1_result_of_impl<R (T0::*)
|
||||
(BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T))
|
||||
const,
|
||||
FArgs, false>
|
||||
{
|
||||
typedef R type;
|
||||
};
|
||||
|
||||
template<typename R, typename FArgs BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||
struct tr1_result_of_impl<R (T0::*)
|
||||
(BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T))
|
||||
volatile,
|
||||
FArgs, false>
|
||||
{
|
||||
typedef R type;
|
||||
};
|
||||
|
||||
template<typename R, typename FArgs BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||
struct tr1_result_of_impl<R (T0::*)
|
||||
(BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T))
|
||||
const volatile,
|
||||
FArgs, false>
|
||||
{
|
||||
typedef R type;
|
||||
};
|
||||
#endif
|
||||
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,27 @@
|
||||
// -*- Mode: C++ -*-
|
||||
#ifndef SIGNALMETER_H
|
||||
#define SIGNALMETER_H
|
||||
|
||||
#include <QFrame>
|
||||
|
||||
class QLabel;
|
||||
class MeterWidget;
|
||||
|
||||
class SignalMeter final
|
||||
: public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SignalMeter (QWidget * parent = nullptr);
|
||||
|
||||
public slots:
|
||||
void setValue (float value, float valueMax);
|
||||
|
||||
private:
|
||||
MeterWidget * m_meter;
|
||||
QWidget * m_scale;
|
||||
QLabel * m_reading;
|
||||
};
|
||||
|
||||
#endif // SIGNALMETER_H
|
||||
@@ -0,0 +1,218 @@
|
||||
// Copyright (C) 2004 Arkadiy Vertleyb
|
||||
// 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_TYPEOF_TYPEOF_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_TYPEOF_HPP_INCLUDED
|
||||
|
||||
#if defined(BOOST_TYPEOF_COMPLIANT)
|
||||
# define BOOST_TYPEOF_EMULATION
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_TYPEOF_EMULATION) && defined(BOOST_TYPEOF_NATIVE)
|
||||
# error both typeof emulation and native mode requested
|
||||
#endif
|
||||
|
||||
#if defined(__COMO__)
|
||||
# ifdef __GNUG__
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
# ifndef BOOST_TYPEOF_NATIVE
|
||||
# define BOOST_TYPEOF_NATIVE
|
||||
# endif
|
||||
# define BOOST_TYPEOF_KEYWORD typeof
|
||||
# endif
|
||||
# else
|
||||
# ifndef BOOST_TYPEOF_NATIVE
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
# define BOOST_TYPEOF_EMULATION
|
||||
# endif
|
||||
# else
|
||||
# error native typeof is not supported
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#elif defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)
|
||||
# ifdef __GNUC__
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
# ifndef BOOST_TYPEOF_NATIVE
|
||||
# define BOOST_TYPEOF_NATIVE
|
||||
# endif
|
||||
# define BOOST_TYPEOF_KEYWORD __typeof__
|
||||
# endif
|
||||
# else
|
||||
# ifndef BOOST_TYPEOF_NATIVE
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
# define BOOST_TYPEOF_EMULATION
|
||||
# endif
|
||||
# else
|
||||
# error native typeof is not supported
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
# ifndef BOOST_TYPEOF_NATIVE
|
||||
# define BOOST_TYPEOF_NATIVE
|
||||
# endif
|
||||
# define BOOST_TYPEOF_KEYWORD __typeof__
|
||||
# endif
|
||||
|
||||
#elif defined(__MWERKS__)
|
||||
# if(__MWERKS__ <= 0x3003) // 8.x
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
# ifndef BOOST_TYPEOF_NATIVE
|
||||
# define BOOST_TYPEOF_NATIVE
|
||||
# endif
|
||||
# define BOOST_TYPEOF_KEYWORD __typeof__
|
||||
# else
|
||||
# define BOOST_TYPEOF_EMULATION_UNSUPPORTED
|
||||
# endif
|
||||
# else // 9.x
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
# ifndef BOOST_TYPEOF_NATIVE
|
||||
# define BOOST_TYPEOF_NATIVE
|
||||
# endif
|
||||
# define BOOST_TYPEOF_KEYWORD __typeof__
|
||||
# endif
|
||||
# endif
|
||||
#elif defined __CODEGEARC__
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
# ifndef BOOST_TYPEOF_NATIVE
|
||||
# define BOOST_TYPEOF_EMULATION_UNSUPPORTED
|
||||
# endif
|
||||
# else
|
||||
# define BOOST_TYPEOF_EMULATION_UNSUPPORTED
|
||||
# endif
|
||||
#elif defined __BORLANDC__
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
# ifndef BOOST_TYPEOF_NATIVE
|
||||
# define BOOST_TYPEOF_EMULATION_UNSUPPORTED
|
||||
# endif
|
||||
# else
|
||||
# define BOOST_TYPEOF_EMULATION_UNSUPPORTED
|
||||
# endif
|
||||
#elif defined __DMC__
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
# ifndef BOOST_TYPEOF_NATIVE
|
||||
# define BOOST_TYPEOF_NATIVE
|
||||
# endif
|
||||
# include <boost/typeof/dmc/typeof_impl.hpp>
|
||||
# define MSVC_TYPEOF_HACK
|
||||
# endif
|
||||
#elif defined(_MSC_VER)
|
||||
# if (_MSC_VER <= 1300) // 6.5, 7.0
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
# ifndef BOOST_TYPEOF_NATIVE
|
||||
# define BOOST_TYPEOF_NATIVE
|
||||
# endif
|
||||
# include <boost/typeof/msvc/typeof_impl.hpp>
|
||||
# define MSVC_TYPEOF_HACK
|
||||
# else
|
||||
# error typeof emulation is not supported
|
||||
# endif
|
||||
# elif (_MSC_VER >= 1310) // 7.1 ->
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
# ifndef BOOST_TYPEOF_NATIVE
|
||||
# ifndef _MSC_EXTENSIONS
|
||||
# define BOOST_TYPEOF_EMULATION
|
||||
# else
|
||||
# define BOOST_TYPEOF_NATIVE
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# ifdef BOOST_TYPEOF_NATIVE
|
||||
# include <boost/typeof/msvc/typeof_impl.hpp>
|
||||
# define MSVC_TYPEOF_HACK
|
||||
# endif
|
||||
# endif
|
||||
#elif defined(__HP_aCC)
|
||||
# ifndef BOOST_TYPEOF_NATIVE
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
# define BOOST_TYPEOF_EMULATION
|
||||
# endif
|
||||
# else
|
||||
# error native typeof is not supported
|
||||
# endif
|
||||
|
||||
#elif defined(__DECCXX)
|
||||
# ifndef BOOST_TYPEOF_NATIVE
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
# define BOOST_TYPEOF_EMULATION
|
||||
# endif
|
||||
# else
|
||||
# error native typeof is not supported
|
||||
# endif
|
||||
|
||||
#elif defined(__BORLANDC__)
|
||||
# if (__BORLANDC__ < 0x590)
|
||||
# define BOOST_TYPEOF_NO_FUNCTION_TYPES
|
||||
# define BOOST_TYPEOF_NO_MEMBER_FUNCTION_TYPES
|
||||
# endif
|
||||
# ifndef BOOST_TYPEOF_NATIVE
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
# define BOOST_TYPEOF_EMULATION
|
||||
# endif
|
||||
# else
|
||||
# error native typeof is not supported
|
||||
# endif
|
||||
#elif defined(__SUNPRO_CC)
|
||||
# if (__SUNPRO_CC < 0x590 )
|
||||
# ifdef BOOST_TYPEOF_NATIVE
|
||||
# error native typeof is not supported
|
||||
# endif
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
# define BOOST_TYPEOF_EMULATION
|
||||
# endif
|
||||
# else
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
# ifndef BOOST_TYPEOF_NATIVE
|
||||
# define BOOST_TYPEOF_NATIVE
|
||||
# endif
|
||||
# define BOOST_TYPEOF_KEYWORD __typeof__
|
||||
# endif
|
||||
# endif
|
||||
#else //unknown compiler
|
||||
# ifndef BOOST_TYPEOF_NATIVE
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
# define BOOST_TYPEOF_EMULATION
|
||||
# endif
|
||||
# else
|
||||
# ifndef BOOST_TYPEOF_KEYWORD
|
||||
# define BOOST_TYPEOF_KEYWORD typeof
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
#define BOOST_TYPEOF_UNIQUE_ID()\
|
||||
BOOST_TYPEOF_REGISTRATION_GROUP * 0x10000 + __LINE__
|
||||
|
||||
#define BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()\
|
||||
<boost/typeof/incr_registration_group.hpp>
|
||||
|
||||
#ifdef BOOST_TYPEOF_EMULATION_UNSUPPORTED
|
||||
# include <boost/typeof/unsupported.hpp>
|
||||
#elif defined BOOST_TYPEOF_EMULATION
|
||||
# define BOOST_TYPEOF_TEXT "using typeof emulation"
|
||||
# include <boost/typeof/message.hpp>
|
||||
# include <boost/typeof/typeof_impl.hpp>
|
||||
# include <boost/typeof/type_encoding.hpp>
|
||||
# include <boost/typeof/template_encoding.hpp>
|
||||
# include <boost/typeof/modifiers.hpp>
|
||||
# include <boost/typeof/pointers_data_members.hpp>
|
||||
# include <boost/typeof/register_functions.hpp>
|
||||
# include <boost/typeof/register_fundamental.hpp>
|
||||
|
||||
#elif defined(BOOST_TYPEOF_NATIVE)
|
||||
# define BOOST_TYPEOF_TEXT "using native typeof"
|
||||
# include <boost/typeof/message.hpp>
|
||||
# include <boost/typeof/native.hpp>
|
||||
#else
|
||||
# error typeof configuration error
|
||||
#endif
|
||||
|
||||
// auto
|
||||
#define BOOST_AUTO(Var, Expr) BOOST_TYPEOF(Expr) Var = Expr
|
||||
#define BOOST_AUTO_TPL(Var, Expr) BOOST_TYPEOF_TPL(Expr) Var = Expr
|
||||
|
||||
#endif//BOOST_TYPEOF_TYPEOF_HPP_INCLUDED
|
||||
@@ -0,0 +1,37 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// Copyright (c) 2013-2014 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_DETAIL_WORK_SIZE_HPP
|
||||
#define BOOST_COMPUTE_DETAIL_WORK_SIZE_HPP
|
||||
|
||||
#include <cmath>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
namespace detail {
|
||||
|
||||
// Given a total number of values (count), a number of values to
|
||||
// process per thread (vtp), and a number of threads to execute per
|
||||
// block (tpb), this function returns the global work size to be
|
||||
// passed to clEnqueueNDRangeKernel() for a 1D algorithm.
|
||||
inline size_t calculate_work_size(size_t count, size_t vpt, size_t tpb)
|
||||
{
|
||||
size_t work_size = static_cast<size_t>(std::ceil(float(count) / vpt));
|
||||
if(work_size % tpb != 0){
|
||||
work_size += tpb - work_size % tpb;
|
||||
}
|
||||
return work_size;
|
||||
}
|
||||
|
||||
} // end detail namespace
|
||||
} // end compute namespace
|
||||
} // end boost namespace
|
||||
|
||||
#endif // BOOST_COMPUTE_DETAIL_WORK_SIZE_HPP
|
||||
@@ -0,0 +1,46 @@
|
||||
#ifndef BOOST_SERIALIZATION_STRONG_TYPEDEF_HPP
|
||||
#define BOOST_SERIALIZATION_STRONG_TYPEDEF_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// strong_typedef.hpp:
|
||||
|
||||
// (C) Copyright 2002 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.
|
||||
|
||||
// macro used to implement a strong typedef. strong typedef
|
||||
// guarentees that two types are distinguised even though the
|
||||
// share the same underlying implementation. typedef does not create
|
||||
// a new type. BOOST_STRONG_TYPEDEF(T, D) creates a new type named D
|
||||
// that operates as a type T.
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/operators.hpp>
|
||||
|
||||
#define BOOST_STRONG_TYPEDEF(T, D) \
|
||||
struct D \
|
||||
: boost::totally_ordered1< D \
|
||||
, boost::totally_ordered2< D, T \
|
||||
> > \
|
||||
{ \
|
||||
T t; \
|
||||
explicit D(const T t_) : t(t_) {}; \
|
||||
D(): t() {}; \
|
||||
D(const D & t_) : t(t_.t){} \
|
||||
D & operator=(const D & rhs) { t = rhs.t; return *this;} \
|
||||
D & operator=(const T & rhs) { t = rhs; return *this;} \
|
||||
operator const T & () const {return t; } \
|
||||
operator T & () { return t; } \
|
||||
bool operator==(const D & rhs) const { return t == rhs.t; } \
|
||||
bool operator<(const D & rhs) const { return t < rhs.t; } \
|
||||
};
|
||||
|
||||
#endif // BOOST_SERIALIZATION_STRONG_TYPEDEF_HPP
|
||||
@@ -0,0 +1,262 @@
|
||||
module timer_impl
|
||||
!$ use omp_lib
|
||||
use :: iso_c_binding, only: c_ptr
|
||||
use timer_module, only: timer_callback
|
||||
implicit none
|
||||
|
||||
public :: init_timer, fini_timer
|
||||
integer, public :: limtrace=0
|
||||
|
||||
private
|
||||
|
||||
integer, parameter :: MAXCALL=100
|
||||
integer :: lu=6
|
||||
real :: dut
|
||||
integer :: i,nmax=0,ncall(MAXCALL),nlevel(MAXCALL),nparent(MAXCALL)
|
||||
character(len=8) :: name(MAXCALL),space=' '
|
||||
logical :: on(MAXCALL)
|
||||
real :: total,sum,sumf,ut(MAXCALL),ut0(MAXCALL)
|
||||
!$ integer :: j,l,m,ntid(MAXCALL)
|
||||
|
||||
!
|
||||
! C interoperable callback setup
|
||||
!
|
||||
public :: C_init_timer
|
||||
abstract interface
|
||||
subroutine C_timer_callback (context, dname, k)
|
||||
use, intrinsic :: iso_c_binding, only: c_ptr
|
||||
implicit none
|
||||
type(c_ptr), intent(in) :: context
|
||||
character(len=8), intent(in) :: dname
|
||||
integer, intent(in) :: k
|
||||
end subroutine C_timer_callback
|
||||
end interface
|
||||
type(c_ptr), private :: the_context
|
||||
procedure(C_timer_callback), pointer, private :: the_C_callback
|
||||
|
||||
contains
|
||||
subroutine timer_callback_wrapper (dname, k)
|
||||
implicit none
|
||||
character(len=8), intent(in) :: dname
|
||||
integer, intent(in) :: k
|
||||
call the_C_callback (the_context, dname, k)
|
||||
end subroutine timer_callback_wrapper
|
||||
|
||||
subroutine C_init_timer (context, callback) bind(C)
|
||||
use, intrinsic :: iso_c_binding, only: c_ptr, c_funptr, c_f_procpointer
|
||||
use iso_c_utilities, only: c_to_f_string
|
||||
use timer_module, only: timer
|
||||
implicit none
|
||||
type(c_ptr), intent(in) :: context
|
||||
type(c_funptr), intent(in) :: callback
|
||||
the_context=context
|
||||
call c_f_procpointer (callback, the_C_callback)
|
||||
timer => timer_callback_wrapper
|
||||
end subroutine C_init_timer
|
||||
|
||||
!
|
||||
! default Fortran implementation which is thread safe using OpenMP
|
||||
!
|
||||
subroutine default_timer (dname, k)
|
||||
|
||||
! Times procedure number n between a call with k=0 (tstart) and with
|
||||
! k=1 (tstop). Accumulates sums of these times in array ut (user time).
|
||||
! Also traces all calls (for debugging purposes) if limtrace.gt.0
|
||||
!
|
||||
! If this is used with OpenMP than the /timer_private/ common
|
||||
! block must be copyed into each thread of a thread team by using
|
||||
! the copyin() clause on the !$omp parallel directive that creates
|
||||
! the team.
|
||||
|
||||
implicit none
|
||||
|
||||
character(len=8), intent(in) :: dname
|
||||
integer, intent(in) :: k
|
||||
|
||||
real :: ut1,eps=0.000001
|
||||
integer :: n,ndiv,ntrace=0
|
||||
!$ integer :: tid
|
||||
character(len=8) :: tname
|
||||
include 'timer_common.inc'
|
||||
|
||||
!$omp critical(timer)
|
||||
if(limtrace.lt.0) go to 999
|
||||
if(k.gt.1) go to 40 !Check for "all done" (k>1)
|
||||
onlevel(0)=0
|
||||
|
||||
!$ tid=omp_get_thread_num()
|
||||
do n=1,nmax !Check for existing name/parent[/thread]
|
||||
if(name(n).eq.dname &
|
||||
!$ .and.ntid(n).eq.tid &
|
||||
) then
|
||||
if (on(n)) then
|
||||
if (nparent(n).eq.onlevel(level-1)) goto 20
|
||||
else
|
||||
if (nparent(n).eq.onlevel(level)) goto 20
|
||||
end if
|
||||
end if
|
||||
enddo
|
||||
|
||||
nmax=nmax+1 !This is a new one
|
||||
n=nmax
|
||||
!$ ntid(n)=tid
|
||||
ncall(n)=0
|
||||
on(n)=.false.
|
||||
ut(n)=eps
|
||||
name(n)=dname
|
||||
|
||||
20 if(k.eq.0) then !Get start times (k=0)
|
||||
if(on(n)) then
|
||||
print*,'Error in timer: ',dname,' already on.'
|
||||
end if
|
||||
level=level+1 !Increment the level
|
||||
on(n)=.true.
|
||||
! call system_clock(icount,irate)
|
||||
! ut0(n)=float(icount)/irate
|
||||
! call cpu_time(ut0(n))
|
||||
ut0(n)=secnds(0.0)
|
||||
|
||||
ncall(n)=ncall(n)+1
|
||||
if(ncall(n).gt.1.and.nlevel(n).ne.level) then
|
||||
!recursion is happening
|
||||
!
|
||||
!TODO: somehow need to account for this deeper call at the
|
||||
!shallowest instance in the call chain and this needs to be
|
||||
!done without incrementing anything here other than counters
|
||||
!and timers
|
||||
!
|
||||
nlevel(n)=-1
|
||||
else
|
||||
nlevel(n)=level
|
||||
endif
|
||||
nparent(n)=onlevel(level-1)
|
||||
onlevel(level)=n
|
||||
|
||||
else if(k.eq.1) then !Get stop times and accumulate sums. (k=1)
|
||||
if(on(n)) then
|
||||
on(n)=.false.
|
||||
! call system_clock(icount,irate)
|
||||
! ut1=float(icount)/irate
|
||||
! call cpu_time(ut1)
|
||||
ut1=secnds(0.0)
|
||||
|
||||
ut(n)=ut(n)+ut1-ut0(n)
|
||||
endif
|
||||
level=level-1
|
||||
endif
|
||||
|
||||
ntrace=ntrace+1
|
||||
if(ntrace.lt.limtrace) write(lu,1020) ntrace,tname,k,level,nparent(n)
|
||||
1020 format(i8,': ',a8,3i5)
|
||||
go to 998
|
||||
|
||||
! Write out the timer statistics
|
||||
|
||||
40 write(lu,1040)
|
||||
1040 format(/' Name Time Frac dTime', &
|
||||
' dFrac Calls'/58('-'))
|
||||
|
||||
!$ !walk backwards through the database rolling up thread data by call chain
|
||||
!$ do i=nmax,1,-1
|
||||
!$ do j=1,i-1
|
||||
!$ l=j
|
||||
!$ m=i
|
||||
!$ do while (name(l).eq.name(m))
|
||||
!$ l=nparent(l)
|
||||
!$ m=nparent(m)
|
||||
!$ if (l.eq.0.or.m.eq.0) exit
|
||||
!$ end do
|
||||
!$ if (l.eq.0.and.m.eq.0) then
|
||||
!$ !same call chain so roll up data
|
||||
!$ ncall(j)=ncall(j)+ncall(i)
|
||||
!$ ut(j)=ut(j)+ut(i)
|
||||
!$ do n=1,nmax
|
||||
!$ if (nparent(n).eq.i) nparent(n)=j
|
||||
!$ end do
|
||||
!$ name(i)=space
|
||||
!$ exit
|
||||
!$ end if
|
||||
!$ end do
|
||||
!$ end do
|
||||
|
||||
if(k.gt.100) then
|
||||
ndiv=k-100
|
||||
do i=1,nmax
|
||||
ncall(i)=ncall(i)/ndiv
|
||||
ut(i)=ut(i)/ndiv
|
||||
enddo
|
||||
endif
|
||||
|
||||
total=ut(1)
|
||||
sum=0.
|
||||
sumf=0.
|
||||
call print_root(1)
|
||||
write(lu,1070) sum,sumf
|
||||
1070 format(58('-')/32x,f10.3,f6.2)
|
||||
nmax=0
|
||||
eps=0.000001
|
||||
ntrace=0
|
||||
level=0
|
||||
onlevel(0)=0
|
||||
|
||||
998 flush(lu)
|
||||
|
||||
999 continue
|
||||
|
||||
!$omp end critical(timer)
|
||||
return
|
||||
end subroutine default_timer
|
||||
|
||||
recursive subroutine print_root(i)
|
||||
implicit none
|
||||
integer, intent(in) :: i
|
||||
character(len=16) :: sname
|
||||
real :: dutf, utf
|
||||
integer :: j, kk
|
||||
|
||||
if (i.le.nmax) then
|
||||
if (name(i).ne.space) then
|
||||
dut=ut(i)
|
||||
do j=i,nmax
|
||||
if (name(j).ne.space.and.nparent(j).eq.i) dut=dut-ut(j)
|
||||
enddo
|
||||
if(dut.lt.0.0) dut=0.0
|
||||
utf=ut(i)/total
|
||||
dutf=dut/total
|
||||
sum=sum+dut
|
||||
sumf=sumf+dutf
|
||||
kk=nlevel(i)
|
||||
sname=space(1:kk)//name(i)//space(1:8-kk)
|
||||
write(lu,2000) sname,ut(i),utf,dut,dutf,ncall(i)
|
||||
2000 format(a16,2(f10.3,f6.2),i9)
|
||||
do j=i,nmax
|
||||
if(nparent(j).eq.i) call print_root(j)
|
||||
enddo
|
||||
end if
|
||||
end if
|
||||
return
|
||||
end subroutine print_root
|
||||
|
||||
subroutine init_timer (filename)
|
||||
use, intrinsic :: iso_c_binding, only: c_char
|
||||
use timer_module, only: timer
|
||||
implicit none
|
||||
character(len=*), optional, intent(in) :: filename
|
||||
include 'timer_common.inc'
|
||||
data level/0/, onlevel/11 * 0/
|
||||
if (present (filename)) then
|
||||
open (newunit=lu, file=filename, status='unknown')
|
||||
else
|
||||
open (newunit=lu, file='timer.out', status='unknown')
|
||||
end if
|
||||
timer => default_timer
|
||||
end subroutine init_timer
|
||||
|
||||
subroutine fini_timer ()
|
||||
use timer_module, only: timer, null_timer
|
||||
implicit none
|
||||
timer => null_timer
|
||||
close (lu)
|
||||
end subroutine fini_timer
|
||||
|
||||
end module timer_impl
|
||||
@@ -0,0 +1,68 @@
|
||||
# /* 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_REPETITION_ENUM_SHIFTED_HPP
|
||||
# define BOOST_PREPROCESSOR_REPETITION_ENUM_SHIFTED_HPP
|
||||
#
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
# include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
# include <boost/preprocessor/arithmetic/inc.hpp>
|
||||
# include <boost/preprocessor/config/config.hpp>
|
||||
# include <boost/preprocessor/debug/error.hpp>
|
||||
# include <boost/preprocessor/detail/auto_rec.hpp>
|
||||
# include <boost/preprocessor/punctuation/comma_if.hpp>
|
||||
# include <boost/preprocessor/repetition/repeat.hpp>
|
||||
# include <boost/preprocessor/tuple/elem.hpp>
|
||||
# include <boost/preprocessor/tuple/rem.hpp>
|
||||
#
|
||||
# /* BOOST_PP_ENUM_SHIFTED */
|
||||
#
|
||||
# if 0
|
||||
# define BOOST_PP_ENUM_SHIFTED(count, macro, data)
|
||||
# endif
|
||||
#
|
||||
# define BOOST_PP_ENUM_SHIFTED BOOST_PP_CAT(BOOST_PP_ENUM_SHIFTED_, BOOST_PP_AUTO_REC(BOOST_PP_REPEAT_P, 4))
|
||||
#
|
||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
|
||||
# define BOOST_PP_ENUM_SHIFTED_1(c, m, d) BOOST_PP_REPEAT_1(BOOST_PP_DEC(c), BOOST_PP_ENUM_SHIFTED_M_1, (m, d))
|
||||
# define BOOST_PP_ENUM_SHIFTED_2(c, m, d) BOOST_PP_REPEAT_2(BOOST_PP_DEC(c), BOOST_PP_ENUM_SHIFTED_M_2, (m, d))
|
||||
# define BOOST_PP_ENUM_SHIFTED_3(c, m, d) BOOST_PP_REPEAT_3(BOOST_PP_DEC(c), BOOST_PP_ENUM_SHIFTED_M_3, (m, d))
|
||||
# else
|
||||
# define BOOST_PP_ENUM_SHIFTED_1(c, m, d) BOOST_PP_ENUM_SHIFTED_1_I(c, m, d)
|
||||
# define BOOST_PP_ENUM_SHIFTED_2(c, m, d) BOOST_PP_ENUM_SHIFTED_1_2(c, m, d)
|
||||
# define BOOST_PP_ENUM_SHIFTED_3(c, m, d) BOOST_PP_ENUM_SHIFTED_1_3(c, m, d)
|
||||
# define BOOST_PP_ENUM_SHIFTED_1_I(c, m, d) BOOST_PP_REPEAT_1(BOOST_PP_DEC(c), BOOST_PP_ENUM_SHIFTED_M_1, (m, d))
|
||||
# define BOOST_PP_ENUM_SHIFTED_2_I(c, m, d) BOOST_PP_REPEAT_2(BOOST_PP_DEC(c), BOOST_PP_ENUM_SHIFTED_M_2, (m, d))
|
||||
# define BOOST_PP_ENUM_SHIFTED_3_I(c, m, d) BOOST_PP_REPEAT_3(BOOST_PP_DEC(c), BOOST_PP_ENUM_SHIFTED_M_3, (m, d))
|
||||
# endif
|
||||
#
|
||||
# define BOOST_PP_ENUM_SHIFTED_4(c, m, d) BOOST_PP_ERROR(0x0003)
|
||||
#
|
||||
# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
|
||||
# define BOOST_PP_ENUM_SHIFTED_M_1(z, n, md) BOOST_PP_ENUM_SHIFTED_M_1_IM(z, n, BOOST_PP_TUPLE_REM_2 md)
|
||||
# define BOOST_PP_ENUM_SHIFTED_M_2(z, n, md) BOOST_PP_ENUM_SHIFTED_M_2_IM(z, n, BOOST_PP_TUPLE_REM_2 md)
|
||||
# define BOOST_PP_ENUM_SHIFTED_M_3(z, n, md) BOOST_PP_ENUM_SHIFTED_M_3_IM(z, n, BOOST_PP_TUPLE_REM_2 md)
|
||||
# define BOOST_PP_ENUM_SHIFTED_M_1_IM(z, n, im) BOOST_PP_ENUM_SHIFTED_M_1_I(z, n, im)
|
||||
# define BOOST_PP_ENUM_SHIFTED_M_2_IM(z, n, im) BOOST_PP_ENUM_SHIFTED_M_2_I(z, n, im)
|
||||
# define BOOST_PP_ENUM_SHIFTED_M_3_IM(z, n, im) BOOST_PP_ENUM_SHIFTED_M_3_I(z, n, im)
|
||||
# else
|
||||
# define BOOST_PP_ENUM_SHIFTED_M_1(z, n, md) BOOST_PP_ENUM_SHIFTED_M_1_I(z, n, BOOST_PP_TUPLE_ELEM(2, 0, md), BOOST_PP_TUPLE_ELEM(2, 1, md))
|
||||
# define BOOST_PP_ENUM_SHIFTED_M_2(z, n, md) BOOST_PP_ENUM_SHIFTED_M_2_I(z, n, BOOST_PP_TUPLE_ELEM(2, 0, md), BOOST_PP_TUPLE_ELEM(2, 1, md))
|
||||
# define BOOST_PP_ENUM_SHIFTED_M_3(z, n, md) BOOST_PP_ENUM_SHIFTED_M_3_I(z, n, BOOST_PP_TUPLE_ELEM(2, 0, md), BOOST_PP_TUPLE_ELEM(2, 1, md))
|
||||
# endif
|
||||
#
|
||||
# define BOOST_PP_ENUM_SHIFTED_M_1_I(z, n, m, d) BOOST_PP_COMMA_IF(n) m(z, BOOST_PP_INC(n), d)
|
||||
# define BOOST_PP_ENUM_SHIFTED_M_2_I(z, n, m, d) BOOST_PP_COMMA_IF(n) m(z, BOOST_PP_INC(n), d)
|
||||
# define BOOST_PP_ENUM_SHIFTED_M_3_I(z, n, m, d) BOOST_PP_COMMA_IF(n) m(z, BOOST_PP_INC(n), d)
|
||||
#
|
||||
# endif
|
||||
@@ -0,0 +1,97 @@
|
||||
// Copyright 2005 Daniel Wallin.
|
||||
// Copyright 2005 Joel de Guzman.
|
||||
// Copyright 2005 Dan Marsden.
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
// Modeled after range_ex, Copyright 2004 Eric Niebler
|
||||
|
||||
#ifndef BOOST_PHOENIX_ALGORITHM_ITERATION_HPP
|
||||
#define BOOST_PHOENIX_ALGORITHM_ITERATION_HPP
|
||||
|
||||
#include <algorithm>
|
||||
#include <numeric>
|
||||
|
||||
#include <boost/phoenix/stl/algorithm/detail/begin.hpp>
|
||||
#include <boost/phoenix/stl/algorithm/detail/end.hpp>
|
||||
|
||||
#include <boost/phoenix/function/adapt_callable.hpp>
|
||||
|
||||
namespace boost { namespace phoenix {
|
||||
namespace impl
|
||||
{
|
||||
struct for_each
|
||||
{
|
||||
template <typename Sig>
|
||||
struct result;
|
||||
|
||||
template<typename This, class R, class F>
|
||||
struct result<This(R&, F)>
|
||||
: result<This(R&, F const &)>
|
||||
{};
|
||||
|
||||
template<typename This, class R, class F>
|
||||
struct result<This(R&, F &)>
|
||||
{
|
||||
typedef F type;
|
||||
};
|
||||
|
||||
template<class R, class F>
|
||||
F const operator()(R& r, F const& fn) const
|
||||
{
|
||||
return std::for_each(detail::begin_(r), detail::end_(r), fn);
|
||||
}
|
||||
};
|
||||
|
||||
struct accumulate
|
||||
{
|
||||
template <typename Sig>
|
||||
struct result;
|
||||
|
||||
template<typename This, class R, class I>
|
||||
struct result<This(R&, I)>
|
||||
: result<This(R&, I const &)>
|
||||
{};
|
||||
|
||||
template<typename This, class R, class I>
|
||||
struct result<This(R&, I &)>
|
||||
{
|
||||
typedef I type;
|
||||
};
|
||||
|
||||
template<typename This, class R, class I, class C>
|
||||
struct result<This(R&, I, C)>
|
||||
: result<This(R&, I const &, C)>
|
||||
{};
|
||||
|
||||
template<typename This, class R, class I, class C>
|
||||
struct result<This(R&, I &, C)>
|
||||
{
|
||||
typedef I type;
|
||||
};
|
||||
|
||||
template<class R, class I>
|
||||
I
|
||||
operator()(R& r, I i) const
|
||||
{
|
||||
return std::accumulate(detail::begin_(r), detail::end_(r), i);
|
||||
}
|
||||
|
||||
template<class R, class I, class C>
|
||||
I
|
||||
operator()(R& r, I i, C c) const
|
||||
{
|
||||
return std::accumulate(detail::begin_(r), detail::end_(r), i, c);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
BOOST_PHOENIX_ADAPT_CALLABLE(for_each, impl::for_each, 2)
|
||||
BOOST_PHOENIX_ADAPT_CALLABLE(accumulate, impl::accumulate, 2)
|
||||
BOOST_PHOENIX_ADAPT_CALLABLE(accumulate, impl::accumulate, 3)
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,40 @@
|
||||
/*=============================================================================
|
||||
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_INSERT_RANGE_10022005_1838)
|
||||
#define FUSION_INSERT_RANGE_10022005_1838
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/mpl/insert_range.hpp>
|
||||
#include <boost/fusion/support/tag_of.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/insert_range.hpp>
|
||||
#include <boost/fusion/sequence/convert.hpp>
|
||||
|
||||
namespace boost { namespace mpl
|
||||
{
|
||||
template <typename Tag>
|
||||
struct insert_range_impl;
|
||||
|
||||
template <>
|
||||
struct insert_range_impl<fusion::fusion_sequence_tag>
|
||||
{
|
||||
template <typename Sequence, typename Pos, typename Range>
|
||||
struct apply
|
||||
{
|
||||
typedef typename
|
||||
fusion::result_of::insert_range<Sequence, Pos, Range>::type
|
||||
result;
|
||||
|
||||
typedef typename
|
||||
fusion::result_of::convert<
|
||||
typename fusion::detail::tag_of<Sequence>::type, result>::type
|
||||
type;
|
||||
};
|
||||
};
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,418 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// 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_KERNEL_HPP
|
||||
#define BOOST_COMPUTE_KERNEL_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
|
||||
#include <boost/compute/config.hpp>
|
||||
#include <boost/compute/program.hpp>
|
||||
#include <boost/compute/exception.hpp>
|
||||
#include <boost/compute/type_traits/is_fundamental.hpp>
|
||||
#include <boost/compute/detail/get_object_info.hpp>
|
||||
#include <boost/compute/detail/assert_cl_success.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
namespace detail {
|
||||
|
||||
template<class T> struct set_kernel_arg;
|
||||
|
||||
} // end detail namespace
|
||||
|
||||
/// \class kernel
|
||||
/// \brief A compute kernel.
|
||||
///
|
||||
/// \see command_queue, program
|
||||
class kernel
|
||||
{
|
||||
public:
|
||||
/// Creates a null kernel object.
|
||||
kernel()
|
||||
: m_kernel(0)
|
||||
{
|
||||
}
|
||||
|
||||
/// Creates a new kernel object for \p kernel. If \p retain is
|
||||
/// \c true, the reference count for \p kernel will be incremented.
|
||||
explicit kernel(cl_kernel kernel, bool retain = true)
|
||||
: m_kernel(kernel)
|
||||
{
|
||||
if(m_kernel && retain){
|
||||
clRetainKernel(m_kernel);
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a new kernel object with \p name from \p program.
|
||||
kernel(const program &program, const std::string &name)
|
||||
{
|
||||
cl_int error = 0;
|
||||
m_kernel = clCreateKernel(program.get(), name.c_str(), &error);
|
||||
|
||||
if(!m_kernel){
|
||||
BOOST_THROW_EXCEPTION(opencl_error(error));
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a new kernel object as a copy of \p other.
|
||||
kernel(const kernel &other)
|
||||
: m_kernel(other.m_kernel)
|
||||
{
|
||||
if(m_kernel){
|
||||
clRetainKernel(m_kernel);
|
||||
}
|
||||
}
|
||||
|
||||
/// Copies the kernel object from \p other to \c *this.
|
||||
kernel& operator=(const kernel &other)
|
||||
{
|
||||
if(this != &other){
|
||||
if(m_kernel){
|
||||
clReleaseKernel(m_kernel);
|
||||
}
|
||||
|
||||
m_kernel = other.m_kernel;
|
||||
|
||||
if(m_kernel){
|
||||
clRetainKernel(m_kernel);
|
||||
}
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef BOOST_COMPUTE_NO_RVALUE_REFERENCES
|
||||
/// Move-constructs a new kernel object from \p other.
|
||||
kernel(kernel&& other) BOOST_NOEXCEPT
|
||||
: m_kernel(other.m_kernel)
|
||||
{
|
||||
other.m_kernel = 0;
|
||||
}
|
||||
|
||||
/// Move-assigns the kernel from \p other to \c *this.
|
||||
kernel& operator=(kernel&& other) BOOST_NOEXCEPT
|
||||
{
|
||||
if(m_kernel){
|
||||
clReleaseKernel(m_kernel);
|
||||
}
|
||||
|
||||
m_kernel = other.m_kernel;
|
||||
other.m_kernel = 0;
|
||||
|
||||
return *this;
|
||||
}
|
||||
#endif // BOOST_COMPUTE_NO_RVALUE_REFERENCES
|
||||
|
||||
/// Destroys the kernel object.
|
||||
~kernel()
|
||||
{
|
||||
if(m_kernel){
|
||||
BOOST_COMPUTE_ASSERT_CL_SUCCESS(
|
||||
clReleaseKernel(m_kernel)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns a reference to the underlying OpenCL kernel object.
|
||||
cl_kernel& get() const
|
||||
{
|
||||
return const_cast<cl_kernel &>(m_kernel);
|
||||
}
|
||||
|
||||
/// Returns the function name for the kernel.
|
||||
std::string name() const
|
||||
{
|
||||
return get_info<std::string>(CL_KERNEL_FUNCTION_NAME);
|
||||
}
|
||||
|
||||
/// Returns the number of arguments for the kernel.
|
||||
size_t arity() const
|
||||
{
|
||||
return get_info<cl_uint>(CL_KERNEL_NUM_ARGS);
|
||||
}
|
||||
|
||||
/// Returns the program for the kernel.
|
||||
program get_program() const
|
||||
{
|
||||
return program(get_info<cl_program>(CL_KERNEL_PROGRAM));
|
||||
}
|
||||
|
||||
/// Returns the context for the kernel.
|
||||
context get_context() const
|
||||
{
|
||||
return context(get_info<cl_context>(CL_KERNEL_CONTEXT));
|
||||
}
|
||||
|
||||
/// Returns information about the kernel.
|
||||
///
|
||||
/// \see_opencl_ref{clGetKernelInfo}
|
||||
template<class T>
|
||||
T get_info(cl_kernel_info info) const
|
||||
{
|
||||
return detail::get_object_info<T>(clGetKernelInfo, m_kernel, info);
|
||||
}
|
||||
|
||||
/// \overload
|
||||
template<int Enum>
|
||||
typename detail::get_object_info_type<kernel, Enum>::type
|
||||
get_info() const;
|
||||
|
||||
#if defined(CL_VERSION_1_2) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED)
|
||||
/// Returns information about the argument at \p index.
|
||||
///
|
||||
/// For example, to get the name of the first argument:
|
||||
/// \code
|
||||
/// std::string arg = kernel.get_arg_info<std::string>(0, CL_KERNEL_ARG_NAME);
|
||||
/// \endcode
|
||||
///
|
||||
/// Note, this function requires that the program be compiled with the
|
||||
/// \c "-cl-kernel-arg-info" flag. For example:
|
||||
/// \code
|
||||
/// program.build("-cl-kernel-arg-info");
|
||||
/// \endcode
|
||||
///
|
||||
/// \opencl_version_warning{1,2}
|
||||
///
|
||||
/// \see_opencl_ref{clGetKernelArgInfo}
|
||||
template<class T>
|
||||
T get_arg_info(size_t index, cl_kernel_arg_info info) const
|
||||
{
|
||||
return detail::get_object_info<T>(
|
||||
clGetKernelArgInfo, m_kernel, info, static_cast<cl_uint>(index)
|
||||
);
|
||||
}
|
||||
|
||||
/// \overload
|
||||
template<int Enum>
|
||||
typename detail::get_object_info_type<kernel, Enum>::type
|
||||
get_arg_info(size_t index) const;
|
||||
#endif // CL_VERSION_1_2
|
||||
|
||||
/// Returns work-group information for the kernel with \p device.
|
||||
///
|
||||
/// \see_opencl_ref{clGetKernelWorkGroupInfo}
|
||||
template<class T>
|
||||
T get_work_group_info(const device &device, cl_kernel_work_group_info info) const
|
||||
{
|
||||
return detail::get_object_info<T>(clGetKernelWorkGroupInfo, m_kernel, info, device.id());
|
||||
}
|
||||
|
||||
/// Sets the argument at \p index to \p value with \p size.
|
||||
///
|
||||
/// \see_opencl_ref{clSetKernelArg}
|
||||
void set_arg(size_t index, size_t size, const void *value)
|
||||
{
|
||||
BOOST_ASSERT(index < arity());
|
||||
|
||||
cl_int ret = clSetKernelArg(m_kernel,
|
||||
static_cast<cl_uint>(index),
|
||||
size,
|
||||
value);
|
||||
if(ret != CL_SUCCESS){
|
||||
BOOST_THROW_EXCEPTION(opencl_error(ret));
|
||||
}
|
||||
}
|
||||
|
||||
/// Sets the argument at \p index to \p value.
|
||||
///
|
||||
/// For built-in types (e.g. \c float, \c int4_), this is equivalent to
|
||||
/// calling set_arg(index, sizeof(type), &value).
|
||||
///
|
||||
/// Additionally, this method is specialized for device memory objects
|
||||
/// such as buffer and image2d. This allows for them to be passed directly
|
||||
/// without having to extract their underlying cl_mem object.
|
||||
///
|
||||
/// This method is also specialized for device container types such as
|
||||
/// vector<T> and array<T, N>. This allows for them to be passed directly
|
||||
/// as kernel arguments without having to extract their underlying buffer.
|
||||
///
|
||||
/// For setting local memory arguments (e.g. "__local float *buf"), the
|
||||
/// local_buffer<T> class may be used:
|
||||
/// \code
|
||||
/// // set argument to a local buffer with storage for 32 float's
|
||||
/// kernel.set_arg(0, local_buffer<float>(32));
|
||||
/// \endcode
|
||||
template<class T>
|
||||
void set_arg(size_t index, const T &value)
|
||||
{
|
||||
// if you get a compilation error pointing here it means you
|
||||
// attempted to set a kernel argument from an invalid type.
|
||||
detail::set_kernel_arg<T>()(*this, index, value);
|
||||
}
|
||||
|
||||
/// \internal_
|
||||
void set_arg(size_t index, const cl_mem mem)
|
||||
{
|
||||
set_arg(index, sizeof(cl_mem), static_cast<const void *>(&mem));
|
||||
}
|
||||
|
||||
/// \internal_
|
||||
void set_arg(size_t index, const cl_sampler sampler)
|
||||
{
|
||||
set_arg(index, sizeof(cl_sampler), static_cast<const void *>(&sampler));
|
||||
}
|
||||
|
||||
/// \internal_
|
||||
void set_arg_svm_ptr(size_t index, void* ptr)
|
||||
{
|
||||
#ifdef CL_VERSION_2_0
|
||||
cl_int ret = clSetKernelArgSVMPointer(m_kernel, static_cast<cl_uint>(index), ptr);
|
||||
if(ret != CL_SUCCESS){
|
||||
BOOST_THROW_EXCEPTION(opencl_error(ret));
|
||||
}
|
||||
#else
|
||||
(void) index;
|
||||
(void) ptr;
|
||||
BOOST_THROW_EXCEPTION(opencl_error(CL_INVALID_ARG_VALUE));
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef BOOST_COMPUTE_NO_VARIADIC_TEMPLATES
|
||||
/// Sets the arguments for the kernel to \p args.
|
||||
template<class... T>
|
||||
void set_args(T&&... args)
|
||||
{
|
||||
BOOST_ASSERT(sizeof...(T) <= arity());
|
||||
|
||||
_set_args<0>(args...);
|
||||
}
|
||||
#endif // BOOST_COMPUTE_NO_VARIADIC_TEMPLATES
|
||||
|
||||
#if defined(CL_VERSION_2_0) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED)
|
||||
/// Sets additional execution information for the kernel.
|
||||
///
|
||||
/// \opencl_version_warning{2,0}
|
||||
///
|
||||
/// \see_opencl2_ref{clSetKernelExecInfo}
|
||||
void set_exec_info(cl_kernel_exec_info info, size_t size, const void *value)
|
||||
{
|
||||
cl_int ret = clSetKernelExecInfo(m_kernel, info, size, value);
|
||||
if(ret != CL_SUCCESS){
|
||||
BOOST_THROW_EXCEPTION(opencl_error(ret));
|
||||
}
|
||||
}
|
||||
#endif // CL_VERSION_2_0
|
||||
|
||||
/// Returns \c true if the kernel is the same at \p other.
|
||||
bool operator==(const kernel &other) const
|
||||
{
|
||||
return m_kernel == other.m_kernel;
|
||||
}
|
||||
|
||||
/// Returns \c true if the kernel is different from \p other.
|
||||
bool operator!=(const kernel &other) const
|
||||
{
|
||||
return m_kernel != other.m_kernel;
|
||||
}
|
||||
|
||||
/// \internal_
|
||||
operator cl_kernel() const
|
||||
{
|
||||
return m_kernel;
|
||||
}
|
||||
|
||||
/// \internal_
|
||||
static kernel create_with_source(const std::string &source,
|
||||
const std::string &name,
|
||||
const context &context)
|
||||
{
|
||||
return program::build_with_source(source, context).create_kernel(name);
|
||||
}
|
||||
|
||||
private:
|
||||
#ifndef BOOST_COMPUTE_NO_VARIADIC_TEMPLATES
|
||||
/// \internal_
|
||||
template<size_t N>
|
||||
void _set_args()
|
||||
{
|
||||
}
|
||||
|
||||
/// \internal_
|
||||
template<size_t N, class T, class... Args>
|
||||
void _set_args(T&& arg, Args&&... rest)
|
||||
{
|
||||
set_arg(N, arg);
|
||||
_set_args<N+1>(rest...);
|
||||
}
|
||||
#endif // BOOST_COMPUTE_NO_VARIADIC_TEMPLATES
|
||||
|
||||
private:
|
||||
cl_kernel m_kernel;
|
||||
};
|
||||
|
||||
inline kernel program::create_kernel(const std::string &name) const
|
||||
{
|
||||
return kernel(*this, name);
|
||||
}
|
||||
|
||||
/// \internal_ define get_info() specializations for kernel
|
||||
BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS(kernel,
|
||||
((std::string, CL_KERNEL_FUNCTION_NAME))
|
||||
((cl_uint, CL_KERNEL_NUM_ARGS))
|
||||
((cl_uint, CL_KERNEL_REFERENCE_COUNT))
|
||||
((cl_context, CL_KERNEL_CONTEXT))
|
||||
((cl_program, CL_KERNEL_PROGRAM))
|
||||
)
|
||||
|
||||
#ifdef CL_VERSION_1_2
|
||||
BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS(kernel,
|
||||
((std::string, CL_KERNEL_ATTRIBUTES))
|
||||
)
|
||||
#endif // CL_VERSION_1_2
|
||||
|
||||
/// \internal_ define get_arg_info() specializations for kernel
|
||||
#ifdef CL_VERSION_1_2
|
||||
#define BOOST_COMPUTE_DETAIL_DEFINE_KERNEL_GET_ARG_INFO_SPECIALIZATION(result_type, value) \
|
||||
namespace detail { \
|
||||
template<> struct get_object_info_type<kernel, value> { typedef result_type type; }; \
|
||||
} \
|
||||
template<> inline result_type kernel::get_arg_info<value>(size_t index) const { \
|
||||
return get_arg_info<result_type>(index, value); \
|
||||
}
|
||||
|
||||
BOOST_COMPUTE_DETAIL_DEFINE_KERNEL_GET_ARG_INFO_SPECIALIZATION(cl_kernel_arg_address_qualifier, CL_KERNEL_ARG_ADDRESS_QUALIFIER)
|
||||
BOOST_COMPUTE_DETAIL_DEFINE_KERNEL_GET_ARG_INFO_SPECIALIZATION(cl_kernel_arg_access_qualifier, CL_KERNEL_ARG_ACCESS_QUALIFIER)
|
||||
BOOST_COMPUTE_DETAIL_DEFINE_KERNEL_GET_ARG_INFO_SPECIALIZATION(std::string, CL_KERNEL_ARG_TYPE_NAME)
|
||||
BOOST_COMPUTE_DETAIL_DEFINE_KERNEL_GET_ARG_INFO_SPECIALIZATION(cl_kernel_arg_type_qualifier, CL_KERNEL_ARG_TYPE_QUALIFIER)
|
||||
BOOST_COMPUTE_DETAIL_DEFINE_KERNEL_GET_ARG_INFO_SPECIALIZATION(std::string, CL_KERNEL_ARG_NAME)
|
||||
#endif // CL_VERSION_1_2
|
||||
|
||||
namespace detail {
|
||||
|
||||
// set_kernel_arg implementation for built-in types
|
||||
template<class T>
|
||||
struct set_kernel_arg
|
||||
{
|
||||
typename boost::enable_if<is_fundamental<T> >::type
|
||||
operator()(kernel &kernel_, size_t index, const T &value)
|
||||
{
|
||||
kernel_.set_arg(index, sizeof(T), &value);
|
||||
}
|
||||
};
|
||||
|
||||
// set_kernel_arg specialization for char (different from built-in cl_char)
|
||||
template<>
|
||||
struct set_kernel_arg<char>
|
||||
{
|
||||
void operator()(kernel &kernel_, size_t index, const char c)
|
||||
{
|
||||
kernel_.set_arg(index, sizeof(char), &c);
|
||||
}
|
||||
};
|
||||
|
||||
} // end detail namespace
|
||||
} // end namespace compute
|
||||
} // end namespace boost
|
||||
|
||||
#endif // BOOST_COMPUTE_KERNEL_HPP
|
||||
@@ -0,0 +1,9 @@
|
||||
0; 0; 0
|
||||
59; 59; 27
|
||||
119;119; 59
|
||||
179;179; 91
|
||||
227;227;123
|
||||
235;235;151
|
||||
239;239;183
|
||||
247;247;219
|
||||
255;255;255
|
||||
@@ -0,0 +1,138 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// boost aligned_storage.hpp header file
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2002-2003
|
||||
// Eric Friedman, Itay Maman
|
||||
//
|
||||
// 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_TT_ALIGNED_STORAGE_HPP
|
||||
#define BOOST_TT_ALIGNED_STORAGE_HPP
|
||||
|
||||
#include <cstddef> // for std::size_t
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/type_traits/alignment_of.hpp>
|
||||
#include <boost/type_traits/type_with_alignment.hpp>
|
||||
#include <boost/type_traits/is_pod.hpp>
|
||||
#include <boost/type_traits/conditional.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace detail { namespace aligned_storage {
|
||||
|
||||
BOOST_STATIC_CONSTANT(
|
||||
std::size_t
|
||||
, alignment_of_max_align = ::boost::alignment_of<boost::detail::max_align>::value
|
||||
);
|
||||
|
||||
//
|
||||
// To be TR1 conforming this must be a POD type:
|
||||
//
|
||||
template <
|
||||
std::size_t size_
|
||||
, std::size_t alignment_
|
||||
>
|
||||
struct aligned_storage_imp
|
||||
{
|
||||
union data_t
|
||||
{
|
||||
char buf[size_];
|
||||
|
||||
typename ::boost::type_with_alignment<alignment_>::type align_;
|
||||
} data_;
|
||||
void* address() const { return const_cast<aligned_storage_imp*>(this); }
|
||||
};
|
||||
template <std::size_t size>
|
||||
struct aligned_storage_imp<size, std::size_t(-1)>
|
||||
{
|
||||
union data_t
|
||||
{
|
||||
char buf[size];
|
||||
::boost::detail::max_align align_;
|
||||
} data_;
|
||||
void* address() const { return const_cast<aligned_storage_imp*>(this); }
|
||||
};
|
||||
|
||||
template< std::size_t alignment_ >
|
||||
struct aligned_storage_imp<0u,alignment_>
|
||||
{
|
||||
/* intentionally empty */
|
||||
void* address() const { return 0; }
|
||||
};
|
||||
|
||||
}} // namespace detail::aligned_storage
|
||||
|
||||
template <
|
||||
std::size_t size_
|
||||
, std::size_t alignment_ = std::size_t(-1)
|
||||
>
|
||||
class aligned_storage :
|
||||
#ifndef __BORLANDC__
|
||||
private
|
||||
#else
|
||||
public
|
||||
#endif
|
||||
::boost::detail::aligned_storage::aligned_storage_imp<size_, alignment_>
|
||||
{
|
||||
|
||||
public: // constants
|
||||
|
||||
typedef ::boost::detail::aligned_storage::aligned_storage_imp<size_, alignment_> type;
|
||||
|
||||
BOOST_STATIC_CONSTANT(
|
||||
std::size_t
|
||||
, size = size_
|
||||
);
|
||||
BOOST_STATIC_CONSTANT(
|
||||
std::size_t
|
||||
, alignment = (
|
||||
alignment_ == std::size_t(-1)
|
||||
? ::boost::detail::aligned_storage::alignment_of_max_align
|
||||
: alignment_
|
||||
)
|
||||
);
|
||||
|
||||
private: // noncopyable
|
||||
|
||||
aligned_storage(const aligned_storage&);
|
||||
aligned_storage& operator=(const aligned_storage&);
|
||||
|
||||
public: // structors
|
||||
|
||||
aligned_storage()
|
||||
{
|
||||
}
|
||||
|
||||
~aligned_storage()
|
||||
{
|
||||
}
|
||||
|
||||
public: // accessors
|
||||
|
||||
void* address()
|
||||
{
|
||||
return static_cast<type*>(this)->address();
|
||||
}
|
||||
|
||||
const void* address() const
|
||||
{
|
||||
return static_cast<const type*>(this)->address();
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Make sure that is_pod recognises aligned_storage<>::type
|
||||
// as a POD (Note that aligned_storage<> itself is not a POD):
|
||||
//
|
||||
template <std::size_t size_, std::size_t alignment_>
|
||||
struct is_pod< ::boost::detail::aligned_storage::aligned_storage_imp<size_, alignment_> > : public true_type{};
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ALIGNED_STORAGE_HPP
|
||||
@@ -0,0 +1,148 @@
|
||||
subroutine bpdecode40(llr,maxiterations,decoded,niterations)
|
||||
!
|
||||
! A log-domain belief propagation decoder for the msk40 code.
|
||||
! The code is a regular (32,16) code with column weight 3, row weights 5,6,7.
|
||||
! k9an August, 2016
|
||||
!
|
||||
integer, parameter:: N=32, K=16, M=N-K
|
||||
integer*1 codeword(N),cw(N)
|
||||
integer*1 colorder(N)
|
||||
integer*1 decoded(K)
|
||||
integer Nm(7,M) ! 5,6 or 7 bits per check
|
||||
integer Mn(3,N) ! 3 checks per bit
|
||||
integer synd(M)
|
||||
real tov(3,N)
|
||||
real toc(7,M)
|
||||
real tanhtoc(7,M)
|
||||
real zn(N)
|
||||
real llr(N)
|
||||
real Tmn
|
||||
integer nrw(M)
|
||||
|
||||
data colorder/ &
|
||||
4, 1, 2, 3, 0, 8, 6, 10, &
|
||||
13, 28, 20, 23, 17, 15, 27, 25, &
|
||||
16, 12, 18, 19, 7, 21, 22, 11, &
|
||||
24, 5, 26, 14, 9, 29, 30, 31/
|
||||
|
||||
data Mn/ &
|
||||
1, 6, 13, &
|
||||
2, 3, 14, &
|
||||
4, 8, 15, &
|
||||
5, 11, 12, &
|
||||
7, 10, 16, &
|
||||
6, 9, 15, &
|
||||
1, 11, 16, &
|
||||
2, 4, 5, &
|
||||
3, 7, 9, &
|
||||
8, 10, 12, &
|
||||
8, 13, 14, &
|
||||
1, 4, 12, &
|
||||
2, 6, 10, &
|
||||
3, 11, 15, &
|
||||
5, 9, 14, &
|
||||
7, 13, 15, &
|
||||
12, 14, 16, &
|
||||
1, 2, 8, &
|
||||
3, 5, 6, &
|
||||
4, 9, 11, &
|
||||
1, 7, 14, &
|
||||
5, 10, 13, &
|
||||
3, 4, 16, &
|
||||
2, 15, 16, &
|
||||
6, 7, 12, &
|
||||
7, 8, 11, &
|
||||
1, 9, 10, &
|
||||
2, 11, 13, &
|
||||
3, 12, 13, &
|
||||
4, 6, 14, &
|
||||
1, 5, 15, &
|
||||
8, 9, 16/
|
||||
|
||||
data Nm/ &
|
||||
1, 7, 12, 18, 21, 27, 31, &
|
||||
2, 8, 13, 18, 24, 28, 0, &
|
||||
2, 9, 14, 19, 23, 29, 0, &
|
||||
3, 8, 12, 20, 23, 30, 0, &
|
||||
4, 8, 15, 19, 22, 31, 0, &
|
||||
1, 6, 13, 19, 25, 30, 0, &
|
||||
5, 9, 16, 21, 25, 26, 0, &
|
||||
3, 10, 11, 18, 26, 32, 0, &
|
||||
6, 9, 15, 20, 27, 32, 0,&
|
||||
5, 10, 13, 22, 27, 0, 0, &
|
||||
4, 7, 14, 20, 26, 28, 0, &
|
||||
4, 10, 12, 17, 25, 29, 0, &
|
||||
1, 11, 16, 22, 28, 29, 0, &
|
||||
2, 11, 15, 17, 21, 30, 0, &
|
||||
3, 6, 14, 16, 24, 31, 0, &
|
||||
5, 7, 17, 23, 24, 32, 0/
|
||||
|
||||
data nrw/7,6,6,6,6,6,6,6,6,5,6,6,6,6,6,6/
|
||||
|
||||
ncw=3
|
||||
|
||||
toc=0
|
||||
tov=0
|
||||
tanhtoc=0
|
||||
|
||||
! initialize messages to checks
|
||||
do j=1,M
|
||||
do i=1,nrw(j)
|
||||
toc(i,j)=llr((Nm(i,j)))
|
||||
enddo
|
||||
enddo
|
||||
|
||||
do iter=0,maxiterations
|
||||
|
||||
! Update bit log likelihood ratios (tov=0 in iteration 0).
|
||||
do i=1,N
|
||||
zn(i)=llr(i)+sum(tov(1:ncw,i))
|
||||
enddo
|
||||
|
||||
! Check to see if we have a codeword (check before we do any iteration).
|
||||
cw=0
|
||||
where( zn .gt. 0. ) cw=1
|
||||
ncheck=0
|
||||
do i=1,M
|
||||
synd(i)=sum(cw(Nm(1:nrw(i),i)))
|
||||
if( mod(synd(i),2) .ne. 0 ) ncheck=ncheck+1
|
||||
enddo
|
||||
|
||||
if( ncheck .eq. 0 ) then ! we have a codeword - reorder the columns and return it
|
||||
niterations=iter
|
||||
codeword=cw(colorder+1)
|
||||
decoded=codeword(M+1:N)
|
||||
return
|
||||
endif
|
||||
|
||||
! Send messages from bits to check nodes
|
||||
do j=1,M
|
||||
do i=1,nrw(j)
|
||||
ibj=Nm(i,j)
|
||||
toc(i,j)=zn(ibj)
|
||||
do kk=1,ncw ! subtract off what the bit had received from the check
|
||||
if( Mn(kk,ibj) .eq. j ) then
|
||||
toc(i,j)=toc(i,j)-tov(kk,ibj)
|
||||
endif
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
! send messages from check nodes to variable nodes
|
||||
do i=1,M
|
||||
tanhtoc(1:7,i)=tanh(-toc(1:7,i)/2)
|
||||
enddo
|
||||
|
||||
do j=1,N
|
||||
do i=1,ncw
|
||||
ichk=Mn(i,j) ! Mn(:,j) are the checks that include bit j
|
||||
Tmn=product(tanhtoc(1:nrw(ichk),ichk),mask=Nm(1:nrw(ichk),ichk).ne.j)
|
||||
call platanh(-Tmn,y)
|
||||
tov(i,j)=2*y
|
||||
enddo
|
||||
enddo
|
||||
|
||||
enddo
|
||||
niterations=-1
|
||||
return
|
||||
end subroutine bpdecode40
|
||||
@@ -0,0 +1,368 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2003
|
||||
* John Maddock
|
||||
*
|
||||
* 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)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE u32regex_token_iterator.hpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Provides u32regex_token_iterator implementation.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_REGEX_V4_U32REGEX_TOKEN_ITERATOR_HPP
|
||||
#define BOOST_REGEX_V4_U32REGEX_TOKEN_ITERATOR_HPP
|
||||
|
||||
#if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
|
||||
|| BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
|
||||
//
|
||||
// Borland C++ Builder 6, and Visual C++ 6,
|
||||
// can't cope with the array template constructor
|
||||
// so we have a template member that will accept any type as
|
||||
// argument, and then assert that is really is an array:
|
||||
//
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_PREFIX
|
||||
#endif
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:4700)
|
||||
#endif
|
||||
|
||||
template <class BidirectionalIterator>
|
||||
class u32regex_token_iterator_implementation
|
||||
{
|
||||
typedef u32regex regex_type;
|
||||
typedef sub_match<BidirectionalIterator> value_type;
|
||||
|
||||
match_results<BidirectionalIterator> what; // current match
|
||||
BidirectionalIterator end; // end of search area
|
||||
BidirectionalIterator base; // start of search area
|
||||
const regex_type re; // the expression
|
||||
match_flag_type flags; // match flags
|
||||
value_type result; // the current string result
|
||||
int N; // the current sub-expression being enumerated
|
||||
std::vector<int> subs; // the sub-expressions to enumerate
|
||||
|
||||
public:
|
||||
u32regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, int sub, match_flag_type f)
|
||||
: end(last), re(*p), flags(f){ subs.push_back(sub); }
|
||||
u32regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const std::vector<int>& v, match_flag_type f)
|
||||
: end(last), re(*p), flags(f), subs(v){}
|
||||
#if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
|
||||
|| BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \
|
||||
|| BOOST_WORKAROUND(__HP_aCC, < 60700)
|
||||
template <class T>
|
||||
u32regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const T& submatches, match_flag_type f)
|
||||
: end(last), re(*p), flags(f)
|
||||
{
|
||||
// assert that T really is an array:
|
||||
BOOST_STATIC_ASSERT(::boost::is_array<T>::value);
|
||||
const std::size_t array_size = sizeof(T) / sizeof(submatches[0]);
|
||||
for(std::size_t i = 0; i < array_size; ++i)
|
||||
{
|
||||
subs.push_back(submatches[i]);
|
||||
}
|
||||
}
|
||||
#else
|
||||
template <std::size_t CN>
|
||||
u32regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const int (&submatches)[CN], match_flag_type f)
|
||||
: end(last), re(*p), flags(f)
|
||||
{
|
||||
for(std::size_t i = 0; i < CN; ++i)
|
||||
{
|
||||
subs.push_back(submatches[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
bool init(BidirectionalIterator first)
|
||||
{
|
||||
base = first;
|
||||
N = 0;
|
||||
if(u32regex_search(first, end, what, re, flags, base) == true)
|
||||
{
|
||||
N = 0;
|
||||
result = ((subs[N] == -1) ? what.prefix() : what[(int)subs[N]]);
|
||||
return true;
|
||||
}
|
||||
else if((subs[N] == -1) && (first != end))
|
||||
{
|
||||
result.first = first;
|
||||
result.second = end;
|
||||
result.matched = (first != end);
|
||||
N = -1;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool compare(const u32regex_token_iterator_implementation& that)
|
||||
{
|
||||
if(this == &that) return true;
|
||||
return (&re.get_data() == &that.re.get_data())
|
||||
&& (end == that.end)
|
||||
&& (flags == that.flags)
|
||||
&& (N == that.N)
|
||||
&& (what[0].first == that.what[0].first)
|
||||
&& (what[0].second == that.what[0].second);
|
||||
}
|
||||
const value_type& get()
|
||||
{ return result; }
|
||||
bool next()
|
||||
{
|
||||
if(N == -1)
|
||||
return false;
|
||||
if(N+1 < (int)subs.size())
|
||||
{
|
||||
++N;
|
||||
result =((subs[N] == -1) ? what.prefix() : what[subs[N]]);
|
||||
return true;
|
||||
}
|
||||
//if(what.prefix().first != what[0].second)
|
||||
// flags |= match_prev_avail | regex_constants::match_not_bob;
|
||||
BidirectionalIterator last_end(what[0].second);
|
||||
if(u32regex_search(last_end, end, what, re, ((what[0].first == what[0].second) ? flags | regex_constants::match_not_initial_null : flags), base))
|
||||
{
|
||||
N =0;
|
||||
result =((subs[N] == -1) ? what.prefix() : what[subs[N]]);
|
||||
return true;
|
||||
}
|
||||
else if((last_end != end) && (subs[0] == -1))
|
||||
{
|
||||
N =-1;
|
||||
result.first = last_end;
|
||||
result.second = end;
|
||||
result.matched = (last_end != end);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private:
|
||||
u32regex_token_iterator_implementation& operator=(const u32regex_token_iterator_implementation&);
|
||||
};
|
||||
|
||||
template <class BidirectionalIterator>
|
||||
class u32regex_token_iterator
|
||||
#ifndef BOOST_NO_STD_ITERATOR
|
||||
: public std::iterator<
|
||||
std::forward_iterator_tag,
|
||||
sub_match<BidirectionalIterator>,
|
||||
typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits<BidirectionalIterator>::difference_type,
|
||||
const sub_match<BidirectionalIterator>*,
|
||||
const sub_match<BidirectionalIterator>& >
|
||||
#endif
|
||||
{
|
||||
private:
|
||||
typedef u32regex_token_iterator_implementation<BidirectionalIterator> impl;
|
||||
typedef shared_ptr<impl> pimpl;
|
||||
public:
|
||||
typedef u32regex regex_type;
|
||||
typedef sub_match<BidirectionalIterator> value_type;
|
||||
typedef typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits<BidirectionalIterator>::difference_type
|
||||
difference_type;
|
||||
typedef const value_type* pointer;
|
||||
typedef const value_type& reference;
|
||||
typedef std::forward_iterator_tag iterator_category;
|
||||
|
||||
u32regex_token_iterator(){}
|
||||
u32regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
|
||||
int submatch = 0, match_flag_type m = match_default)
|
||||
: pdata(new impl(&re, b, submatch, m))
|
||||
{
|
||||
if(!pdata->init(a))
|
||||
pdata.reset();
|
||||
}
|
||||
u32regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
|
||||
const std::vector<int>& submatches, match_flag_type m = match_default)
|
||||
: pdata(new impl(&re, b, submatches, m))
|
||||
{
|
||||
if(!pdata->init(a))
|
||||
pdata.reset();
|
||||
}
|
||||
#if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
|
||||
|| BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \
|
||||
|| BOOST_WORKAROUND(__HP_aCC, < 60700)
|
||||
template <class T>
|
||||
u32regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
|
||||
const T& submatches, match_flag_type m = match_default)
|
||||
: pdata(new impl(&re, b, submatches, m))
|
||||
{
|
||||
if(!pdata->init(a))
|
||||
pdata.reset();
|
||||
}
|
||||
#else
|
||||
template <std::size_t N>
|
||||
u32regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
|
||||
const int (&submatches)[N], match_flag_type m = match_default)
|
||||
: pdata(new impl(&re, b, submatches, m))
|
||||
{
|
||||
if(!pdata->init(a))
|
||||
pdata.reset();
|
||||
}
|
||||
#endif
|
||||
u32regex_token_iterator(const u32regex_token_iterator& that)
|
||||
: pdata(that.pdata) {}
|
||||
u32regex_token_iterator& operator=(const u32regex_token_iterator& that)
|
||||
{
|
||||
pdata = that.pdata;
|
||||
return *this;
|
||||
}
|
||||
bool operator==(const u32regex_token_iterator& that)const
|
||||
{
|
||||
if((pdata.get() == 0) || (that.pdata.get() == 0))
|
||||
return pdata.get() == that.pdata.get();
|
||||
return pdata->compare(*(that.pdata.get()));
|
||||
}
|
||||
bool operator!=(const u32regex_token_iterator& that)const
|
||||
{ return !(*this == that); }
|
||||
const value_type& operator*()const
|
||||
{ return pdata->get(); }
|
||||
const value_type* operator->()const
|
||||
{ return &(pdata->get()); }
|
||||
u32regex_token_iterator& operator++()
|
||||
{
|
||||
cow();
|
||||
if(0 == pdata->next())
|
||||
{
|
||||
pdata.reset();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
u32regex_token_iterator operator++(int)
|
||||
{
|
||||
u32regex_token_iterator result(*this);
|
||||
++(*this);
|
||||
return result;
|
||||
}
|
||||
private:
|
||||
|
||||
pimpl pdata;
|
||||
|
||||
void cow()
|
||||
{
|
||||
// copy-on-write
|
||||
if(pdata.get() && !pdata.unique())
|
||||
{
|
||||
pdata.reset(new impl(*(pdata.get())));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
typedef u32regex_token_iterator<const char*> utf8regex_token_iterator;
|
||||
typedef u32regex_token_iterator<const UChar*> utf16regex_token_iterator;
|
||||
typedef u32regex_token_iterator<const UChar32*> utf32regex_token_iterator;
|
||||
|
||||
// construction from an integral sub_match state_id:
|
||||
inline u32regex_token_iterator<const char*> make_u32regex_token_iterator(const char* p, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default)
|
||||
{
|
||||
return u32regex_token_iterator<const char*>(p, p+std::strlen(p), e, submatch, m);
|
||||
}
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
inline u32regex_token_iterator<const wchar_t*> make_u32regex_token_iterator(const wchar_t* p, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default)
|
||||
{
|
||||
return u32regex_token_iterator<const wchar_t*>(p, p+std::wcslen(p), e, submatch, m);
|
||||
}
|
||||
#endif
|
||||
#if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2)
|
||||
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const UChar* p, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default)
|
||||
{
|
||||
return u32regex_token_iterator<const UChar*>(p, p+u_strlen(p), e, submatch, m);
|
||||
}
|
||||
#endif
|
||||
template <class charT, class Traits, class Alloc>
|
||||
inline u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>::const_iterator> make_u32regex_token_iterator(const std::basic_string<charT, Traits, Alloc>& p, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default)
|
||||
{
|
||||
typedef typename std::basic_string<charT, Traits, Alloc>::const_iterator iter_type;
|
||||
return u32regex_token_iterator<iter_type>(p.begin(), p.end(), e, submatch, m);
|
||||
}
|
||||
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const U_NAMESPACE_QUALIFIER UnicodeString& s, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default)
|
||||
{
|
||||
return u32regex_token_iterator<const UChar*>(s.getBuffer(), s.getBuffer() + s.length(), e, submatch, m);
|
||||
}
|
||||
|
||||
// construction from a reference to an array:
|
||||
template <std::size_t N>
|
||||
inline u32regex_token_iterator<const char*> make_u32regex_token_iterator(const char* p, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default)
|
||||
{
|
||||
return u32regex_token_iterator<const char*>(p, p+std::strlen(p), e, submatch, m);
|
||||
}
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
template <std::size_t N>
|
||||
inline u32regex_token_iterator<const wchar_t*> make_u32regex_token_iterator(const wchar_t* p, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default)
|
||||
{
|
||||
return u32regex_token_iterator<const wchar_t*>(p, p+std::wcslen(p), e, submatch, m);
|
||||
}
|
||||
#endif
|
||||
#if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2)
|
||||
template <std::size_t N>
|
||||
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const UChar* p, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default)
|
||||
{
|
||||
return u32regex_token_iterator<const UChar*>(p, p+u_strlen(p), e, submatch, m);
|
||||
}
|
||||
#endif
|
||||
template <class charT, class Traits, class Alloc, std::size_t N>
|
||||
inline u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>::const_iterator> make_u32regex_token_iterator(const std::basic_string<charT, Traits, Alloc>& p, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default)
|
||||
{
|
||||
typedef typename std::basic_string<charT, Traits, Alloc>::const_iterator iter_type;
|
||||
return u32regex_token_iterator<iter_type>(p.begin(), p.end(), e, submatch, m);
|
||||
}
|
||||
template <std::size_t N>
|
||||
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const U_NAMESPACE_QUALIFIER UnicodeString& s, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default)
|
||||
{
|
||||
return u32regex_token_iterator<const UChar*>(s.getBuffer(), s.getBuffer() + s.length(), e, submatch, m);
|
||||
}
|
||||
|
||||
// construction from a vector of sub_match state_id's:
|
||||
inline u32regex_token_iterator<const char*> make_u32regex_token_iterator(const char* p, const u32regex& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default)
|
||||
{
|
||||
return u32regex_token_iterator<const char*>(p, p+std::strlen(p), e, submatch, m);
|
||||
}
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
inline u32regex_token_iterator<const wchar_t*> make_u32regex_token_iterator(const wchar_t* p, const u32regex& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default)
|
||||
{
|
||||
return u32regex_token_iterator<const wchar_t*>(p, p+std::wcslen(p), e, submatch, m);
|
||||
}
|
||||
#endif
|
||||
#if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2)
|
||||
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const UChar* p, const u32regex& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default)
|
||||
{
|
||||
return u32regex_token_iterator<const UChar*>(p, p+u_strlen(p), e, submatch, m);
|
||||
}
|
||||
#endif
|
||||
template <class charT, class Traits, class Alloc>
|
||||
inline u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>::const_iterator> make_u32regex_token_iterator(const std::basic_string<charT, Traits, Alloc>& p, const u32regex& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default)
|
||||
{
|
||||
typedef typename std::basic_string<charT, Traits, Alloc>::const_iterator iter_type;
|
||||
return u32regex_token_iterator<iter_type>(p.begin(), p.end(), e, submatch, m);
|
||||
}
|
||||
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const U_NAMESPACE_QUALIFIER UnicodeString& s, const u32regex& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default)
|
||||
{
|
||||
return u32regex_token_iterator<const UChar*>(s.getBuffer(), s.getBuffer() + s.length(), e, submatch, m);
|
||||
}
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_SUFFIX
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_REGEX_V4_REGEX_TOKEN_ITERATOR_HPP
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
// (C) Copyright Gennadiy Rozental 2001.
|
||||
// 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/test for the library home page.
|
||||
//
|
||||
// File : $RCSfile$
|
||||
//
|
||||
// Version : $Revision$
|
||||
//
|
||||
// Description : trivial utility to cast to/from strings
|
||||
// ***************************************************************************
|
||||
|
||||
#ifndef BOOST_TEST_UTILS_STRING_CAST_HPP
|
||||
#define BOOST_TEST_UTILS_STRING_CAST_HPP
|
||||
|
||||
// Boost.Test
|
||||
#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
|
||||
|
||||
// STL
|
||||
#include <sstream>
|
||||
|
||||
#include <boost/test/detail/suppress_warnings.hpp>
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
namespace boost {
|
||||
namespace unit_test {
|
||||
namespace utils {
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** string_cast ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
template<typename T>
|
||||
inline std::string
|
||||
string_cast( T const& t )
|
||||
{
|
||||
std::ostringstream buff;
|
||||
buff << t;
|
||||
return buff.str();
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** string_as ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
template<typename T>
|
||||
inline bool
|
||||
string_as( const_string str, T& res )
|
||||
{
|
||||
std::istringstream buff( std::string( str.begin(), str.end() ) );
|
||||
buff >> res;
|
||||
|
||||
return !buff.fail() && buff.eof();
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
} // namespace utils
|
||||
} // namespace unit_test
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/test/detail/enable_warnings.hpp>
|
||||
|
||||
#endif // BOOST_TEST_UTILS_STRING_CAST_HPP
|
||||
@@ -0,0 +1,96 @@
|
||||
#if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
|
||||
|
||||
#include <boost/proto/detail/preprocessed/matches_.hpp>
|
||||
|
||||
#elif !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#define BOOST_PROTO_MATCHES_N_FUN(Z, N, DATA) \
|
||||
matches_< \
|
||||
typename detail::expr_traits<typename Args1::BOOST_PP_CAT(child, N)>::value_type::proto_derived_expr \
|
||||
, typename detail::expr_traits<typename Args1::BOOST_PP_CAT(child, N)>::value_type::proto_grammar \
|
||||
, typename Args2::BOOST_PP_CAT(child, N)::proto_grammar \
|
||||
>
|
||||
|
||||
#define BOOST_PROTO_DEFINE_MATCHES(Z, N, DATA) \
|
||||
matches_< \
|
||||
Expr \
|
||||
, BasicExpr \
|
||||
, typename BOOST_PP_CAT(G, N)::proto_grammar \
|
||||
>
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/matches_.hpp")
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file matches_.hpp
|
||||
/// Definitions of matches_ specializations
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. 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(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (2, BOOST_PP_MAX(BOOST_PROTO_MAX_ARITY, BOOST_PROTO_MAX_LOGICAL_ARITY), <boost/proto/detail/matches_.hpp>))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#undef BOOST_PROTO_DEFINE_MATCHES
|
||||
#undef BOOST_PROTO_MATCHES_N_FUN
|
||||
|
||||
#else // BOOST_PP_IS_ITERATING
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
#if N <= BOOST_PROTO_MAX_LOGICAL_ARITY
|
||||
|
||||
// handle proto::or_
|
||||
template<typename Expr, typename BasicExpr BOOST_PP_ENUM_TRAILING_PARAMS(N, typename G)>
|
||||
struct matches_<Expr, BasicExpr, proto::or_<BOOST_PP_ENUM_PARAMS(N, G)> >
|
||||
: BOOST_PP_CAT(or_, N)<
|
||||
matches_<Expr, BasicExpr, typename G0::proto_grammar>::value,
|
||||
Expr, BasicExpr BOOST_PP_ENUM_TRAILING_PARAMS(N, G)
|
||||
>
|
||||
{};
|
||||
|
||||
// handle proto::and_
|
||||
template<typename Expr, typename BasicExpr, BOOST_PP_ENUM_PARAMS(N, typename G)>
|
||||
struct matches_<Expr, BasicExpr, proto::and_<BOOST_PP_ENUM_PARAMS(N, G)> >
|
||||
: detail::BOOST_PP_CAT(and_, N)<
|
||||
BOOST_PROTO_DEFINE_MATCHES(~, 0, ~)::value,
|
||||
BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_DEFINE_MATCHES, ~)
|
||||
>
|
||||
{};
|
||||
|
||||
#endif
|
||||
|
||||
#if N <= BOOST_PROTO_MAX_ARITY
|
||||
|
||||
template<typename Expr, typename Tag, typename Args1, typename Args2>
|
||||
struct matches_< Expr, proto::basic_expr<Tag, Args1, N>, proto::basic_expr<Tag, Args2, N> >
|
||||
: BOOST_PP_CAT(and_, N)<
|
||||
BOOST_PROTO_MATCHES_N_FUN(~, 0, ~)::value,
|
||||
BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_MATCHES_N_FUN, ~)
|
||||
>
|
||||
{};
|
||||
|
||||
template<typename Expr, typename Tag, typename Args1, typename Args2>
|
||||
struct matches_< Expr, proto::basic_expr<Tag, Args1, N>, proto::basic_expr<proto::_, Args2, N> >
|
||||
: BOOST_PP_CAT(and_, N)<
|
||||
BOOST_PROTO_MATCHES_N_FUN(~, 0, ~)::value,
|
||||
BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_MATCHES_N_FUN, ~)
|
||||
>
|
||||
{};
|
||||
|
||||
#endif
|
||||
|
||||
#undef N
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,44 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2014-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)
|
||||
//
|
||||
// See http://www.boost.org/libs/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_DETAIL_EMPTY_NODE_CHECKER_HPP
|
||||
#define BOOST_INTRUSIVE_DETAIL_EMPTY_NODE_CHECKER_HPP
|
||||
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
# include <boost/config.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
namespace detail {
|
||||
|
||||
template<class ValueTraits>
|
||||
struct empty_node_checker
|
||||
{
|
||||
typedef ValueTraits value_traits;
|
||||
typedef typename value_traits::node_traits node_traits;
|
||||
typedef typename node_traits::const_node_ptr const_node_ptr;
|
||||
|
||||
struct return_type {};
|
||||
|
||||
void operator () (const const_node_ptr&, const return_type&, const return_type&, return_type&) {}
|
||||
};
|
||||
|
||||
} //namespace detail{
|
||||
} //namespace intrusive{
|
||||
} //namespace boost{
|
||||
|
||||
#endif //BOOST_INTRUSIVE_DETAIL_EMPTY_NODE_CHECKER_HPP
|
||||
@@ -0,0 +1,18 @@
|
||||
// Copyright Nuxi, https://nuxi.nl/ 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)
|
||||
|
||||
#define BOOST_PLATFORM "CloudABI"
|
||||
|
||||
#define BOOST_HAS_DIRENT_H
|
||||
#define BOOST_HAS_STDINT_H
|
||||
#define BOOST_HAS_UNISTD_H
|
||||
|
||||
#define BOOST_HAS_CLOCK_GETTIME
|
||||
#define BOOST_HAS_EXPM1
|
||||
#define BOOST_HAS_GETTIMEOFDAY
|
||||
#define BOOST_HAS_LOG1P
|
||||
#define BOOST_HAS_NANOSLEEP
|
||||
#define BOOST_HAS_PTHREADS
|
||||
#define BOOST_HAS_SCHED_YIELD
|
||||
@@ -0,0 +1,99 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (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_ITERATION_FINISH_4
|
||||
#
|
||||
# undef BOOST_PP_ITERATION_FINISH_4_DIGIT_1
|
||||
# undef BOOST_PP_ITERATION_FINISH_4_DIGIT_2
|
||||
# undef BOOST_PP_ITERATION_FINISH_4_DIGIT_3
|
||||
# undef BOOST_PP_ITERATION_FINISH_4_DIGIT_4
|
||||
# undef BOOST_PP_ITERATION_FINISH_4_DIGIT_5
|
||||
# undef BOOST_PP_ITERATION_FINISH_4_DIGIT_6
|
||||
# undef BOOST_PP_ITERATION_FINISH_4_DIGIT_7
|
||||
# undef BOOST_PP_ITERATION_FINISH_4_DIGIT_8
|
||||
# undef BOOST_PP_ITERATION_FINISH_4_DIGIT_9
|
||||
# undef BOOST_PP_ITERATION_FINISH_4_DIGIT_10
|
||||
#
|
||||
# if BOOST_PP_SLOT_TEMP_3 == 0
|
||||
# define BOOST_PP_ITERATION_FINISH_4_DIGIT_3 0
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 1
|
||||
# define BOOST_PP_ITERATION_FINISH_4_DIGIT_3 1
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 2
|
||||
# define BOOST_PP_ITERATION_FINISH_4_DIGIT_3 2
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 3
|
||||
# define BOOST_PP_ITERATION_FINISH_4_DIGIT_3 3
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 4
|
||||
# define BOOST_PP_ITERATION_FINISH_4_DIGIT_3 4
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 5
|
||||
# define BOOST_PP_ITERATION_FINISH_4_DIGIT_3 5
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 6
|
||||
# define BOOST_PP_ITERATION_FINISH_4_DIGIT_3 6
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 7
|
||||
# define BOOST_PP_ITERATION_FINISH_4_DIGIT_3 7
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 8
|
||||
# define BOOST_PP_ITERATION_FINISH_4_DIGIT_3 8
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 9
|
||||
# define BOOST_PP_ITERATION_FINISH_4_DIGIT_3 9
|
||||
# endif
|
||||
#
|
||||
# if BOOST_PP_SLOT_TEMP_2 == 0
|
||||
# define BOOST_PP_ITERATION_FINISH_4_DIGIT_2 0
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 1
|
||||
# define BOOST_PP_ITERATION_FINISH_4_DIGIT_2 1
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 2
|
||||
# define BOOST_PP_ITERATION_FINISH_4_DIGIT_2 2
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 3
|
||||
# define BOOST_PP_ITERATION_FINISH_4_DIGIT_2 3
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 4
|
||||
# define BOOST_PP_ITERATION_FINISH_4_DIGIT_2 4
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 5
|
||||
# define BOOST_PP_ITERATION_FINISH_4_DIGIT_2 5
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 6
|
||||
# define BOOST_PP_ITERATION_FINISH_4_DIGIT_2 6
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 7
|
||||
# define BOOST_PP_ITERATION_FINISH_4_DIGIT_2 7
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 8
|
||||
# define BOOST_PP_ITERATION_FINISH_4_DIGIT_2 8
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 9
|
||||
# define BOOST_PP_ITERATION_FINISH_4_DIGIT_2 9
|
||||
# endif
|
||||
#
|
||||
# if BOOST_PP_SLOT_TEMP_1 == 0
|
||||
# define BOOST_PP_ITERATION_FINISH_4_DIGIT_1 0
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 1
|
||||
# define BOOST_PP_ITERATION_FINISH_4_DIGIT_1 1
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 2
|
||||
# define BOOST_PP_ITERATION_FINISH_4_DIGIT_1 2
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 3
|
||||
# define BOOST_PP_ITERATION_FINISH_4_DIGIT_1 3
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 4
|
||||
# define BOOST_PP_ITERATION_FINISH_4_DIGIT_1 4
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 5
|
||||
# define BOOST_PP_ITERATION_FINISH_4_DIGIT_1 5
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 6
|
||||
# define BOOST_PP_ITERATION_FINISH_4_DIGIT_1 6
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 7
|
||||
# define BOOST_PP_ITERATION_FINISH_4_DIGIT_1 7
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 8
|
||||
# define BOOST_PP_ITERATION_FINISH_4_DIGIT_1 8
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 9
|
||||
# define BOOST_PP_ITERATION_FINISH_4_DIGIT_1 9
|
||||
# endif
|
||||
#
|
||||
# if BOOST_PP_ITERATION_FINISH_4_DIGIT_3
|
||||
# define BOOST_PP_ITERATION_FINISH_4 BOOST_PP_SLOT_CC_3(BOOST_PP_ITERATION_FINISH_4_DIGIT_3, BOOST_PP_ITERATION_FINISH_4_DIGIT_2, BOOST_PP_ITERATION_FINISH_4_DIGIT_1)
|
||||
# elif BOOST_PP_ITERATION_FINISH_4_DIGIT_2
|
||||
# define BOOST_PP_ITERATION_FINISH_4 BOOST_PP_SLOT_CC_2(BOOST_PP_ITERATION_FINISH_4_DIGIT_2, BOOST_PP_ITERATION_FINISH_4_DIGIT_1)
|
||||
# else
|
||||
# define BOOST_PP_ITERATION_FINISH_4 BOOST_PP_ITERATION_FINISH_4_DIGIT_1
|
||||
# endif
|
||||
@@ -0,0 +1,29 @@
|
||||
#ifndef POSIX_TIME_PERIOD_HPP___
|
||||
#define POSIX_TIME_PERIOD_HPP___
|
||||
|
||||
/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
|
||||
* Use, modification and distribution is subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying
|
||||
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
|
||||
* Author: Jeff Garland
|
||||
* $Date$
|
||||
*/
|
||||
|
||||
#include "boost/date_time/period.hpp"
|
||||
#include "boost/date_time/posix_time/posix_time_duration.hpp"
|
||||
#include "boost/date_time/posix_time/ptime.hpp"
|
||||
|
||||
namespace boost {
|
||||
namespace posix_time {
|
||||
|
||||
//! Time period type
|
||||
/*! \ingroup time_basics
|
||||
*/
|
||||
typedef date_time::period<ptime, time_duration> time_period;
|
||||
|
||||
|
||||
} }//namespace posix_time
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
/*=============================================================================
|
||||
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_SEQUENCE_CLASS_MAP_10022005_0606)
|
||||
#define FUSION_SEQUENCE_CLASS_MAP_10022005_0606
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/container/map/map.hpp>
|
||||
#include <boost/fusion/container/map/map_fwd.hpp>
|
||||
#include <boost/fusion/container/map/convert.hpp>
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,99 @@
|
||||
program ft8sim
|
||||
|
||||
! Generate simulated data for a 15-second HF/6m mode using 8-FSK.
|
||||
! Output is saved to a *.wav file.
|
||||
|
||||
use wavhdr
|
||||
include 'ft8_params.f90' !Set various constants
|
||||
type(hdr) h !Header for .wav file
|
||||
character arg*12,fname*17
|
||||
character msg*22,msgsent*22
|
||||
complex c0(0:NMAX-1)
|
||||
complex c(0:NMAX-1)
|
||||
integer itone(NN)
|
||||
integer*2 iwave(NMAX) !Generated full-length waveform
|
||||
|
||||
! Get command-line argument(s)
|
||||
nargs=iargc()
|
||||
if(nargs.ne.6) then
|
||||
print*,'Usage: ft8sim "message" DT fdop del nfiles snr'
|
||||
print*,'Example: ft8sim "K1ABC W9XYZ EN37" 0.0 0.1 1.0 10 -18'
|
||||
go to 999
|
||||
endif
|
||||
call getarg(1,msg) !Message to be transmitted
|
||||
call getarg(2,arg)
|
||||
read(arg,*) xdt !Time offset from nominal (s)
|
||||
call getarg(3,arg)
|
||||
read(arg,*) fspread !Watterson frequency spread (Hz)
|
||||
call getarg(4,arg)
|
||||
read(arg,*) delay !Watterson delay (ms)
|
||||
call getarg(5,arg)
|
||||
read(arg,*) nfiles !Number of files
|
||||
call getarg(6,arg)
|
||||
read(arg,*) snrdb !SNR_2500
|
||||
|
||||
twopi=8.0*atan(1.0)
|
||||
fs=12000.0 !Sample rate (Hz)
|
||||
dt=1.0/fs !Sample interval (s)
|
||||
tt=NSPS*dt !Duration of symbols (s)
|
||||
baud=1.0/tt !Keying rate (baud)
|
||||
bw=8*baud !Occupied bandwidth (Hz)
|
||||
txt=NZ*dt !Transmission length (s)
|
||||
bandwidth_ratio=2500.0/(fs/2.0)
|
||||
sig=sqrt(2*bandwidth_ratio) * 10.0**(0.05*snrdb)
|
||||
if(snrdb.gt.90.0) sig=1.0
|
||||
txt=NN*NSPS/12000.0
|
||||
|
||||
call genft8(msg,msgsent,itone) !Source-encode, then get itone()
|
||||
write(*,1000) f0,xdt,txt,snrdb,bw,msgsent
|
||||
1000 format('f0:',f9.3,' DT:',f6.2,' TxT:',f6.1,' SNR:',f6.1, &
|
||||
' BW:',f4.1,2x,a22)
|
||||
|
||||
! call sgran()
|
||||
c=0.
|
||||
do ifile=1,nfiles
|
||||
|
||||
c0=0.
|
||||
do isig=1,25
|
||||
f0=(isig+2)*100.0
|
||||
phi=0.0
|
||||
k=-1 + nint(xdt/dt)
|
||||
do j=1,NN !Generate complex waveform
|
||||
dphi=twopi*(f0+itone(j)*baud)*dt
|
||||
if(k.eq.0) phi=-dphi
|
||||
do i=1,NSPS
|
||||
k=k+1
|
||||
phi=phi+dphi
|
||||
if(phi.gt.twopi) phi=phi-twopi
|
||||
xphi=phi
|
||||
if(k.ge.0 .and. k.lt.NMAX) c0(k)=cmplx(cos(xphi),sin(xphi))
|
||||
enddo
|
||||
enddo
|
||||
if(fspread.ne.0.0 .or. delay.ne.0.0) call watterson(c,NMAX,fs,delay,fspread)
|
||||
c=c+c0
|
||||
enddo
|
||||
c=c*sig
|
||||
if(snrdb.lt.90) then
|
||||
do i=0,NMAX-1 !Add gaussian noise at specified SNR
|
||||
xnoise=gran()
|
||||
ynoise=gran()
|
||||
c(i)=c(i) + cmplx(xnoise,ynoise)
|
||||
enddo
|
||||
endif
|
||||
|
||||
fac=32767.0
|
||||
rms=100.0
|
||||
if(snrdb.ge.90.0) iwave(1:NMAX)=nint(fac*real(c))
|
||||
if(snrdb.lt.90.0) iwave(1:NMAX)=nint(rms*real(c))
|
||||
|
||||
h=default_header(12000,NMAX)
|
||||
write(fname,1102) ifile
|
||||
1102 format('000000_',i6.6,'.wav')
|
||||
open(10,file=fname,status='unknown',access='stream')
|
||||
write(10) h,iwave !Save to *.wav file
|
||||
close(10)
|
||||
write(*,1110) ifile,xdt,f0,snrdb,fname
|
||||
1110 format(i4,f7.2,f8.2,f7.1,2x,a17)
|
||||
enddo
|
||||
|
||||
999 end program ft8sim
|
||||
@@ -0,0 +1,64 @@
|
||||
/*==============================================================================
|
||||
Copyright (c) 2001-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)
|
||||
==============================================================================*/
|
||||
#ifndef BOOST_PHOENIX_OBJECT_CONST_CAST_HPP
|
||||
#define BOOST_PHOENIX_OBJECT_CONST_CAST_HPP
|
||||
|
||||
#include <boost/phoenix/core/limits.hpp>
|
||||
#include <boost/phoenix/core/call.hpp>
|
||||
#include <boost/phoenix/core/expression.hpp>
|
||||
#include <boost/phoenix/core/meta_grammar.hpp>
|
||||
#include <boost/phoenix/object/detail/target.hpp>
|
||||
#include <boost/proto/transform/lazy.hpp>
|
||||
|
||||
BOOST_PHOENIX_DEFINE_EXPRESSION(
|
||||
(boost)(phoenix)(const_cast_)
|
||||
, (proto::terminal<detail::target<proto::_> >)
|
||||
(meta_grammar)
|
||||
)
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
struct const_cast_eval
|
||||
{
|
||||
template <typename Sig>
|
||||
struct result;
|
||||
|
||||
template <typename This, typename Target, typename Source, typename Context>
|
||||
struct result<This(Target, Source, Context)>
|
||||
: detail::result_of::target<Target>
|
||||
{};
|
||||
|
||||
template <typename Target, typename Source, typename Context>
|
||||
typename detail::result_of::target<Target>::type
|
||||
operator()(Target, Source const& u, Context const& ctx) const
|
||||
{
|
||||
return
|
||||
const_cast<
|
||||
typename detail::result_of::target<Target>::type
|
||||
>(boost::phoenix::eval(u, ctx));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Dummy>
|
||||
struct default_actions::when<rule::const_cast_, Dummy>
|
||||
: call<const_cast_eval, Dummy>
|
||||
{};
|
||||
|
||||
template <typename T, typename U>
|
||||
inline
|
||||
typename expression::const_cast_<detail::target<T>, U>::type const
|
||||
const_cast_(U const& u)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
const_cast_<detail::target<T>, U>::
|
||||
make(detail::target<T>(), u);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,43 @@
|
||||
/*=============================================================================
|
||||
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_DISTANCE_IMPL_09172005_0751)
|
||||
#define FUSION_DISTANCE_IMPL_09172005_0751
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/mpl/minus.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct vector_iterator_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct distance_impl;
|
||||
|
||||
template <>
|
||||
struct distance_impl<vector_iterator_tag>
|
||||
{
|
||||
template <typename First, typename Last>
|
||||
struct apply : mpl::minus<typename Last::index, typename First::index>
|
||||
{
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static typename mpl::minus<
|
||||
typename Last::index, typename First::index>::type
|
||||
call(First const&, Last const&)
|
||||
{
|
||||
typedef typename mpl::minus<
|
||||
typename Last::index, typename First::index>::type
|
||||
result;
|
||||
return result();
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,40 @@
|
||||
/*=============================================================================
|
||||
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_EQUAL_TO_IMPL_09172005_1120)
|
||||
#define FUSION_EQUAL_TO_IMPL_09172005_1120
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/mpl/equal_to.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct cons_iterator_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct equal_to_impl;
|
||||
|
||||
template <>
|
||||
struct equal_to_impl<cons_iterator_tag>
|
||||
{
|
||||
template <typename I1, typename I2>
|
||||
struct apply
|
||||
: is_same<
|
||||
typename I1::identity
|
||||
, typename I2::identity
|
||||
>
|
||||
{
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
// 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_SI_ANGULAR_VELOCITY_HPP
|
||||
#define BOOST_UNITS_SI_ANGULAR_VELOCITY_HPP
|
||||
|
||||
#include <boost/units/systems/si/base.hpp>
|
||||
#include <boost/units/physical_dimensions/angular_velocity.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace units {
|
||||
|
||||
namespace si {
|
||||
|
||||
typedef unit<angular_velocity_dimension,si::system> angular_velocity;
|
||||
|
||||
BOOST_UNITS_STATIC_CONSTANT(radian_per_second,angular_velocity);
|
||||
BOOST_UNITS_STATIC_CONSTANT(radians_per_second,angular_velocity);
|
||||
|
||||
} // namespace si
|
||||
|
||||
} // namespace units
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_UNITS_SI_ANGULAR_VELOCITY_HPP
|
||||
Reference in New Issue
Block a user