Initial Commit

This commit is contained in:
Jordan Sherer
2018-02-08 21:28:33 -05:00
commit 678c1d3966
14352 changed files with 3176737 additions and 0 deletions
File diff suppressed because one or more lines are too long
@@ -0,0 +1,170 @@
//---------------------------------------------------------------------------//
// Copyright (c) 2013-2015 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_IMAGE_IMAGE_OBJECT_HPP
#define BOOST_COMPUTE_IMAGE_IMAGE_OBJECT_HPP
#include <algorithm>
#include <vector>
#include <boost/compute/config.hpp>
#include <boost/compute/memory_object.hpp>
#include <boost/compute/detail/get_object_info.hpp>
#include <boost/compute/image/image_format.hpp>
namespace boost {
namespace compute {
/// \class image_object
/// \brief Base-class for image objects.
///
/// The image_object class is the base-class for image objects on compute
/// devices.
///
/// \see image1d, image2d, image3d
class image_object : public memory_object
{
public:
image_object()
: memory_object()
{
}
explicit image_object(cl_mem mem, bool retain = true)
: memory_object(mem, retain)
{
}
image_object(const image_object &other)
: memory_object(other)
{
}
image_object& operator=(const image_object &other)
{
if(this != &other){
memory_object::operator=(other);
}
return *this;
}
#ifndef BOOST_COMPUTE_NO_RVALUE_REFERENCES
image_object(image_object&& other) BOOST_NOEXCEPT
: memory_object(std::move(other))
{
}
/// \internal_
image_object& operator=(image_object&& other) BOOST_NOEXCEPT
{
memory_object::operator=(std::move(other));
return *this;
}
#endif // BOOST_COMPUTE_NO_RVALUE_REFERENCES
/// Destroys the image object.
~image_object()
{
}
/// Returns information about the image object.
///
/// \see_opencl_ref{clGetImageInfo}
template<class T>
T get_image_info(cl_mem_info info) const
{
return detail::get_object_info<T>(clGetImageInfo, m_mem, info);
}
/// Returns the format for the image.
image_format format() const
{
return image_format(get_image_info<cl_image_format>(CL_IMAGE_FORMAT));
}
/// \internal_ (deprecated)
image_format get_format() const
{
return format();
}
/// Returns the width of the image.
size_t width() const
{
return get_image_info<size_t>(CL_IMAGE_WIDTH);
}
/// Returns the height of the image.
///
/// For 1D images, this function will return \c 1.
size_t height() const
{
return get_image_info<size_t>(CL_IMAGE_HEIGHT);
}
/// Returns the depth of the image.
///
/// For 1D and 2D images, this function will return \c 1.
size_t depth() const
{
return get_image_info<size_t>(CL_IMAGE_DEPTH);
}
/// Returns the supported image formats for the \p type in \p context.
///
/// \see_opencl_ref{clGetSupportedImageFormats}
static std::vector<image_format>
get_supported_formats(const context &context,
cl_mem_object_type type,
cl_mem_flags flags = read_write)
{
cl_uint count = 0;
clGetSupportedImageFormats(context, flags, type, 0, 0, &count);
std::vector<cl_image_format> cl_formats(count);
clGetSupportedImageFormats(context, flags, type, count, &cl_formats[0], 0);
std::vector<image_format> formats;
formats.reserve(count);
for(cl_uint i = 0; i < count; i++){
formats.push_back(image_format(cl_formats[i]));
}
return formats;
}
/// Returns \c true if \p format is a supported image format for
/// \p type in \p context with \p flags.
static bool is_supported_format(const image_format &format,
const context &context,
cl_mem_object_type type,
cl_mem_flags flags = read_write)
{
const std::vector<image_format> formats =
get_supported_formats(context, type, flags);
return std::find(formats.begin(), formats.end(), format) != formats.end();
}
};
namespace detail {
// set_kernel_arg() specialization for image_object
template<>
struct set_kernel_arg<image_object> : public set_kernel_arg<memory_object> { };
} // end detail namespace
} // end compute namespace
} // end boost namespace
#endif // BOOST_COMPUTE_IMAGE_IMAGE_OBJECT_HPP
Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

@@ -0,0 +1,116 @@
#ifndef BOOST_MPL_VECTOR_AUX_AT_HPP_INCLUDED
#define BOOST_MPL_VECTOR_AUX_AT_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
#include <boost/mpl/at_fwd.hpp>
#include <boost/mpl/vector/aux_/tag.hpp>
#include <boost/mpl/long.hpp>
#include <boost/mpl/void.hpp>
#include <boost/mpl/aux_/nttp_decl.hpp>
#include <boost/mpl/aux_/type_wrapper.hpp>
#include <boost/mpl/aux_/value_wknd.hpp>
#include <boost/mpl/aux_/config/typeof.hpp>
#include <boost/mpl/aux_/config/ctps.hpp>
namespace boost { namespace mpl {
#if defined(BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES)
template< typename Vector, long n_ >
struct v_at_impl
{
typedef long_< (Vector::lower_bound_::value + n_) > index_;
typedef __typeof__( Vector::item_(index_()) ) type;
};
template< typename Vector, long n_ >
struct v_at
: aux::wrapped_type< typename v_at_impl<Vector,n_>::type >
{
};
template<>
struct at_impl< aux::vector_tag >
{
template< typename Vector, typename N > struct apply
: v_at<
Vector
, BOOST_MPL_AUX_VALUE_WKND(N)::value
>
{
};
};
#else
# if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
&& !defined(BOOST_MPL_CFG_NO_NONTYPE_TEMPLATE_PARTIAL_SPEC)
template< typename Vector, BOOST_MPL_AUX_NTTP_DECL(long, n_) > struct v_at;
template< BOOST_MPL_AUX_NTTP_DECL(long, n_) >
struct at_impl< aux::vector_tag<n_> >
{
template< typename Vector, typename N > struct apply
#if !defined(__BORLANDC__)
: v_at<
Vector
, BOOST_MPL_AUX_VALUE_WKND(N)::value
>
{
#else
{
typedef typename v_at<
Vector
, BOOST_MPL_AUX_VALUE_WKND(N)::value
>::type type;
#endif
};
};
# else
namespace aux {
template< BOOST_MPL_AUX_NTTP_DECL(long, n_) > struct v_at_impl
{
template< typename V > struct result_;
};
// to work around ETI, etc.
template<> struct v_at_impl<-1>
{
template< typename V > struct result_
{
typedef void_ type;
};
};
} // namespace aux
template< typename T, BOOST_MPL_AUX_NTTP_DECL(long, n_) >
struct v_at
: aux::v_at_impl<n_>::template result_<T>
{
};
# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
#endif // BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES
}}
#endif // BOOST_MPL_VECTOR_AUX_AT_HPP_INCLUDED
@@ -0,0 +1,20 @@
// Copyright 2005 Alexander Nasonov.
// 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 FILE_boost_type_traits_promote_hpp_INCLUDED
#define FILE_boost_type_traits_promote_hpp_INCLUDED
#include <boost/config.hpp>
#include <boost/type_traits/integral_promotion.hpp>
#include <boost/type_traits/floating_point_promotion.hpp>
namespace boost {
template<class T> struct promote : public integral_promotion<typename floating_point_promotion<T>::type>{};
}
#endif // #ifndef FILE_boost_type_traits_promote_hpp_INCLUDED
@@ -0,0 +1,83 @@
#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_STD_ATOMIC_HPP_INCLUDED
#define BOOST_SMART_PTR_DETAIL_SPINLOCK_STD_ATOMIC_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
//
// Copyright (c) 2014 Peter Dimov
//
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#include <boost/smart_ptr/detail/yield_k.hpp>
#include <atomic>
namespace boost
{
namespace detail
{
class spinlock
{
public:
std::atomic_flag v_;
public:
bool try_lock()
{
return !v_.test_and_set( std::memory_order_acquire );
}
void lock()
{
for( unsigned k = 0; !try_lock(); ++k )
{
boost::detail::yield( k );
}
}
void unlock()
{
v_ .clear( std::memory_order_release );
}
public:
class scoped_lock
{
private:
spinlock & sp_;
scoped_lock( scoped_lock const & );
scoped_lock & operator=( scoped_lock const & );
public:
explicit scoped_lock( spinlock & sp ): sp_( sp )
{
sp.lock();
}
~scoped_lock()
{
sp_.unlock();
}
};
};
} // namespace detail
} // namespace boost
#define BOOST_DETAIL_SPINLOCK_INIT { ATOMIC_FLAG_INIT }
#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_STD_ATOMIC_HPP_INCLUDED
@@ -0,0 +1,89 @@
#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_NT_HPP_INCLUDED
#define BOOST_SMART_PTR_DETAIL_SPINLOCK_NT_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
//
// Copyright (c) 2008 Peter Dimov
//
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#include <boost/assert.hpp>
namespace boost
{
namespace detail
{
class spinlock
{
public:
bool locked_;
public:
inline bool try_lock()
{
if( locked_ )
{
return false;
}
else
{
locked_ = true;
return true;
}
}
inline void lock()
{
BOOST_ASSERT( !locked_ );
locked_ = true;
}
inline void unlock()
{
BOOST_ASSERT( locked_ );
locked_ = false;
}
public:
class scoped_lock
{
private:
spinlock & sp_;
scoped_lock( scoped_lock const & );
scoped_lock & operator=( scoped_lock const & );
public:
explicit scoped_lock( spinlock & sp ): sp_( sp )
{
sp.lock();
}
~scoped_lock()
{
sp_.unlock();
}
};
};
} // namespace detail
} // namespace boost
#define BOOST_DETAIL_SPINLOCK_INIT { false }
#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_NT_HPP_INCLUDED
@@ -0,0 +1,74 @@
#ifndef POINTEE_DWA200415_HPP
# define POINTEE_DWA200415_HPP
//
// Copyright David Abrahams 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)
//
// typename pointee<P>::type provides the pointee type of P.
//
// For example, it is T for T* and X for shared_ptr<X>.
//
// http://www.boost.org/libs/iterator/doc/pointee.html
//
# include <boost/detail/is_incrementable.hpp>
# include <boost/iterator/iterator_traits.hpp>
# include <boost/type_traits/add_const.hpp>
# include <boost/type_traits/remove_cv.hpp>
# include <boost/mpl/if.hpp>
# include <boost/mpl/eval_if.hpp>
namespace boost {
namespace detail
{
template <class P>
struct smart_ptr_pointee
{
typedef typename P::element_type type;
};
template <class Iterator>
struct iterator_pointee
{
typedef typename iterator_traits<Iterator>::value_type value_type;
struct impl
{
template <class T>
static char test(T const&);
static char (& test(value_type&) )[2];
static Iterator& x;
};
BOOST_STATIC_CONSTANT(bool, is_constant = sizeof(impl::test(*impl::x)) == 1);
typedef typename mpl::if_c<
# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
::boost::detail::iterator_pointee<Iterator>::is_constant
# else
is_constant
# endif
, typename add_const<value_type>::type
, value_type
>::type type;
};
}
template <class P>
struct pointee
: mpl::eval_if<
detail::is_incrementable<P>
, detail::iterator_pointee<P>
, detail::smart_ptr_pointee<P>
>
{
};
} // namespace boost
#endif // POINTEE_DWA200415_HPP
@@ -0,0 +1,41 @@
// -*- Mode: C++ -*-
#ifndef DISPLAYTEXT_H
#define DISPLAYTEXT_H
#include <QTextEdit>
#include <QFont>
#include "logbook/logbook.h"
#include "decodedtext.h"
class DisplayText
: public QTextEdit
{
Q_OBJECT
public:
explicit DisplayText(QWidget *parent = 0);
void setContentFont (QFont const&);
void insertLineSpacer(QString const&);
void displayDecodedText(DecodedText decodedText, QString myCall, bool displayDXCCEntity,
LogBook logBook, QColor color_CQ, QColor color_MyCall,
QColor color_DXCC, QColor color_NewCall);
void displayTransmittedText(QString text, QString modeTx, qint32 txFreq,
QColor color_TxMsg, bool bFastMode);
void displayQSY(QString text);
Q_SIGNAL void selectCallsign (bool alt, bool ctrl);
Q_SLOT void appendText (QString const& text, QColor bg = Qt::white);
protected:
void mouseDoubleClickEvent(QMouseEvent *e);
private:
QString appendDXCCWorkedB4(QString message, QString const& callsign, QColor * bg, LogBook logBook,
QColor color_CQ, QColor color_DXCC, QColor color_NewCall);
QFont char_font_;
};
#endif // DISPLAYTEXT_H
@@ -0,0 +1,50 @@
/*=============================================================================
Copyright (c) 2012-2014 Kohei Takahashi
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(BOOST_FUSION_CONVERT_IMPL_10172012_0120)
#define BOOST_FUSION_CONVERT_IMPL_10172012_0120
#include <boost/tuple/tuple.hpp>
#include <boost/fusion/adapted/boost_tuple/detail/build_cons.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
namespace boost { namespace fusion
{
struct boost_tuple_tag;
namespace extension
{
template <typename T>
struct convert_impl;
template <>
struct convert_impl<boost_tuple_tag>
{
template <typename Sequence>
struct apply
{
typedef typename
detail::build_tuple_cons<
typename result_of::begin<Sequence>::type
, typename result_of::end<Sequence>::type
>
build_tuple_cons;
typedef typename build_tuple_cons::type type;
BOOST_FUSION_GPU_ENABLED
static type
call(Sequence& seq)
{
return build_tuple_cons::call(fusion::begin(seq), fusion::end(seq));
}
};
};
}
}}
#endif
@@ -0,0 +1,42 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// basic_binary_oarchive.ipp:
// (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 for updates, documentation, and revision history.
#include <string>
#include <boost/assert.hpp>
#include <algorithm>
#include <cstring>
#include <boost/config.hpp>
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
using ::memcpy;
}
#endif
#include <boost/archive/basic_binary_oarchive.hpp>
namespace boost {
namespace archive {
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// implementation of binary_binary_oarchive
template<class Archive>
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
basic_binary_oarchive<Archive>::init(){
// write signature in an archive version independent manner
const std::string file_signature(BOOST_ARCHIVE_SIGNATURE());
* this->This() << file_signature;
// write library version
const library_version_type v(BOOST_ARCHIVE_VERSION());
* this->This() << v;
}
} // namespace archive
} // namespace boost
@@ -0,0 +1,256 @@
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2010-2016.
// 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/move for documentation.
//
//////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_MOVE_MOVE_HELPERS_HPP
#define BOOST_MOVE_MOVE_HELPERS_HPP
#ifndef BOOST_CONFIG_HPP
# include <boost/config.hpp>
#endif
#
#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
#include <boost/move/core.hpp>
#include <boost/move/utility_core.hpp>
#include <boost/move/detail/type_traits.hpp>
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
#define BOOST_MOVE_CATCH_CONST(U) \
typename ::boost::move_detail::if_< ::boost::move_detail::is_class<U>, BOOST_CATCH_CONST_RLVALUE(U), const U &>::type
#define BOOST_MOVE_CATCH_RVALUE(U)\
typename ::boost::move_detail::if_< ::boost::move_detail::is_class<U>, BOOST_RV_REF(U), ::boost::move_detail::nat>::type
#define BOOST_MOVE_CATCH_FWD(U) BOOST_FWD_REF(U)
#else
#define BOOST_MOVE_CATCH_CONST(U) const U &
#define BOOST_MOVE_CATCH_RVALUE(U) U &&
#define BOOST_MOVE_CATCH_FWD(U) U &&
#endif
////////////////////////////////////////
//
// BOOST_MOVE_CONVERSION_AWARE_CATCH
//
////////////////////////////////////////
#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
template<class RETURN_VALUE, class BOOST_MOVE_TEMPL_PARAM, class TYPE>
struct boost_move_conversion_aware_catch_1
: public ::boost::move_detail::enable_if_and
< RETURN_VALUE
, ::boost::move_detail::is_same<TYPE, BOOST_MOVE_TEMPL_PARAM>
, ::boost::move_detail::is_class<TYPE>
, ::boost::has_move_emulation_disabled<BOOST_MOVE_TEMPL_PARAM>
>
{};
template<class RETURN_VALUE, class BOOST_MOVE_TEMPL_PARAM, class TYPE>
struct boost_move_conversion_aware_catch_2
: public ::boost::move_detail::disable_if_or
< RETURN_VALUE
, ::boost::move_detail::is_same<TYPE, BOOST_MOVE_TEMPL_PARAM>
, ::boost::move_detail::is_rv_impl<BOOST_MOVE_TEMPL_PARAM>
, ::boost::move_detail::and_
< ::boost::move_detail::is_rv_impl<BOOST_MOVE_TEMPL_PARAM>
, ::boost::move_detail::is_class<BOOST_MOVE_TEMPL_PARAM>
>
>
{};
#define BOOST_MOVE_CONVERSION_AWARE_CATCH_COMMON(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION)\
BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_CONST(TYPE) x)\
{ return FWD_FUNCTION(static_cast<const TYPE&>(x)); }\
\
BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_RVALUE(TYPE) x) \
{ return FWD_FUNCTION(::boost::move(x)); }\
\
BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(TYPE &x)\
{ return FWD_FUNCTION(const_cast<const TYPE &>(x)); }\
//
#if defined(BOOST_MOVE_HELPERS_RETURN_SFINAE_BROKEN)
#define BOOST_MOVE_CONVERSION_AWARE_CATCH(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION)\
BOOST_MOVE_CONVERSION_AWARE_CATCH_COMMON(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION)\
\
template<class BOOST_MOVE_TEMPL_PARAM>\
BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(const BOOST_MOVE_TEMPL_PARAM &u,\
typename boost_move_conversion_aware_catch_1< ::boost::move_detail::nat, BOOST_MOVE_TEMPL_PARAM, TYPE>::type* = 0)\
{ return FWD_FUNCTION(u); }\
\
template<class BOOST_MOVE_TEMPL_PARAM>\
BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(const BOOST_MOVE_TEMPL_PARAM &u,\
typename boost_move_conversion_aware_catch_2< ::boost::move_detail::nat, BOOST_MOVE_TEMPL_PARAM, TYPE>::type* = 0)\
{\
TYPE t((u));\
return FWD_FUNCTION(::boost::move(t));\
}\
//
#else
#define BOOST_MOVE_CONVERSION_AWARE_CATCH(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION)\
BOOST_MOVE_CONVERSION_AWARE_CATCH_COMMON(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION)\
\
template<class BOOST_MOVE_TEMPL_PARAM>\
BOOST_MOVE_FORCEINLINE typename boost_move_conversion_aware_catch_1<RETURN_VALUE, BOOST_MOVE_TEMPL_PARAM, TYPE>::type\
PUB_FUNCTION(const BOOST_MOVE_TEMPL_PARAM &u)\
{ return FWD_FUNCTION(u); }\
\
template<class BOOST_MOVE_TEMPL_PARAM>\
BOOST_MOVE_FORCEINLINE typename boost_move_conversion_aware_catch_2<RETURN_VALUE, BOOST_MOVE_TEMPL_PARAM, TYPE>::type\
PUB_FUNCTION(const BOOST_MOVE_TEMPL_PARAM &u)\
{\
TYPE t((u));\
return FWD_FUNCTION(::boost::move(t));\
}\
//
#endif
#elif (defined(_MSC_VER) && (_MSC_VER == 1600))
#define BOOST_MOVE_CONVERSION_AWARE_CATCH(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION)\
BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_CONST(TYPE) x)\
{ return FWD_FUNCTION(static_cast<const TYPE&>(x)); }\
\
BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_RVALUE(TYPE) x) \
{ return FWD_FUNCTION(::boost::move(x)); }\
\
template<class BOOST_MOVE_TEMPL_PARAM>\
BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c\
< !::boost::move_detail::is_same<TYPE, BOOST_MOVE_TEMPL_PARAM>::value\
, RETURN_VALUE >::type\
PUB_FUNCTION(const BOOST_MOVE_TEMPL_PARAM &u)\
{\
TYPE t((u));\
return FWD_FUNCTION(::boost::move(t));\
}\
//
#else //BOOST_NO_CXX11_RVALUE_REFERENCES
#define BOOST_MOVE_CONVERSION_AWARE_CATCH(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION)\
BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_CONST(TYPE) x)\
{ return FWD_FUNCTION(x); }\
\
BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_RVALUE(TYPE) x) \
{ return FWD_FUNCTION(::boost::move(x)); }\
//
#endif //BOOST_NO_CXX11_RVALUE_REFERENCES
////////////////////////////////////////
//
// BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG
//
////////////////////////////////////////
#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
template<class RETURN_VALUE, class BOOST_MOVE_TEMPL_PARAM, class UNLESS_CONVERTIBLE_TO, class TYPE>
struct boost_move_conversion_aware_catch_1arg_1
: public ::boost::move_detail::enable_if_and
< RETURN_VALUE
, ::boost::move_detail::not_< ::boost::move_detail::is_same_or_convertible<BOOST_MOVE_TEMPL_PARAM, UNLESS_CONVERTIBLE_TO> >
, ::boost::move_detail::is_same<TYPE, BOOST_MOVE_TEMPL_PARAM>
, ::boost::has_move_emulation_disabled<BOOST_MOVE_TEMPL_PARAM>
>
{};
template<class RETURN_VALUE, class BOOST_MOVE_TEMPL_PARAM, class UNLESS_CONVERTIBLE_TO, class TYPE>
struct boost_move_conversion_aware_catch_1arg_2
: public ::boost::move_detail::disable_if_or
< RETURN_VALUE
, ::boost::move_detail::is_same_or_convertible< BOOST_MOVE_TEMPL_PARAM, UNLESS_CONVERTIBLE_TO>
, ::boost::move_detail::is_rv_impl<BOOST_MOVE_TEMPL_PARAM>
, ::boost::move_detail::is_same<TYPE, BOOST_MOVE_TEMPL_PARAM>
>
{};
#define BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG_COMMON(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION, ARG1, UNLESS_CONVERTIBLE_TO)\
BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_CONST(TYPE) x)\
{ return FWD_FUNCTION(arg1, static_cast<const TYPE&>(x)); }\
\
BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_RVALUE(TYPE) x) \
{ return FWD_FUNCTION(arg1, ::boost::move(x)); }\
\
BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(ARG1 arg1, TYPE &x)\
{ return FWD_FUNCTION(arg1, const_cast<const TYPE &>(x)); }\
//
#if defined(BOOST_MOVE_HELPERS_RETURN_SFINAE_BROKEN)
#define BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION, ARG1, UNLESS_CONVERTIBLE_TO)\
BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG_COMMON(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION, ARG1, UNLESS_CONVERTIBLE_TO)\
\
template<class BOOST_MOVE_TEMPL_PARAM>\
BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(ARG1 arg1, const BOOST_MOVE_TEMPL_PARAM &u,\
typename boost_move_conversion_aware_catch_1arg_1<void, BOOST_MOVE_TEMPL_PARAM, UNLESS_CONVERTIBLE_TO, TYPE>::type* = 0)\
{ return FWD_FUNCTION(arg1, u); }\
\
template<class BOOST_MOVE_TEMPL_PARAM>\
BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(ARG1 arg1, const BOOST_MOVE_TEMPL_PARAM &u,\
typename boost_move_conversion_aware_catch_1arg_2<void, BOOST_MOVE_TEMPL_PARAM, UNLESS_CONVERTIBLE_TO, TYPE>::type* = 0)\
{\
TYPE t((u));\
return FWD_FUNCTION(arg1, ::boost::move(t));\
}\
//
#else
#define BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION, ARG1, UNLESS_CONVERTIBLE_TO)\
BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG_COMMON(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION, ARG1, UNLESS_CONVERTIBLE_TO)\
\
template<class BOOST_MOVE_TEMPL_PARAM>\
BOOST_MOVE_FORCEINLINE typename boost_move_conversion_aware_catch_1arg_1<RETURN_VALUE, BOOST_MOVE_TEMPL_PARAM, UNLESS_CONVERTIBLE_TO, TYPE>::type\
PUB_FUNCTION(ARG1 arg1, const BOOST_MOVE_TEMPL_PARAM &u)\
{ return FWD_FUNCTION(arg1, u); }\
\
template<class BOOST_MOVE_TEMPL_PARAM>\
BOOST_MOVE_FORCEINLINE typename boost_move_conversion_aware_catch_1arg_2<RETURN_VALUE, BOOST_MOVE_TEMPL_PARAM, UNLESS_CONVERTIBLE_TO, TYPE>::type\
PUB_FUNCTION(ARG1 arg1, const BOOST_MOVE_TEMPL_PARAM &u)\
{\
TYPE t((u));\
return FWD_FUNCTION(arg1, ::boost::move(t));\
}\
//
#endif
#elif (defined(_MSC_VER) && (_MSC_VER == 1600))
#define BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION, ARG1, UNLESS_CONVERTIBLE_TO)\
BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_CONST(TYPE) x)\
{ return FWD_FUNCTION(arg1, static_cast<const TYPE&>(x)); }\
\
BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_RVALUE(TYPE) x) \
{ return FWD_FUNCTION(arg1, ::boost::move(x)); }\
\
template<class BOOST_MOVE_TEMPL_PARAM>\
BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::disable_if_or\
< RETURN_VALUE \
, ::boost::move_detail::is_same<TYPE, BOOST_MOVE_TEMPL_PARAM> \
, ::boost::move_detail::is_same_or_convertible<BOOST_MOVE_TEMPL_PARAM, UNLESS_CONVERTIBLE_TO> \
>::type\
PUB_FUNCTION(ARG1 arg1, const BOOST_MOVE_TEMPL_PARAM &u)\
{\
TYPE t((u));\
return FWD_FUNCTION(arg1, ::boost::move(t));\
}\
//
#else
#define BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION, ARG1, UNLESS_CONVERTIBLE_TO)\
BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_CONST(TYPE) x)\
{ return FWD_FUNCTION(arg1, static_cast<const TYPE&>(x)); }\
\
BOOST_MOVE_FORCEINLINE RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_RVALUE(TYPE) x) \
{ return FWD_FUNCTION(arg1, ::boost::move(x)); }\
//
#endif
#endif //#ifndef BOOST_MOVE_MOVE_HELPERS_HPP
@@ -0,0 +1,68 @@
#ifndef BOOST_MPL_INSERT_IMPL_HPP_INCLUDED
#define BOOST_MPL_INSERT_IMPL_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
#include <boost/mpl/reverse_fold.hpp>
#include <boost/mpl/iterator_range.hpp>
#include <boost/mpl/clear.hpp>
#include <boost/mpl/push_front.hpp>
#include <boost/mpl/aux_/na_spec.hpp>
#include <boost/mpl/aux_/traits_lambda_spec.hpp>
#include <boost/type_traits/is_same.hpp>
namespace boost { namespace mpl {
// default implementation; conrete sequences might override it by
// specializing either the 'insert_impl' or the primary 'insert' template
template< typename Tag >
struct insert_impl
{
template<
typename Sequence
, typename Pos
, typename T
>
struct apply
{
typedef iterator_range<
typename begin<Sequence>::type
, Pos
> first_half_;
typedef iterator_range<
Pos
, typename end<Sequence>::type
> second_half_;
typedef typename reverse_fold<
second_half_
, typename clear<Sequence>::type
, push_front<_,_>
>::type half_sequence_;
typedef typename reverse_fold<
first_half_
, typename push_front<half_sequence_,T>::type
, push_front<_,_>
>::type type;
};
};
BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(3,insert_impl)
}}
#endif // BOOST_MPL_INSERT_IMPL_HPP_INCLUDED
@@ -0,0 +1,100 @@
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,NZ,fs,delay,fspread)
c=c+c0
enddo
c=c*sig
if(snrdb.lt.90) then
do i=0,NZ-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))
iwave(NZ+1:)=0
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,74 @@
#if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
#include <boost/proto/detail/preprocessed/poly_function_funop.hpp>
#elif !defined(BOOST_PP_IS_ITERATING)
#define BOOST_PROTO_NORMALIZE_ARG(Z, N, DATA) \
static_cast<typename normalize_arg<BOOST_PP_CAT(A, N) const &> \
::reference>(BOOST_PP_CAT(a, N)) \
/**/
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/poly_function_funop.hpp")
#endif
///////////////////////////////////////////////////////////////////////////////
// poly_function_funop.hpp
// Contains overloads of poly_function\<\>::operator()
//
// 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, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/detail/poly_function_funop.hpp>))
#include BOOST_PP_ITERATE()
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
#pragma wave option(output: null)
#endif
#undef BOOST_PROTO_NORMALIZE_ARG
#else
#define N BOOST_PP_ITERATION()
template<typename This BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
struct result<This(BOOST_PP_ENUM_PARAMS(N, A))>
: Derived::template impl<
BOOST_PP_ENUM_BINARY_PARAMS(
N
, typename normalize_arg<A
, >::type BOOST_PP_INTERCEPT
)
>
{
typedef typename result::result_type type;
};
template<BOOST_PP_ENUM_PARAMS(N, typename A)>
typename result<
Derived const(
BOOST_PP_ENUM_BINARY_PARAMS(N, A, const & BOOST_PP_INTERCEPT)
)
>::type
operator ()(BOOST_PP_ENUM_BINARY_PARAMS(N, A, const &a)) const
{
result<
Derived const(
BOOST_PP_ENUM_BINARY_PARAMS(N, A, const & BOOST_PP_INTERCEPT)
)
> impl;
return impl(BOOST_PP_ENUM(N, BOOST_PROTO_NORMALIZE_ARG, ~));
}
#undef N
#endif // BOOST_PROTO_DONT_USE_PREPROCESSED_FILES
@@ -0,0 +1,71 @@
/*=============================================================================
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_BEGIN_IMPL_07162005_1031)
#define FUSION_BEGIN_IMPL_07162005_1031
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/view/transform_view/transform_view_fwd.hpp>
namespace boost { namespace fusion
{
template <typename First, typename F>
struct transform_view_iterator;
template <typename First1, typename First2, typename F>
struct transform_view_iterator2;
namespace extension
{
template <typename Tag>
struct begin_impl;
// Unary Version
template <>
struct begin_impl<transform_view_tag>
{
template <typename Sequence>
struct apply
{
typedef typename Sequence::first_type first_type;
typedef typename Sequence::transform_type transform_type;
typedef transform_view_iterator<first_type, transform_type> type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Sequence& s)
{
return type(s.first(), s.f);
}
};
};
// Binary Version
template <>
struct begin_impl<transform_view2_tag>
{
template <typename Sequence>
struct apply
{
typedef typename Sequence::first1_type first1_type;
typedef typename Sequence::first2_type first2_type;
typedef typename Sequence::transform_type transform_type;
typedef transform_view_iterator2<first1_type, first2_type, transform_type> type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Sequence& s)
{
return type(s.first1(), s.first2(), s.f);
}
};
};
}
}}
#endif
@@ -0,0 +1,69 @@
//////////////////////////////////////////////////////////////////////////////
//
// (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/interprocess for documentation.
//
//////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_MOVE_DETAIL_WORKAROUND_HPP
#define BOOST_MOVE_DETAIL_WORKAROUND_HPP
#ifndef BOOST_CONFIG_HPP
# include <boost/config.hpp>
#endif
#
#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#define BOOST_MOVE_PERFECT_FORWARDING
#endif
#if defined(__has_feature)
#define BOOST_MOVE_HAS_FEATURE __has_feature
#else
#define BOOST_MOVE_HAS_FEATURE(x) 0
#endif
#if BOOST_MOVE_HAS_FEATURE(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
#define BOOST_MOVE_ADDRESS_SANITIZER_ON
#endif
//Macros for documentation purposes. For code, expands to the argument
#define BOOST_MOVE_IMPDEF(TYPE) TYPE
#define BOOST_MOVE_SEEDOC(TYPE) TYPE
#define BOOST_MOVE_DOC0PTR(TYPE) TYPE
#define BOOST_MOVE_DOC1ST(TYPE1, TYPE2) TYPE2
#define BOOST_MOVE_I ,
#define BOOST_MOVE_DOCIGN(T1) T1
#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ < 5) && !defined(__clang__)
//Pre-standard rvalue binding rules
#define BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
#elif defined(_MSC_VER) && (_MSC_VER == 1600)
//Standard rvalue binding rules but with some bugs
#define BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG
#define BOOST_MOVE_MSVC_AUTO_MOVE_RETURN_BUG
#elif defined(_MSC_VER) && (_MSC_VER == 1700)
#define BOOST_MOVE_MSVC_AUTO_MOVE_RETURN_BUG
#endif
#if defined(BOOST_MOVE_DISABLE_FORCEINLINE)
#define BOOST_MOVE_FORCEINLINE inline
#elif defined(BOOST_MOVE_FORCEINLINE_IS_BOOST_FORCELINE)
#define BOOST_MOVE_FORCEINLINE BOOST_FORCEINLINE
#elif defined(BOOST_MSVC) && defined(_DEBUG)
//"__forceinline" and MSVC seems to have some bugs in debug mode
#define BOOST_MOVE_FORCEINLINE inline
#elif defined(__GNUC__) && ((__GNUC__ < 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ < 5)))
//Older GCCs have problems with forceinline
#define BOOST_MOVE_FORCEINLINE inline
#else
#define BOOST_MOVE_FORCEINLINE BOOST_FORCEINLINE
#endif
#endif //#ifndef BOOST_MOVE_DETAIL_WORKAROUND_HPP
@@ -0,0 +1,305 @@
/* Boost interval/arith.hpp template implementation file
*
* Copyright 2000 Jens Maurer
* Copyright 2002-2003 Hervé Brönnimann, Guillaume Melquiond, Sylvain Pion
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or
* copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_NUMERIC_INTERVAL_ARITH_HPP
#define BOOST_NUMERIC_INTERVAL_ARITH_HPP
#include <boost/config.hpp>
#include <boost/numeric/interval/interval.hpp>
#include <boost/numeric/interval/detail/bugs.hpp>
#include <boost/numeric/interval/detail/test_input.hpp>
#include <boost/numeric/interval/detail/division.hpp>
#include <algorithm>
namespace boost {
namespace numeric {
/*
* Basic arithmetic operators
*/
template<class T, class Policies> inline
const interval<T, Policies>& operator+(const interval<T, Policies>& x)
{
return x;
}
template<class T, class Policies> inline
interval<T, Policies> operator-(const interval<T, Policies>& x)
{
if (interval_lib::detail::test_input(x))
return interval<T, Policies>::empty();
return interval<T, Policies>(-x.upper(), -x.lower(), true);
}
template<class T, class Policies> inline
interval<T, Policies>& interval<T, Policies>::operator+=(const interval<T, Policies>& r)
{
if (interval_lib::detail::test_input(*this, r))
set_empty();
else {
typename Policies::rounding rnd;
set(rnd.add_down(low, r.low), rnd.add_up(up, r.up));
}
return *this;
}
template<class T, class Policies> inline
interval<T, Policies>& interval<T, Policies>::operator+=(const T& r)
{
if (interval_lib::detail::test_input(*this, r))
set_empty();
else {
typename Policies::rounding rnd;
set(rnd.add_down(low, r), rnd.add_up(up, r));
}
return *this;
}
template<class T, class Policies> inline
interval<T, Policies>& interval<T, Policies>::operator-=(const interval<T, Policies>& r)
{
if (interval_lib::detail::test_input(*this, r))
set_empty();
else {
typename Policies::rounding rnd;
set(rnd.sub_down(low, r.up), rnd.sub_up(up, r.low));
}
return *this;
}
template<class T, class Policies> inline
interval<T, Policies>& interval<T, Policies>::operator-=(const T& r)
{
if (interval_lib::detail::test_input(*this, r))
set_empty();
else {
typename Policies::rounding rnd;
set(rnd.sub_down(low, r), rnd.sub_up(up, r));
}
return *this;
}
template<class T, class Policies> inline
interval<T, Policies>& interval<T, Policies>::operator*=(const interval<T, Policies>& r)
{
return *this = *this * r;
}
template<class T, class Policies> inline
interval<T, Policies>& interval<T, Policies>::operator*=(const T& r)
{
return *this = r * *this;
}
template<class T, class Policies> inline
interval<T, Policies>& interval<T, Policies>::operator/=(const interval<T, Policies>& r)
{
return *this = *this / r;
}
template<class T, class Policies> inline
interval<T, Policies>& interval<T, Policies>::operator/=(const T& r)
{
return *this = *this / r;
}
template<class T, class Policies> inline
interval<T, Policies> operator+(const interval<T, Policies>& x,
const interval<T, Policies>& y)
{
if (interval_lib::detail::test_input(x, y))
return interval<T, Policies>::empty();
typename Policies::rounding rnd;
return interval<T,Policies>(rnd.add_down(x.lower(), y.lower()),
rnd.add_up (x.upper(), y.upper()), true);
}
template<class T, class Policies> inline
interval<T, Policies> operator+(const T& x, const interval<T, Policies>& y)
{
if (interval_lib::detail::test_input(x, y))
return interval<T, Policies>::empty();
typename Policies::rounding rnd;
return interval<T,Policies>(rnd.add_down(x, y.lower()),
rnd.add_up (x, y.upper()), true);
}
template<class T, class Policies> inline
interval<T, Policies> operator+(const interval<T, Policies>& x, const T& y)
{ return y + x; }
template<class T, class Policies> inline
interval<T, Policies> operator-(const interval<T, Policies>& x,
const interval<T, Policies>& y)
{
if (interval_lib::detail::test_input(x, y))
return interval<T, Policies>::empty();
typename Policies::rounding rnd;
return interval<T,Policies>(rnd.sub_down(x.lower(), y.upper()),
rnd.sub_up (x.upper(), y.lower()), true);
}
template<class T, class Policies> inline
interval<T, Policies> operator-(const T& x, const interval<T, Policies>& y)
{
if (interval_lib::detail::test_input(x, y))
return interval<T, Policies>::empty();
typename Policies::rounding rnd;
return interval<T,Policies>(rnd.sub_down(x, y.upper()),
rnd.sub_up (x, y.lower()), true);
}
template<class T, class Policies> inline
interval<T, Policies> operator-(const interval<T, Policies>& x, const T& y)
{
if (interval_lib::detail::test_input(x, y))
return interval<T, Policies>::empty();
typename Policies::rounding rnd;
return interval<T,Policies>(rnd.sub_down(x.lower(), y),
rnd.sub_up (x.upper(), y), true);
}
template<class T, class Policies> inline
interval<T, Policies> operator*(const interval<T, Policies>& x,
const interval<T, Policies>& y)
{
BOOST_USING_STD_MIN();
BOOST_USING_STD_MAX();
typedef interval<T, Policies> I;
if (interval_lib::detail::test_input(x, y))
return I::empty();
typename Policies::rounding rnd;
const T& xl = x.lower();
const T& xu = x.upper();
const T& yl = y.lower();
const T& yu = y.upper();
if (interval_lib::user::is_neg(xl))
if (interval_lib::user::is_pos(xu))
if (interval_lib::user::is_neg(yl))
if (interval_lib::user::is_pos(yu)) // M * M
return I(min BOOST_PREVENT_MACRO_SUBSTITUTION(rnd.mul_down(xl, yu), rnd.mul_down(xu, yl)),
max BOOST_PREVENT_MACRO_SUBSTITUTION(rnd.mul_up (xl, yl), rnd.mul_up (xu, yu)), true);
else // M * N
return I(rnd.mul_down(xu, yl), rnd.mul_up(xl, yl), true);
else
if (interval_lib::user::is_pos(yu)) // M * P
return I(rnd.mul_down(xl, yu), rnd.mul_up(xu, yu), true);
else // M * Z
return I(static_cast<T>(0), static_cast<T>(0), true);
else
if (interval_lib::user::is_neg(yl))
if (interval_lib::user::is_pos(yu)) // N * M
return I(rnd.mul_down(xl, yu), rnd.mul_up(xl, yl), true);
else // N * N
return I(rnd.mul_down(xu, yu), rnd.mul_up(xl, yl), true);
else
if (interval_lib::user::is_pos(yu)) // N * P
return I(rnd.mul_down(xl, yu), rnd.mul_up(xu, yl), true);
else // N * Z
return I(static_cast<T>(0), static_cast<T>(0), true);
else
if (interval_lib::user::is_pos(xu))
if (interval_lib::user::is_neg(yl))
if (interval_lib::user::is_pos(yu)) // P * M
return I(rnd.mul_down(xu, yl), rnd.mul_up(xu, yu), true);
else // P * N
return I(rnd.mul_down(xu, yl), rnd.mul_up(xl, yu), true);
else
if (interval_lib::user::is_pos(yu)) // P * P
return I(rnd.mul_down(xl, yl), rnd.mul_up(xu, yu), true);
else // P * Z
return I(static_cast<T>(0), static_cast<T>(0), true);
else // Z * ?
return I(static_cast<T>(0), static_cast<T>(0), true);
}
template<class T, class Policies> inline
interval<T, Policies> operator*(const T& x, const interval<T, Policies>& y)
{
typedef interval<T, Policies> I;
if (interval_lib::detail::test_input(x, y))
return I::empty();
typename Policies::rounding rnd;
const T& yl = y.lower();
const T& yu = y.upper();
// x is supposed not to be infinite
if (interval_lib::user::is_neg(x))
return I(rnd.mul_down(x, yu), rnd.mul_up(x, yl), true);
else if (interval_lib::user::is_zero(x))
return I(static_cast<T>(0), static_cast<T>(0), true);
else
return I(rnd.mul_down(x, yl), rnd.mul_up(x, yu), true);
}
template<class T, class Policies> inline
interval<T, Policies> operator*(const interval<T, Policies>& x, const T& y)
{ return y * x; }
template<class T, class Policies> inline
interval<T, Policies> operator/(const interval<T, Policies>& x,
const interval<T, Policies>& y)
{
if (interval_lib::detail::test_input(x, y))
return interval<T, Policies>::empty();
if (zero_in(y))
if (!interval_lib::user::is_zero(y.lower()))
if (!interval_lib::user::is_zero(y.upper()))
return interval_lib::detail::div_zero(x);
else
return interval_lib::detail::div_negative(x, y.lower());
else
if (!interval_lib::user::is_zero(y.upper()))
return interval_lib::detail::div_positive(x, y.upper());
else
return interval<T, Policies>::empty();
else
return interval_lib::detail::div_non_zero(x, y);
}
template<class T, class Policies> inline
interval<T, Policies> operator/(const T& x, const interval<T, Policies>& y)
{
if (interval_lib::detail::test_input(x, y))
return interval<T, Policies>::empty();
if (zero_in(y))
if (!interval_lib::user::is_zero(y.lower()))
if (!interval_lib::user::is_zero(y.upper()))
return interval_lib::detail::div_zero<T, Policies>(x);
else
return interval_lib::detail::div_negative<T, Policies>(x, y.lower());
else
if (!interval_lib::user::is_zero(y.upper()))
return interval_lib::detail::div_positive<T, Policies>(x, y.upper());
else
return interval<T, Policies>::empty();
else
return interval_lib::detail::div_non_zero(x, y);
}
template<class T, class Policies> inline
interval<T, Policies> operator/(const interval<T, Policies>& x, const T& y)
{
if (interval_lib::detail::test_input(x, y) || interval_lib::user::is_zero(y))
return interval<T, Policies>::empty();
typename Policies::rounding rnd;
const T& xl = x.lower();
const T& xu = x.upper();
if (interval_lib::user::is_neg(y))
return interval<T, Policies>(rnd.div_down(xu, y), rnd.div_up(xl, y), true);
else
return interval<T, Policies>(rnd.div_down(xl, y), rnd.div_up(xu, y), true);
}
} // namespace numeric
} // namespace boost
#endif // BOOST_NUMERIC_INTERVAL_ARITH_HPP
@@ -0,0 +1,55 @@
//---------------------------------------------------------------------------//
// Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
//
// Distributed under the Boost Software License, Version 1.0
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
// See http://boostorg.github.com/compute for more information.
//---------------------------------------------------------------------------//
#ifndef BOOST_COMPUTE_ALGORITHM_COUNT_HPP
#define BOOST_COMPUTE_ALGORITHM_COUNT_HPP
#include <boost/compute/lambda.hpp>
#include <boost/compute/system.hpp>
#include <boost/compute/command_queue.hpp>
#include <boost/compute/algorithm/count_if.hpp>
#include <boost/compute/type_traits/vector_size.hpp>
namespace boost {
namespace compute {
/// Returns the number of occurrences of \p value in the range
/// [\p first, \p last).
///
/// \see count_if()
template<class InputIterator, class T>
inline size_t count(InputIterator first,
InputIterator last,
const T &value,
command_queue &queue = system::default_queue())
{
typedef typename std::iterator_traits<InputIterator>::value_type value_type;
using ::boost::compute::_1;
using ::boost::compute::lambda::all;
if(vector_size<value_type>::value == 1){
return ::boost::compute::count_if(first,
last,
_1 == value,
queue);
}
else {
return ::boost::compute::count_if(first,
last,
all(_1 == value),
queue);
}
}
} // end compute namespace
} // end boost namespace
#endif // BOOST_COMPUTE_ALGORITHM_COUNT_HPP
@@ -0,0 +1,165 @@
/*==============================================================================
Copyright (c) 2001-2010 Joel de Guzman
Copyright (c) 2010 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)
==============================================================================*/
#ifndef BOOST_PHOENIX_STATEMENT_IF_HPP
#define BOOST_PHOENIX_STATEMENT_IF_HPP
#include <boost/phoenix/config.hpp>
#include <boost/phoenix/core/limits.hpp>
#include <boost/phoenix/core/actor.hpp>
#include <boost/phoenix/core/call.hpp>
#include <boost/phoenix/core/expression.hpp>
#include <boost/phoenix/core/meta_grammar.hpp>
#include <boost/phoenix/core/is_actor.hpp>
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable: 4355) // 'this' used in base member initializer list
#endif
namespace boost { namespace phoenix
{
template <typename> struct if_actor;
}}
BOOST_PHOENIX_DEFINE_EXPRESSION_EXT(
if_actor
, (boost)(phoenix)(if_)
, (meta_grammar) // Cond
(meta_grammar) // Then
)
BOOST_PHOENIX_DEFINE_EXPRESSION(
(boost)(phoenix)(if_else_statement)
, (meta_grammar) // Cond
(meta_grammar) // Then
(meta_grammar) // Else
)
namespace boost { namespace phoenix
{
////////////////////////////////////////////////////////////////////////////
// If-Else statements
////////////////////////////////////////////////////////////////////////////
// Function for evaluating lambdas like:
// if_( foo )[ bar ]
// and
// if_( foo )[ bar ].else_[ baz ]
struct if_else_eval
{
typedef void result_type;
template<typename Cond, typename Then, typename Context>
result_type
operator()(Cond const & cond, Then const & then, Context const & ctx) const
{
if(boost::phoenix::eval(cond, ctx))
boost::phoenix::eval(then, ctx);
}
template<typename Cond, typename Then, typename Else, typename Context>
result_type
operator()(
Cond const & cond
, Then const & then
, Else const & else_
, Context const & ctx
) const
{
if(boost::phoenix::eval(cond, ctx))
boost::phoenix::eval(then, ctx);
else
boost::phoenix::eval(else_, ctx);
}
};
template <typename Dummy>
struct default_actions::when<rule::if_, Dummy>
: call<if_else_eval, Dummy>
{};
template <typename Dummy>
struct default_actions::when<rule::if_else_statement, Dummy>
: call<if_else_eval, Dummy>
{};
// Generator for .else_[ expr ] branch.
template<typename Cond, typename Then>
struct else_gen
{
else_gen(Cond const & cond_, Then const & then_)
: cond(cond_)
, then(then_) {}
template<typename Else>
typename expression::if_else_statement<Cond, Then, Else>::type const
operator[](Else const & else_) const
{
return expression::if_else_statement<Cond, Then, Else>::make(cond, then, else_);
}
Cond cond;
Then then;
};
// We subclass actor so we can provide the member else_ (which is an
// else_gen responsible for the .else_[ expr ] branch).
template<typename Expr>
struct if_actor : actor<Expr>
{
typedef actor<Expr> base_type;
if_actor(base_type const & base)
: base_type(base)
, else_(proto::child_c<0>(*this), proto::child_c<1>(*this))
{}
typedef typename proto::result_of::child_c<Expr, 0>::type cond_type;
typedef typename proto::result_of::child_c<Expr, 1>::type then_type;
else_gen<cond_type, then_type> else_;
};
template <typename Expr>
struct is_actor<if_actor<Expr> >
: mpl::true_
{};
// Generator for if( cond )[ then ] branch.
template<typename Cond>
struct if_gen
{
if_gen(Cond const & cond_)
: cond(cond_) {}
template<typename Then>
typename expression::if_<Cond, Then>::type const
operator[](Then const & then) const
{
return expression::if_<Cond, Then>::make(cond, then);
}
Cond cond;
};
template<typename Cond>
inline
if_gen<Cond> const
if_(Cond const & cond)
{
return if_gen<Cond>(cond);
}
}}
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
#endif
@@ -0,0 +1,41 @@
// Copyright David Abrahams 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)
#ifndef FIND_FROM_PYTHON_DWA2002223_HPP
# define FIND_FROM_PYTHON_DWA2002223_HPP
# include <boost/python/detail/prefix.hpp>
# include <boost/python/converter/rvalue_from_python_data.hpp>
namespace boost { namespace python { namespace converter {
struct registration;
BOOST_PYTHON_DECL void* get_lvalue_from_python(
PyObject* source, registration const&);
BOOST_PYTHON_DECL bool implicit_rvalue_convertible_from_python(
PyObject* source, registration const&);
BOOST_PYTHON_DECL rvalue_from_python_stage1_data rvalue_from_python_stage1(
PyObject* source, registration const&);
BOOST_PYTHON_DECL void* rvalue_from_python_stage2(
PyObject* source, rvalue_from_python_stage1_data&, registration const&);
BOOST_PYTHON_DECL void* rvalue_result_from_python(
PyObject*, rvalue_from_python_stage1_data&);
BOOST_PYTHON_DECL void* reference_result_from_python(PyObject*, registration const&);
BOOST_PYTHON_DECL void* pointer_result_from_python(PyObject*, registration const&);
BOOST_PYTHON_DECL void void_result_from_python(PyObject*);
BOOST_PYTHON_DECL void throw_no_pointer_from_python(PyObject*, registration const&);
BOOST_PYTHON_DECL void throw_no_reference_from_python(PyObject*, registration const&);
}}} // namespace boost::python::converter
#endif // FIND_FROM_PYTHON_DWA2002223_HPP
@@ -0,0 +1,41 @@
// Boost.Range library
//
// Copyright Neil Groves 2009. 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/range/
//
#ifndef BOOST_RANGE_ALGORITHM_EXT_PUSH_FRONT_HPP_INCLUDED
#define BOOST_RANGE_ALGORITHM_EXT_PUSH_FRONT_HPP_INCLUDED
#include <boost/range/config.hpp>
#include <boost/range/concepts.hpp>
#include <boost/range/difference_type.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/detail/implementation_help.hpp>
#include <boost/assert.hpp>
namespace boost
{
namespace range
{
template< class Container, class Range >
inline Container& push_front( Container& on, const Range& from )
{
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<Container> ));
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const Range> ));
BOOST_ASSERT_MSG(!range_detail::is_same_object(on, from),
"cannot copy from a container to itself");
on.insert( on.begin(), boost::begin(from), boost::end(from) );
return on;
}
} // namespace range
using range::push_front;
} // namespace boost
#endif // include guard
@@ -0,0 +1,122 @@
/*=============================================================================
Copyright (c) 2001-2003 Joel de Guzman
Copyright (c) 2001 Daniel Nuffer
http://spirit.sourceforge.net/
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#if !defined(BOOST_SPIRIT_PARSER_ID_HPP)
#define BOOST_SPIRIT_PARSER_ID_HPP
#if defined(BOOST_SPIRIT_DEBUG)
# include <ostream>
#endif
#include <boost/spirit/home/classic/namespace.hpp>
///////////////////////////////////////////////////////////////////////////////
namespace boost { namespace spirit {
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
///////////////////////////////////////////////////////////////////////////
//
// parser_id class
//
///////////////////////////////////////////////////////////////////////////
class parser_id
{
public:
parser_id() : p(0) {}
explicit parser_id(void const* prule) : p(prule) {}
parser_id(std::size_t l_) : l(l_) {}
bool operator==(parser_id const& x) const { return p == x.p; }
bool operator!=(parser_id const& x) const { return !(*this == x); }
bool operator<(parser_id const& x) const { return p < x.p; }
std::size_t to_long() const { return l; }
private:
union
{
void const* p;
std::size_t l;
};
};
#if defined(BOOST_SPIRIT_DEBUG)
inline std::ostream&
operator<<(std::ostream& out, parser_id const& rid)
{
out << (unsigned int)rid.to_long();
return out;
}
#endif
///////////////////////////////////////////////////////////////////////////
//
// parser_tag_base class: base class of all parser tags
//
///////////////////////////////////////////////////////////////////////////
struct parser_tag_base {};
///////////////////////////////////////////////////////////////////////////
//
// parser_address_tag class: tags a parser with its address
//
///////////////////////////////////////////////////////////////////////////
struct parser_address_tag : parser_tag_base
{
parser_id id() const
{ return parser_id(reinterpret_cast<std::size_t>(this)); }
};
///////////////////////////////////////////////////////////////////////////
//
// parser_tag class: tags a parser with an integer ID
//
///////////////////////////////////////////////////////////////////////////
template <int N>
struct parser_tag : parser_tag_base
{
static parser_id id()
{ return parser_id(std::size_t(N)); }
};
///////////////////////////////////////////////////////////////////////////
//
// dynamic_parser_tag class: tags a parser with a dynamically changeable
// integer ID
//
///////////////////////////////////////////////////////////////////////////
class dynamic_parser_tag : public parser_tag_base
{
public:
dynamic_parser_tag()
: tag(std::size_t(0)) {}
parser_id
id() const
{
return
tag.to_long()
? tag
: parser_id(reinterpret_cast<std::size_t>(this));
}
void set_id(parser_id id_) { tag = id_; }
private:
parser_id tag;
};
///////////////////////////////////////////////////////////////////////////////
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
}} // namespace BOOST_SPIRIT_CLASSIC_NS
#endif
@@ -0,0 +1,188 @@
// Copyright Daniel Wallin, David Abrahams 2005. 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)
#ifndef BOOST_PARAMETER_TAGGED_ARGUMENT_050328_HPP
# define BOOST_PARAMETER_TAGGED_ARGUMENT_050328_HPP
# include <boost/parameter/aux_/void.hpp>
# include <boost/parameter/aux_/arg_list.hpp>
# include <boost/parameter/aux_/result_of0.hpp>
# include <boost/mpl/if.hpp>
# include <boost/mpl/apply_wrap.hpp>
# include <boost/mpl/and.hpp>
# include <boost/mpl/not.hpp>
# include <boost/type_traits/is_same.hpp>
# include <boost/type_traits/is_convertible.hpp>
# include <boost/type_traits/is_reference.hpp>
namespace boost { namespace parameter { namespace aux {
struct empty_arg_list;
struct arg_list_tag;
struct tagged_argument_base {};
// Holds a reference to an argument of type Arg associated with
// keyword Keyword
template <class Keyword, class Arg>
struct tagged_argument : tagged_argument_base
{
typedef Keyword key_type;
typedef Arg value_type;
typedef Arg& reference;
tagged_argument(reference x) : value(x) {}
// A metafunction class that, given a keyword and a default
// type, returns the appropriate result type for a keyword
// lookup given that default
struct binding
{
template <class KW, class Default, class Reference>
struct apply
{
typedef typename mpl::eval_if<
boost::is_same<KW, key_type>
, mpl::if_<Reference, reference, value_type>
, mpl::identity<Default>
>::type type;
};
};
// Comma operator to compose argument list without using parameters<>.
// Useful for argument lists with undetermined length.
template <class Keyword2, class Arg2>
arg_list<
tagged_argument<Keyword, Arg>
, arg_list<tagged_argument<Keyword2, Arg2> >
>
operator,(tagged_argument<Keyword2, Arg2> x) const
{
return arg_list<
tagged_argument<Keyword, Arg>
, arg_list<tagged_argument<Keyword2, Arg2> >
>(
*this
, arg_list<tagged_argument<Keyword2, Arg2> >(x, empty_arg_list())
);
}
reference operator[](keyword<Keyword> const&) const
{
return value;
}
# if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
template <class KW, class Default>
Default& get_with_default(default_<KW,Default> const& x, int) const
{
return x.value;
}
template <class Default>
reference get_with_default(default_<key_type,Default> const&, long) const
{
return value;
}
template <class KW, class Default>
typename mpl::apply_wrap3<binding, KW, Default&, mpl::true_>::type
operator[](default_<KW,Default> const& x) const
{
return get_with_default(x, 0L);
}
template <class KW, class F>
typename result_of0<F>::type
get_with_lazy_default(lazy_default<KW,F> const& x, int) const
{
return x.compute_default();
}
template <class F>
reference get_with_lazy_default(lazy_default<key_type,F> const&, long) const
{
return value;
}
template <class KW, class F>
typename mpl::apply_wrap3<
binding,KW
, typename result_of0<F>::type
, mpl::true_
>::type
operator[](lazy_default<KW,F> const& x) const
{
return get_with_lazy_default(x, 0L);
}
# else
template <class Default>
reference operator[](default_<key_type,Default> const& ) const
{
return value;
}
template <class F>
reference operator[](lazy_default<key_type,F> const& ) const
{
return value;
}
template <class KW, class Default>
Default& operator[](default_<KW,Default> const& x) const
{
return x.value;
}
template <class KW, class F>
typename result_of0<F>::type operator[](lazy_default<KW,F> const& x) const
{
return x.compute_default();
}
template <class ParameterRequirements>
static typename ParameterRequirements::has_default
satisfies(ParameterRequirements*);
template <class HasDefault, class Predicate>
static typename mpl::apply1<Predicate, value_type>::type
satisfies(
parameter_requirements<key_type,Predicate,HasDefault>*
);
# endif
reference value;
# if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310))
// warning suppression
private:
void operator=(tagged_argument const&);
public:
# endif
// MPL sequence support
typedef tagged_argument type; // Convenience for users
typedef empty_arg_list tail_type; // For the benefit of iterators
typedef arg_list_tag tag; // For dispatching to sequence intrinsics
};
// Defines a metafunction, is_tagged_argument, that identifies
// tagged_argument specializations and their derived classes.
template <class T>
struct is_tagged_argument_aux
: is_convertible<T*,tagged_argument_base const*>
{};
template <class T>
struct is_tagged_argument
: mpl::and_<
mpl::not_<is_reference<T> >
, is_tagged_argument_aux<T>
>
{};
}}} // namespace boost::parameter::aux
#endif // BOOST_PARAMETER_TAGGED_ARGUMENT_050328_HPP
@@ -0,0 +1,93 @@
// (C) Copyright John Maddock 2007.
// 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)
//
// This file is machine generated, do not edit by hand
// Unrolled polynomial evaluation using second order Horners rule
#ifndef BOOST_MATH_TOOLS_POLY_EVAL_7_HPP
#define BOOST_MATH_TOOLS_POLY_EVAL_7_HPP
namespace boost{ namespace math{ namespace tools{ namespace detail{
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T*, const V&, const mpl::int_<0>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>(0);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>(a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>(a[1] * x + a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) BOOST_MATH_NOEXCEPT(V)
{
V x2 = x * x;
V t[2];
t[0] = static_cast<V>(a[4] * x2 + a[2]);
t[1] = static_cast<V>(a[3] * x2 + a[1]);
t[0] *= x2;
t[0] += static_cast<V>(a[0]);
t[1] *= x;
return t[0] + t[1];
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) BOOST_MATH_NOEXCEPT(V)
{
V x2 = x * x;
V t[2];
t[0] = a[5] * x2 + a[3];
t[1] = a[4] * x2 + a[2];
t[0] *= x2;
t[1] *= x2;
t[0] += static_cast<V>(a[1]);
t[1] += static_cast<V>(a[0]);
t[0] *= x;
return t[0] + t[1];
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) BOOST_MATH_NOEXCEPT(V)
{
V x2 = x * x;
V t[2];
t[0] = static_cast<V>(a[6] * x2 + a[4]);
t[1] = static_cast<V>(a[5] * x2 + a[3]);
t[0] *= x2;
t[1] *= x2;
t[0] += static_cast<V>(a[2]);
t[1] += static_cast<V>(a[1]);
t[0] *= x2;
t[0] += static_cast<V>(a[0]);
t[1] *= x;
return t[0] + t[1];
}
}}}} // namespaces
#endif // include guard
@@ -0,0 +1,97 @@
// (C) Copyright John Maddock 2007.
// 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)
//
// This file is machine generated, do not edit by hand
// Polynomial evaluation using second order Horners rule
#ifndef BOOST_MATH_TOOLS_POLY_EVAL_11_HPP
#define BOOST_MATH_TOOLS_POLY_EVAL_11_HPP
namespace boost{ namespace math{ namespace tools{ namespace detail{
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T*, const V&, const mpl::int_<0>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>(0);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>(a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>(a[1] * x + a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) BOOST_MATH_NOEXCEPT(V)
{
V x2 = x * x;
return static_cast<V>((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) BOOST_MATH_NOEXCEPT(V)
{
V x2 = x * x;
return static_cast<V>(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) BOOST_MATH_NOEXCEPT(V)
{
V x2 = x * x;
return static_cast<V>(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) BOOST_MATH_NOEXCEPT(V)
{
V x2 = x * x;
return static_cast<V>((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) BOOST_MATH_NOEXCEPT(V)
{
V x2 = x * x;
return static_cast<V>((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) BOOST_MATH_NOEXCEPT(V)
{
V x2 = x * x;
return static_cast<V>(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) BOOST_MATH_NOEXCEPT(V)
{
V x2 = x * x;
return static_cast<V>(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
}
}}}} // namespaces
#endif // include guard
@@ -0,0 +1,376 @@
// Boost.Range library
//
// Copyright Thorsten Ottosen 2003-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)
//
// For more information, see http://www.boost.org/libs/range/
//
#ifndef BOOST_RANGE_DETAIL_DETAIL_STR_HPP
#define BOOST_RANGE_DETAIL_DETAIL_STR_HPP
#include <boost/config.hpp> // BOOST_MSVC
#include <boost/range/iterator.hpp>
namespace boost
{
namespace range_detail
{
//
// iterator
//
template<>
struct range_iterator_<char_array_>
{
template< typename T >
struct pts
{
typedef BOOST_RANGE_DEDUCED_TYPENAME
remove_extent<T>::type* type;
};
};
template<>
struct range_iterator_<char_ptr_>
{
template< typename S >
struct pts
{
typedef char* type;
};
};
template<>
struct range_iterator_<const_char_ptr_>
{
template< typename S >
struct pts
{
typedef const char* type;
};
};
template<>
struct range_iterator_<wchar_t_ptr_>
{
template< typename S >
struct pts
{
typedef wchar_t* type;
};
};
template<>
struct range_iterator_<const_wchar_t_ptr_>
{
template< typename S >
struct pts
{
typedef const wchar_t* type;
};
};
//
// const iterator
//
template<>
struct range_const_iterator_<char_array_>
{
template< typename T >
struct pts
{
typedef const BOOST_RANGE_DEDUCED_TYPENAME
remove_extent<T>::type* type;
};
};
template<>
struct range_const_iterator_<char_ptr_>
{
template< typename S >
struct pts
{
typedef const char* type;
};
};
template<>
struct range_const_iterator_<const_char_ptr_>
{
template< typename S >
struct pts
{
typedef const char* type;
};
};
template<>
struct range_const_iterator_<wchar_t_ptr_>
{
template< typename S >
struct pts
{
typedef const wchar_t* type;
};
};
template<>
struct range_const_iterator_<const_wchar_t_ptr_>
{
template< typename S >
struct pts
{
typedef const wchar_t* type;
};
};
}
}
#include <boost/range/detail/begin.hpp>
#include <boost/range/detail/end.hpp>
#include <boost/range/detail/size_type.hpp>
#include <boost/range/detail/value_type.hpp>
#include <boost/range/detail/common.hpp>
namespace boost
{
namespace range_detail
{
//
// str_begin()
//
template<>
struct range_begin<char_ptr_>
{
static char* fun( char* s )
{
return s;
}
};
template<>
struct range_begin<const_char_ptr_>
{
static const char* fun( const char* s )
{
return s;
}
};
template<>
struct range_begin<wchar_t_ptr_>
{
static wchar_t* fun( wchar_t* s )
{
return s;
}
};
template<>
struct range_begin<const_wchar_t_ptr_>
{
static const wchar_t* fun( const wchar_t* s )
{
return s;
}
};
template< typename C >
inline BOOST_RANGE_DEDUCED_TYPENAME range_iterator<C>::type
str_begin( C& c )
{
return range_detail::range_begin< BOOST_RANGE_DEDUCED_TYPENAME
range_detail::range<C>::type >::fun( c );
}
//
// str_end()
//
template<>
struct range_end<char_array_>
{
template< typename T, std::size_t sz >
static T* fun( T BOOST_RANGE_ARRAY_REF()[sz] )
{
return boost::range_detail::array_end( boost_range_array );
}
};
template<>
struct range_end<wchar_t_array_>
{
template< typename T, std::size_t sz >
static T* fun( T BOOST_RANGE_ARRAY_REF()[sz] )
{
return boost::range_detail::array_end( boost_range_array );
}
};
template<>
struct range_end<char_ptr_>
{
static char* fun( char* s )
{
return boost::range_detail::str_end( s );
}
};
template<>
struct range_end<const_char_ptr_>
{
static const char* fun( const char* s )
{
return boost::range_detail::str_end( s );
}
};
template<>
struct range_end<wchar_t_ptr_>
{
static wchar_t* fun( wchar_t* s )
{
return boost::range_detail::str_end( s );
}
};
template<>
struct range_end<const_wchar_t_ptr_>
{
static const wchar_t* fun( const wchar_t* s )
{
return boost::range_detail::str_end( s );
}
};
template< typename C >
inline BOOST_RANGE_DEDUCED_TYPENAME range_iterator<C>::type
str_end( C& c )
{
return range_detail::range_end< BOOST_RANGE_DEDUCED_TYPENAME
range_detail::range<C>::type >::fun( c );
}
//
// size_type
//
template<>
struct range_size_type_<char_array_>
{
template< typename A >
struct pts
{
typedef std::size_t type;
};
};
template<>
struct range_size_type_<char_ptr_>
{
template< typename S >
struct pts
{
typedef std::size_t type;
};
};
template<>
struct range_size_type_<const_char_ptr_>
{
template< typename S >
struct pts
{
typedef std::size_t type;
};
};
template<>
struct range_size_type_<wchar_t_ptr_>
{
template< typename S >
struct pts
{
typedef std::size_t type;
};
};
template<>
struct range_size_type_<const_wchar_t_ptr_>
{
template< typename S >
struct pts
{
typedef std::size_t type;
};
};
//
// value_type
//
template<>
struct range_value_type_<char_array_>
{
template< typename T >
struct pts
{
typedef char type;
};
};
template<>
struct range_value_type_<char_ptr_>
{
template< typename S >
struct pts
{
typedef char type;
};
};
template<>
struct range_value_type_<const_char_ptr_>
{
template< typename S >
struct pts
{
typedef const char type;
};
};
template<>
struct range_value_type_<wchar_t_ptr_>
{
template< typename S >
struct pts
{
typedef wchar_t type;
};
};
template<>
struct range_value_type_<const_wchar_t_ptr_>
{
template< typename S >
struct pts
{
typedef const wchar_t type;
};
};
} // namespace 'range_detail'
} // namespace 'boost'
#endif
@@ -0,0 +1,151 @@
/*=============================================================================
Copyright (c) 1998-2003 Joel de Guzman
http://spirit.sourceforge.net/
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#if !defined(BOOST_SPIRIT_COMPOSITE_HPP)
#define BOOST_SPIRIT_COMPOSITE_HPP
///////////////////////////////////////////////////////////////////////////////
#include <boost/compressed_pair.hpp>
#include <boost/spirit/home/classic/namespace.hpp>
///////////////////////////////////////////////////////////////////////////////
namespace boost { namespace spirit {
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
#pragma warning(push)
#pragma warning(disable:4512) //assignment operator could not be generated
#endif
///////////////////////////////////////////////////////////////////////////
//
// unary class.
//
// Composite class composed of a single subject. This template class
// is parameterized by the subject type S and a base class to
// inherit from, BaseT. The unary class is meant to be a base class
// to inherit from. The inheritance structure, given the BaseT
// template parameter places the unary class in the middle of a
// linear, single parent hierarchy. For instance, given a class S
// and a base class B, a class D can derive from unary:
//
// struct D : public unary<S, B> {...};
//
// The inheritance structure is thus:
//
// B
// |
// unary (has S)
// |
// D
//
// The subject can be accessed from the derived class D as:
// this->subject();
//
// Typically, the subject S is specified as typename S::embed_t.
// embed_t specifies how the subject is embedded in the composite
// (See parser.hpp for details).
//
///////////////////////////////////////////////////////////////////////////
template <typename S, typename BaseT>
class unary : public BaseT
{
public:
typedef BaseT base_t;
typedef typename boost::call_traits<S>::param_type param_t;
typedef typename boost::call_traits<S>::const_reference return_t;
typedef S subject_t;
typedef typename S::embed_t subject_embed_t;
unary(param_t subj_)
: base_t(), subj(subj_) {}
unary(BaseT const& base, param_t subj_)
: base_t(base), subj(subj_) {}
return_t
subject() const
{ return subj; }
private:
subject_embed_t subj;
};
///////////////////////////////////////////////////////////////////////////
//
// binary class.
//
// Composite class composed of a pair (left and right). This
// template class is parameterized by the left and right subject
// types A and B and a base class to inherit from, BaseT. The binary
// class is meant to be a base class to inherit from. The
// inheritance structure, given the BaseT template parameter places
// the binary class in the middle of a linear, single parent
// hierarchy. For instance, given classes X and Y and a base class
// B, a class D can derive from binary:
//
// struct D : public binary<X, Y, B> {...};
//
// The inheritance structure is thus:
//
// B
// |
// binary (has X and Y)
// |
// D
//
// The left and right subjects can be accessed from the derived
// class D as: this->left(); and this->right();
//
// Typically, the pairs X and Y are specified as typename X::embed_t
// and typename Y::embed_t. embed_t specifies how the subject is
// embedded in the composite (See parser.hpp for details).
//
///////////////////////////////////////////////////////////////////////////////
template <typename A, typename B, typename BaseT>
class binary : public BaseT
{
public:
typedef BaseT base_t;
typedef typename boost::call_traits<A>::param_type left_param_t;
typedef typename boost::call_traits<A>::const_reference left_return_t;
typedef typename boost::call_traits<B>::param_type right_param_t;
typedef typename boost::call_traits<B>::const_reference right_return_t;
typedef A left_t;
typedef typename A::embed_t left_embed_t;
typedef B right_t;
typedef typename B::embed_t right_embed_t;
binary(left_param_t a, right_param_t b)
: base_t(), subj(a, b) {}
left_return_t
left() const
{ return subj.first(); }
right_return_t
right() const
{ return subj.second(); }
private:
boost::compressed_pair<left_embed_t, right_embed_t> subj;
};
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
#pragma warning(pop)
#endif
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
}} // namespace BOOST_SPIRIT_CLASSIC_NS
#endif
@@ -0,0 +1,78 @@
/*=============================================================================
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_REPLACE_08182005_0841)
#define FUSION_REPLACE_08182005_0841
#include <boost/fusion/support/config.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/mpl/if.hpp>
#include <boost/type_traits/remove_reference.hpp>
namespace boost { namespace fusion { namespace detail
{
template <bool is_convertible>
struct replacer_helper;
template <>
struct replacer_helper<false>
{
template <typename U, typename T>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static U&
call(U& x, T const&, T const&)
{
return x;
}
};
template <>
struct replacer_helper<true>
{
template <typename U, typename T>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static U
call(U& x, T const& old_value, T const& new_value)
{
return (x == old_value) ? new_value : x;
}
};
template <typename T>
struct replacer
{
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
replacer(T const& in_old_value, T const& in_new_value)
: old_value(in_old_value), new_value(in_new_value) {}
template<typename Sig>
struct result;
template <typename U1, typename U2>
struct result<replacer<U1>(U2)>
{
typedef typename remove_reference<U2>::type value;
typedef typename
mpl::if_<is_convertible<T, value>, value, value const&>::type
type;
};
template <typename U>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
typename result<replacer(U)>::type
operator()(U const& x) const
{
return replacer_helper<is_convertible<T, U>::value>::
call(x, old_value, new_value);
}
T old_value;
T new_value;
};
}}}
#endif
@@ -0,0 +1,588 @@
/*
[auto_generated]
boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp
[begin_description]
Base class for all explicit Runge Kutta stepper which are also error steppers.
[end_description]
Copyright 2010-2013 Karsten Ahnert
Copyright 2010-2012 Mario Mulansky
Copyright 2012 Christoph Koke
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or
copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_BASE_EXPLICIT_ERROR_STEPPER_BASE_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_STEPPER_BASE_EXPLICIT_ERROR_STEPPER_BASE_HPP_INCLUDED
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/numeric/odeint/util/bind.hpp>
#include <boost/numeric/odeint/util/unwrap_reference.hpp>
#include <boost/numeric/odeint/util/state_wrapper.hpp>
#include <boost/numeric/odeint/util/is_resizeable.hpp>
#include <boost/numeric/odeint/util/resizer.hpp>
#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
#include <boost/numeric/odeint/stepper/base/algebra_stepper_base.hpp>
namespace boost {
namespace numeric {
namespace odeint {
/*
* base class for explicit stepper and error steppers
* models the stepper AND the error stepper concept
*
* this class provides the following do_step variants:
* do_step( sys , x , t , dt )
* do_step( sys , x , dxdt , t , dt )
* do_step( sys , in , t , out , dt )
* do_step( sys , in , dxdt , t , out , dt )
* do_step( sys , x , t , dt , xerr )
* do_step( sys , x , dxdt , t , dt , xerr )
* do_step( sys , in , t , out , dt , xerr )
* do_step( sys , in , dxdt , t , out , dt , xerr )
*/
template<
class Stepper ,
unsigned short Order ,
unsigned short StepperOrder ,
unsigned short ErrorOrder ,
class State ,
class Value ,
class Deriv ,
class Time ,
class Algebra ,
class Operations ,
class Resizer
>
class explicit_error_stepper_base : public algebra_stepper_base< Algebra , Operations >
{
public:
typedef algebra_stepper_base< Algebra , Operations > algebra_stepper_base_type;
typedef typename algebra_stepper_base_type::algebra_type algebra_type;
typedef State state_type;
typedef Value value_type;
typedef Deriv deriv_type;
typedef Time time_type;
typedef Resizer resizer_type;
typedef Stepper stepper_type;
typedef explicit_error_stepper_tag stepper_category;
#ifndef DOXYGEN_SKIP
typedef state_wrapper< state_type > wrapped_state_type;
typedef state_wrapper< deriv_type > wrapped_deriv_type;
typedef explicit_error_stepper_base< Stepper , Order , StepperOrder , ErrorOrder ,
State , Value , Deriv , Time , Algebra , Operations , Resizer > internal_stepper_base_type;
#endif
typedef unsigned short order_type;
static const order_type order_value = Order;
static const order_type stepper_order_value = StepperOrder;
static const order_type error_order_value = ErrorOrder;
explicit_error_stepper_base( const algebra_type &algebra = algebra_type() )
: algebra_stepper_base_type( algebra )
{ }
order_type order( void ) const
{
return order_value;
}
order_type stepper_order( void ) const
{
return stepper_order_value;
}
order_type error_order( void ) const
{
return error_order_value;
}
/*
* Version 1 : do_step( sys , x , t , dt )
*
* the two overloads are needed in order to solve the forwarding problem
*/
template< class System , class StateInOut >
void do_step( System system , StateInOut &x , time_type t , time_type dt )
{
do_step_v1( system , x , t , dt );
}
/**
* \brief Second version to solve the forwarding problem, can be called with Boost.Range as StateInOut.
*/
template< class System , class StateInOut >
void do_step( System system , const StateInOut &x , time_type t , time_type dt )
{
do_step_v1( system , x , t , dt );
}
/*
* Version 2 : do_step( sys , x , dxdt , t , dt )
*
* this version does not solve the forwarding problem, boost.range can not be used
*
* the disable is needed to avoid ambiguous overloads if state_type = time_type
*/
template< class System , class StateInOut , class DerivIn >
typename boost::disable_if< boost::is_same< DerivIn , time_type > , void >::type
do_step( System system , StateInOut &x , const DerivIn &dxdt , time_type t , time_type dt )
{
this->stepper().do_step_impl( system , x , dxdt , t , x , dt );
}
/*
* named Version 2: do_step_dxdt_impl( sys , in , dxdt , t , dt )
*
* this version is needed when this stepper is used for initializing
* multistep stepper like adams-bashforth. Hence we provide an explicitely
* named version that is not disabled. Meant for internal use only.
*/
template < class System, class StateInOut, class DerivIn >
void do_step_dxdt_impl( System system, StateInOut &x, const DerivIn &dxdt,
time_type t, time_type dt )
{
this->stepper().do_step_impl( system , x , dxdt , t , x , dt );
}
/*
* Version 3 : do_step( sys , in , t , out , dt )
*
* this version does not solve the forwarding problem, boost.range can not be used
*
* the disable is needed to avoid ambiguous overloads if state_type = time_type
*/
template< class System , class StateIn , class StateOut >
typename boost::disable_if< boost::is_same< StateIn , time_type > , void >::type
do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt )
{
typename odeint::unwrap_reference< System >::type &sys = system;
m_resizer.adjust_size( in , detail::bind( &internal_stepper_base_type::template resize_impl<StateIn> , detail::ref( *this ) , detail::_1 ) );
sys( in , m_dxdt.m_v ,t );
this->stepper().do_step_impl( system , in , m_dxdt.m_v , t , out , dt );
}
/*
* Version 4 :do_step( sys , in , dxdt , t , out , dt )
*
* this version does not solve the forwarding problem, boost.range can not be used
*
* the disable is needed to avoid ambiguous overloads if state_type = time_type
*/
template< class System , class StateIn , class DerivIn , class StateOut >
typename boost::disable_if< boost::is_same< DerivIn , time_type > , void >::type
do_step( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt )
{
this->stepper().do_step_impl( system , in , dxdt , t , out , dt );
}
/*
* named Version 4: do_step_dxdt_impl( sys , in , dxdt , t , out, dt )
*
* this version is needed when this stepper is used for initializing
* multistep stepper like adams-bashforth. Hence we provide an explicitely
* named version that is not disabled. Meant for internal use only.
*/
template < class System, class StateIn, class DerivIn, class StateOut >
void do_step_dxdt_impl( System system, const StateIn &in,
const DerivIn &dxdt, time_type t, StateOut &out,
time_type dt )
{
this->stepper().do_step_impl( system , in , dxdt , t , out , dt );
}
/*
* Version 5 :do_step( sys , x , t , dt , xerr )
*
* the two overloads are needed in order to solve the forwarding problem
*/
template< class System , class StateInOut , class Err >
void do_step( System system , StateInOut &x , time_type t , time_type dt , Err &xerr )
{
do_step_v5( system , x , t , dt , xerr );
}
/**
* \brief Second version to solve the forwarding problem, can be called with Boost.Range as StateInOut.
*/
template< class System , class StateInOut , class Err >
void do_step( System system , const StateInOut &x , time_type t , time_type dt , Err &xerr )
{
do_step_v5( system , x , t , dt , xerr );
}
/*
* Version 6 :do_step( sys , x , dxdt , t , dt , xerr )
*
* this version does not solve the forwarding problem, boost.range can not be used
*
* the disable is needed to avoid ambiguous overloads if state_type = time_type
*/
template< class System , class StateInOut , class DerivIn , class Err >
typename boost::disable_if< boost::is_same< DerivIn , time_type > , void >::type
do_step( System system , StateInOut &x , const DerivIn &dxdt , time_type t , time_type dt , Err &xerr )
{
this->stepper().do_step_impl( system , x , dxdt , t , x , dt , xerr );
}
/*
* Version 7 : do_step( sys , in , t , out , dt , xerr )
*
* this version does not solve the forwarding problem, boost.range can not be used
*/
template< class System , class StateIn , class StateOut , class Err >
void do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt , Err &xerr )
{
typename odeint::unwrap_reference< System >::type &sys = system;
m_resizer.adjust_size( in , detail::bind( &internal_stepper_base_type::template resize_impl<StateIn> , detail::ref( *this ) , detail::_1 ) );
sys( in , m_dxdt.m_v ,t );
this->stepper().do_step_impl( system , in , m_dxdt.m_v , t , out , dt , xerr );
}
/*
* Version 8 : do_step( sys , in , dxdt , t , out , dt , xerr )
*
* this version does not solve the forwarding problem, boost.range can not be used
*/
template< class System , class StateIn , class DerivIn , class StateOut , class Err >
void do_step( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt , Err &xerr )
{
this->stepper().do_step_impl( system , in , dxdt , t , out , dt , xerr );
}
template< class StateIn >
void adjust_size( const StateIn &x )
{
resize_impl( x );
}
private:
template< class System , class StateInOut >
void do_step_v1( System system , StateInOut &x , time_type t , time_type dt )
{
typename odeint::unwrap_reference< System >::type &sys = system;
m_resizer.adjust_size( x , detail::bind( &internal_stepper_base_type::template resize_impl<StateInOut> , detail::ref( *this ) , detail::_1 ) );
sys( x , m_dxdt.m_v , t );
this->stepper().do_step_impl( system , x , m_dxdt.m_v , t , x , dt );
}
template< class System , class StateInOut , class Err >
void do_step_v5( System system , StateInOut &x , time_type t , time_type dt , Err &xerr )
{
typename odeint::unwrap_reference< System >::type &sys = system;
m_resizer.adjust_size( x , detail::bind( &internal_stepper_base_type::template resize_impl<StateInOut> , detail::ref( *this ) , detail::_1 ) );
sys( x , m_dxdt.m_v ,t );
this->stepper().do_step_impl( system , x , m_dxdt.m_v , t , x , dt , xerr );
}
template< class StateIn >
bool resize_impl( const StateIn &x )
{
return adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() );
}
stepper_type& stepper( void )
{
return *static_cast< stepper_type* >( this );
}
const stepper_type& stepper( void ) const
{
return *static_cast< const stepper_type* >( this );
}
resizer_type m_resizer;
protected:
wrapped_deriv_type m_dxdt;
};
/******** DOXYGEN *******/
/**
* \class explicit_error_stepper_base
* \brief Base class for explicit steppers with error estimation. This class can used with
* controlled steppers for step size control.
*
* This class serves as the base class for all explicit steppers with algebra and operations. In contrast to
* explicit_stepper_base it also estimates the error and can be used in a controlled stepper to provide
* step size control.
*
* \note This stepper provides `do_step` methods with and without error estimation. It has therefore three orders,
* one for the order of a step if the error is not estimated. The other two orders are the orders of the step and
* the error step if the error estimation is performed.
*
* explicit_error_stepper_base is used as the interface in a CRTP (currently recurring template
* pattern). In order to work correctly the parent class needs to have a method
* `do_step_impl( system , in , dxdt_in , t , out , dt , xerr )`.
* explicit_error_stepper_base derives from algebra_stepper_base.
*
* explicit_error_stepper_base provides several overloaded `do_step` methods, see the list below. Only two of them
* are needed to fulfill the Error Stepper concept. The other ones are for convenience and for performance. Some
* of them simply update the state out-of-place, while other expect that the first derivative at `t` is passed to the
* stepper.
*
* - `do_step( sys , x , t , dt )` - The classical `do_step` method needed to fulfill the Error Stepper concept. The
* state is updated in-place. A type modelling a Boost.Range can be used for x.
* - `do_step( sys , x , dxdt , t , dt )` - This method updates the state in-place, but the derivative at the point `t`
* must be explicitly passed in `dxdt`.
* - `do_step( sys , in , t , out , dt )` - This method updates the state out-of-place, hence the result of the step
* is stored in `out`.
* - `do_step( sys , in , dxdt , t , out , dt )` - This method update the state out-of-place and expects that the
* derivative at the point `t` is explicitly passed in `dxdt`. It is a combination of the two `do_step` methods
* above.
* - `do_step( sys , x , t , dt , xerr )` - This `do_step` method is needed to fulfill the Error Stepper concept. The
* state is updated in-place and an error estimate is calculated. A type modelling a Boost.Range can be used for x.
* - `do_step( sys , x , dxdt , t , dt , xerr )` - This method updates the state in-place, but the derivative at the
* point `t` must be passed in `dxdt`. An error estimate is calculated.
* - `do_step( sys , in , t , out , dt , xerr )` - This method updates the state out-of-place and estimates the error
* during the step.
* - `do_step( sys , in , dxdt , t , out , dt , xerr )` - This methods updates the state out-of-place and estimates
* the error during the step. Furthermore, the derivative at `t` must be passed in `dxdt`.
*
* \note The system is always passed as value, which might result in poor performance if it contains data. In this
* case it can be used with `boost::ref` or `std::ref`, for example `stepper.do_step( boost::ref( sys ) , x , t , dt );`
*
* \note The time `t` is not advanced by the stepper. This has to done manually, or by the appropriate `integrate`
* routines or `iterator`s.
*
* \tparam Stepper The stepper on which this class should work. It is used via CRTP, hence explicit_stepper_base
* provides the interface for the Stepper.
* \tparam Order The order of a stepper if the stepper is used without error estimation.
* \tparam StepperOrder The order of a step if the stepper is used with error estimation. Usually Order and StepperOrder have
* the same value.
* \tparam ErrorOrder The order of the error step if the stepper is used with error estimation.
* \tparam State The state type for the stepper.
* \tparam Value The value type for the stepper. This should be a floating point type, like float,
* double, or a multiprecision type. It must not necessary be the value_type of the State. For example
* the State can be a `vector< complex< double > >` in this case the Value must be double.
* The default value is double.
* \tparam Deriv The type representing time derivatives of the state type. It is usually the same type as the
* state type, only if used with Boost.Units both types differ.
* \tparam Time The type representing the time. Usually the same type as the value type. When Boost.Units is
* used, this type has usually a unit.
* \tparam Algebra The algebra type which must fulfill the Algebra Concept.
* \tparam Operations The type for the operations which must fulfill the Operations Concept.
* \tparam Resizer The resizer policy class.
*/
/**
* \fn explicit_error_stepper_base::explicit_error_stepper_base( const algebra_type &algebra = algebra_type() )
*
* \brief Constructs a explicit_error_stepper_base class. This constructor can be used as a default
* constructor if the algebra has a default constructor.
* \param algebra A copy of algebra is made and stored inside explicit_stepper_base.
*/
/**
* \fn explicit_error_stepper_base::order( void ) const
* \return Returns the order of the stepper if it used without error estimation.
*/
/**
* \fn explicit_error_stepper_base::stepper_order( void ) const
* \return Returns the order of a step if the stepper is used without error estimation.
*/
/**
* \fn explicit_error_stepper_base::error_order( void ) const
* \return Returns the order of an error step if the stepper is used without error estimation.
*/
/**
* \fn explicit_error_stepper_base::do_step( System system , StateInOut &x , time_type t , time_type dt )
* \brief This method performs one step. It transforms the result in-place.
*
* \param system The system function to solve, hence the r.h.s. of the ordinary differential equation. It must fulfill the
* Simple System concept.
* \param x The state of the ODE which should be solved. After calling do_step the result is updated in x.
* \param t The value of the time, at which the step should be performed.
* \param dt The step size.
*/
/**
* \fn explicit_error_stepper_base::do_step( System system , StateInOut &x , const DerivIn &dxdt , time_type t , time_type dt )
* \brief The method performs one step with the stepper passed by Stepper. Additionally to the other method
* the derivative of x is also passed to this method. It is supposed to be used in the following way:
*
* \code
* sys( x , dxdt , t );
* stepper.do_step( sys , x , dxdt , t , dt );
* \endcode
*
* The result is updated in place in x. This method is disabled if Time and Deriv are of the same type. In this
* case the method could not be distinguished from other `do_step` versions.
*
* \note This method does not solve the forwarding problem.
*
* \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the
* Simple System concept.
* \param x The state of the ODE which should be solved. After calling do_step the result is updated in x.
* \param dxdt The derivative of x at t.
* \param t The value of the time, at which the step should be performed.
* \param dt The step size.
*/
/**
* \fn explicit_error_stepper_base::do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt )
* \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place.
* This method is disabled if StateIn and Time are the same type. In this case the method can not be distinguished from
* other `do_step` variants.
* \note This method does not solve the forwarding problem.
*
* \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the
* Simple System concept.
* \param in The state of the ODE which should be solved. in is not modified in this method
* \param t The value of the time, at which the step should be performed.
* \param out The result of the step is written in out.
* \param dt The step size.
*/
/**
* \fn explicit_error_stepper_base::do_step( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt )
* \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place.
* Furthermore, the derivative of x at t is passed to the stepper. It is supposed to be used in the following way:
*
* \code
* sys( in , dxdt , t );
* stepper.do_step( sys , in , dxdt , t , out , dt );
* \endcode
*
* This method is disabled if DerivIn and Time are of same type.
*
* \note This method does not solve the forwarding problem.
*
* \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the
* Simple System concept.
* \param in The state of the ODE which should be solved. in is not modified in this method
* \param dxdt The derivative of x at t.
* \param t The value of the time, at which the step should be performed.
* \param out The result of the step is written in out.
* \param dt The step size.
*/
/**
* \fn explicit_error_stepper_base::do_step( System system , StateInOut &x , time_type t , time_type dt , Err &xerr )
* \brief The method performs one step with the stepper passed by Stepper and estimates the error. The state of the ODE
* is updated in-place.
*
* \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the
* Simple System concept.
* \param x The state of the ODE which should be solved. x is updated by this method.
* \param t The value of the time, at which the step should be performed.
* \param dt The step size.
* \param xerr The estimation of the error is stored in xerr.
*/
/**
* \fn explicit_error_stepper_base::do_step( System system , StateInOut &x , const DerivIn &dxdt , time_type t , time_type dt , Err &xerr )
* \brief The method performs one step with the stepper passed by Stepper. Additionally to the other method
* the derivative of x is also passed to this method. It is supposed to be used in the following way:
*
* \code
* sys( x , dxdt , t );
* stepper.do_step( sys , x , dxdt , t , dt , xerr );
* \endcode
*
* The result is updated in place in x. This method is disabled if Time and DerivIn are of the same type. In this
* case the method could not be distinguished from other `do_step` versions.
*
* \note This method does not solve the forwarding problem.
*
* \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the
* Simple System concept.
* \param x The state of the ODE which should be solved. After calling do_step the result is updated in x.
* \param dxdt The derivative of x at t.
* \param t The value of the time, at which the step should be performed.
* \param dt The step size.
* \param xerr The error estimate is stored in xerr.
*/
/**
* \fn explicit_error_stepper_base::do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt , Err &xerr )
* \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place.
* Furthermore, the error is estimated.
*
* \note This method does not solve the forwarding problem.
*
* \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the
* Simple System concept.
* \param in The state of the ODE which should be solved. in is not modified in this method
* \param t The value of the time, at which the step should be performed.
* \param out The result of the step is written in out.
* \param dt The step size.
* \param xerr The error estimate.
*/
/**
* \fn explicit_error_stepper_base::do_step( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt , Err &xerr )
* \brief The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place.
* Furthermore, the derivative of x at t is passed to the stepper and the error is estimated. It is supposed to be used in the following way:
*
* \code
* sys( in , dxdt , t );
* stepper.do_step( sys , in , dxdt , t , out , dt );
* \endcode
*
* This method is disabled if DerivIn and Time are of same type.
*
* \note This method does not solve the forwarding problem.
*
* \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the
* Simple System concept.
* \param in The state of the ODE which should be solved. in is not modified in this method
* \param dxdt The derivative of x at t.
* \param t The value of the time, at which the step should be performed.
* \param out The result of the step is written in out.
* \param dt The step size.
* \param xerr The error estimate.
*/
/**
* \fn explicit_error_stepper_base::adjust_size( const StateIn &x )
* \brief Adjust the size of all temporaries in the stepper manually.
* \param x A state from which the size of the temporaries to be resized is deduced.
*/
} // odeint
} // numeric
} // boost
#endif // BOOST_NUMERIC_ODEINT_STEPPER_BASE_EXPLICIT_ERROR_STEPPER_BASE_HPP_INCLUDED
@@ -0,0 +1,105 @@
#ifndef BOOST_SERIALIZATION_COLLECTIONS_LOAD_IMP_HPP
#define BOOST_SERIALIZATION_COLLECTIONS_LOAD_IMP_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER)
# pragma once
#endif
#if defined(_MSC_VER) && (_MSC_VER <= 1020)
# pragma warning (disable : 4786) // too long name, harmless warning
#endif
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// collections_load_imp.hpp: serialization for loading stl collections
// (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 for updates, documentation, and revision history.
// helper function templates for serialization of collections
#include <boost/assert.hpp>
#include <cstddef> // size_t
#include <boost/config.hpp> // msvc 6.0 needs this for warning suppression
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
using ::size_t;
} // namespace std
#endif
#include <boost/detail/workaround.hpp>
#include <boost/archive/detail/basic_iarchive.hpp>
#include <boost/serialization/access.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/detail/stack_constructor.hpp>
#include <boost/serialization/collection_size_type.hpp>
#include <boost/serialization/item_version_type.hpp>
#include <boost/serialization/detail/is_default_constructible.hpp>
#include <boost/utility/enable_if.hpp>
namespace boost{
namespace serialization {
namespace stl {
//////////////////////////////////////////////////////////////////////
// implementation of serialization for STL containers
//
template<
class Archive,
class T
>
typename boost::enable_if<
typename detail::is_default_constructible<
typename T::value_type
>,
void
>::type
collection_load_impl(
Archive & ar,
T & t,
collection_size_type count,
item_version_type
){
t.resize(count);
typename T::iterator hint;
hint = t.begin();
while(count-- > 0){
ar >> boost::serialization::make_nvp("item", *hint++);
}
}
template<
class Archive,
class T
>
typename boost::disable_if<
typename detail::is_default_constructible<
typename T::value_type
>,
void
>::type
collection_load_impl(
Archive & ar,
T & t,
collection_size_type count,
item_version_type item_version
){
t.clear();
while(count-- > 0){
detail::stack_construct<Archive, typename T::value_type> u(ar, item_version);
ar >> boost::serialization::make_nvp("item", u.reference());
t.push_back(u.reference());
ar.reset_object_address(& t.back() , & u.reference());
}
}
} // namespace stl
} // namespace serialization
} // namespace boost
#endif //BOOST_SERIALIZATION_COLLECTIONS_LOAD_IMP_HPP
@@ -0,0 +1,140 @@
// Copyright David Abrahams 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)
#ifndef FROM_PYTHON_AUX_DATA_DWA2002128_HPP
# define FROM_PYTHON_AUX_DATA_DWA2002128_HPP
# include <boost/python/converter/constructor_function.hpp>
# include <boost/python/detail/referent_storage.hpp>
# include <boost/python/detail/destroy.hpp>
# include <boost/static_assert.hpp>
# include <boost/type_traits/add_reference.hpp>
# include <boost/type_traits/add_cv.hpp>
# include <cstddef>
// Data management for potential rvalue conversions from Python to C++
// types. When a client requests a conversion to T* or T&, we
// generally require that an object of type T exists in the source
// Python object, and the code here does not apply**. This implements
// conversions which may create new temporaries of type T. The classic
// example is a conversion which converts a Python tuple to a
// std::vector. Since no std::vector lvalue exists in the Python
// object -- it must be created "on-the-fly" by the converter, and
// which must manage the lifetime of the created object.
//
// Note that the client is not precluded from using a registered
// lvalue conversion to T in this case. In other words, we will
// happily accept a Python object which /does/ contain a std::vector
// lvalue, provided an appropriate converter is registered. So, while
// this is an rvalue conversion from the client's point-of-view, the
// converter registry may serve up lvalue or rvalue conversions for
// the target type.
//
// ** C++ argument from_python conversions to T const& are an
// exception to the rule for references: since in C++, const
// references can bind to temporary rvalues, we allow rvalue
// converters to be chosen when the target type is T const& for some
// T.
namespace boost { namespace python { namespace converter {
// Conversions begin by filling in and returning a copy of this
// structure. The process looks up a converter in the rvalue converter
// registry for the target type. It calls the convertible() function
// of each registered converter, passing the source PyObject* as an
// argument, until a non-null result is returned. This result goes in
// the convertible field, and the converter's construct() function is
// stored in the construct field.
//
// If no appropriate converter is found, conversion fails and the
// convertible field is null. When used in argument conversion for
// wrapped C++ functions, it causes overload resolution to reject the
// current function but not to fail completely. If an exception is
// thrown, overload resolution stops and the exception propagates back
// through the caller.
//
// If an lvalue converter is matched, its convertible() function is
// expected to return a pointer to the stored T object; its
// construct() function will be NULL. The convertible() function of
// rvalue converters may return any non-singular pointer; the actual
// target object will only be available once the converter's
// construct() function is called.
struct rvalue_from_python_stage1_data
{
void* convertible;
constructor_function construct;
};
// Augments rvalue_from_python_stage1_data by adding storage for
// constructing an object of remove_reference<T>::type. The
// construct() function of rvalue converters (stored in m_construct
// above) will cast the rvalue_from_python_stage1_data to an
// appropriate instantiation of this template in order to access that
// storage.
template <class T>
struct rvalue_from_python_storage
{
rvalue_from_python_stage1_data stage1;
// Storage for the result, in case an rvalue must be constructed
typename python::detail::referent_storage<
typename add_reference<T>::type
>::type storage;
};
// Augments rvalue_from_python_storage<T> with a destructor. If
// stage1.convertible == storage.bytes, it indicates that an object of
// remove_reference<T>::type has been constructed in storage and
// should will be destroyed in ~rvalue_from_python_data(). It is
// crucial that successful rvalue conversions establish this equality
// and that unsuccessful ones do not.
template <class T>
struct rvalue_from_python_data : rvalue_from_python_storage<T>
{
# if (!defined(__MWERKS__) || __MWERKS__ >= 0x3000) \
&& (!defined(__EDG_VERSION__) || __EDG_VERSION__ >= 245) \
&& (!defined(__DECCXX_VER) || __DECCXX_VER > 60590014) \
&& !defined(BOOST_PYTHON_SYNOPSIS) /* Synopsis' OpenCXX has trouble parsing this */
// This must always be a POD struct with m_data its first member.
BOOST_STATIC_ASSERT(BOOST_PYTHON_OFFSETOF(rvalue_from_python_storage<T>,stage1) == 0);
# endif
// The usual constructor
rvalue_from_python_data(rvalue_from_python_stage1_data const&);
// This constructor just sets m_convertible -- used by
// implicitly_convertible<> to perform the final step of the
// conversion, where the construct() function is already known.
rvalue_from_python_data(void* convertible);
// Destroys any object constructed in the storage.
~rvalue_from_python_data();
private:
typedef typename add_reference<typename add_cv<T>::type>::type ref_type;
};
//
// Implementataions
//
template <class T>
inline rvalue_from_python_data<T>::rvalue_from_python_data(rvalue_from_python_stage1_data const& _stage1)
{
this->stage1 = _stage1;
}
template <class T>
inline rvalue_from_python_data<T>::rvalue_from_python_data(void* convertible)
{
this->stage1.convertible = convertible;
}
template <class T>
inline rvalue_from_python_data<T>::~rvalue_from_python_data()
{
if (this->stage1.convertible == this->storage.bytes)
python::detail::destroy_referent<ref_type>(this->storage.bytes);
}
}}} // namespace boost::python::converter
#endif // FROM_PYTHON_AUX_DATA_DWA2002128_HPP
@@ -0,0 +1,22 @@
subroutine pctile(x,npts,npct,xpct)
parameter (NMAX=128*1024)
real*4 x(npts)
real*4 tmp(NMAX)
if(npts.le.0) then
xpct=1.0
go to 900
endif
if(npts.gt.NMAX) stop
tmp(1:npts)=x
call shell(npts,tmp)
j=nint(npts*0.01*npct)
if(j.lt.1) j=1
if(j.gt.npts) j=npts
xpct=tmp(j)
900 continue
return
end subroutine pctile
@@ -0,0 +1,264 @@
//---------------------------------------------------------------------------//
// 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_MEMORY_OBJECT_HPP
#define BOOST_COMPUTE_MEMORY_OBJECT_HPP
#include <boost/compute/config.hpp>
#include <boost/compute/context.hpp>
#include <boost/compute/kernel.hpp>
#include <boost/compute/detail/get_object_info.hpp>
#include <boost/compute/detail/assert_cl_success.hpp>
namespace boost {
namespace compute {
/// \class memory_object
/// \brief Base-class for memory objects.
///
/// The memory_object class is the base-class for memory objects on
/// compute devices.
///
/// \see buffer, vector
class memory_object
{
public:
/// Flags for the creation of memory objects.
enum mem_flags {
read_write = CL_MEM_READ_WRITE,
read_only = CL_MEM_READ_ONLY,
write_only = CL_MEM_WRITE_ONLY,
use_host_ptr = CL_MEM_USE_HOST_PTR,
alloc_host_ptr = CL_MEM_ALLOC_HOST_PTR,
copy_host_ptr = CL_MEM_COPY_HOST_PTR
#ifdef CL_VERSION_1_2
,
host_write_only = CL_MEM_HOST_WRITE_ONLY,
host_read_only = CL_MEM_HOST_READ_ONLY,
host_no_access = CL_MEM_HOST_NO_ACCESS
#endif
};
/// Symbolic names for the OpenCL address spaces.
enum address_space {
global_memory,
local_memory,
private_memory,
constant_memory
};
/// Returns the underlying OpenCL memory object.
cl_mem& get() const
{
return const_cast<cl_mem &>(m_mem);
}
/// Returns the size of the memory object in bytes.
size_t get_memory_size() const
{
return get_memory_info<size_t>(CL_MEM_SIZE);
}
/// Returns the type for the memory object.
cl_mem_object_type get_memory_type() const
{
return get_memory_info<cl_mem_object_type>(CL_MEM_TYPE);
}
/// Returns the flags for the memory object.
cl_mem_flags get_memory_flags() const
{
return get_memory_info<cl_mem_flags>(CL_MEM_FLAGS);
}
/// Returns the context for the memory object.
context get_context() const
{
return context(get_memory_info<cl_context>(CL_MEM_CONTEXT));
}
/// Returns the host pointer associated with the memory object.
void* get_host_ptr() const
{
return get_memory_info<void *>(CL_MEM_HOST_PTR);
}
/// Returns the reference count for the memory object.
uint_ reference_count() const
{
return get_memory_info<uint_>(CL_MEM_REFERENCE_COUNT);
}
/// Returns information about the memory object.
///
/// \see_opencl_ref{clGetMemObjectInfo}
template<class T>
T get_memory_info(cl_mem_info info) const
{
return detail::get_object_info<T>(clGetMemObjectInfo, m_mem, info);
}
#if defined(CL_VERSION_1_1) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED)
/// Registers a function to be called when the memory object is deleted
/// and its resources freed.
///
/// \see_opencl_ref{clSetMemObjectDestructorCallback}
///
/// \opencl_version_warning{1,1}
void set_destructor_callback(void (BOOST_COMPUTE_CL_CALLBACK *callback)(
cl_mem memobj, void *user_data
),
void *user_data = 0)
{
cl_int ret = clSetMemObjectDestructorCallback(m_mem, callback, user_data);
if(ret != CL_SUCCESS){
BOOST_THROW_EXCEPTION(opencl_error(ret));
}
}
/// Registers a function to be called when the memory object is deleted
/// and its resources freed.
///
/// The function specified by \p callback must be invokable with zero
/// arguments (e.g. \c callback()).
///
/// \opencl_version_warning{1,1}
template<class Function>
void set_destructor_callback(Function callback)
{
set_destructor_callback(
destructor_callback_invoker,
new boost::function<void()>(callback)
);
}
#endif // CL_VERSION_1_1
/// Returns \c true if the memory object is the same as \p other.
bool operator==(const memory_object &other) const
{
return m_mem == other.m_mem;
}
/// Returns \c true if the memory object is different from \p other.
bool operator!=(const memory_object &other) const
{
return m_mem != other.m_mem;
}
private:
#ifdef CL_VERSION_1_1
/// \internal_
static void BOOST_COMPUTE_CL_CALLBACK
destructor_callback_invoker(cl_mem, void *user_data)
{
boost::function<void()> *callback =
static_cast<boost::function<void()> *>(user_data);
(*callback)();
delete callback;
}
#endif // CL_VERSION_1_1
protected:
/// \internal_
memory_object()
: m_mem(0)
{
}
/// \internal_
explicit memory_object(cl_mem mem, bool retain = true)
: m_mem(mem)
{
if(m_mem && retain){
clRetainMemObject(m_mem);
}
}
/// \internal_
memory_object(const memory_object &other)
: m_mem(other.m_mem)
{
if(m_mem){
clRetainMemObject(m_mem);
}
}
/// \internal_
memory_object& operator=(const memory_object &other)
{
if(this != &other){
if(m_mem){
clReleaseMemObject(m_mem);
}
m_mem = other.m_mem;
if(m_mem){
clRetainMemObject(m_mem);
}
}
return *this;
}
#ifndef BOOST_COMPUTE_NO_RVALUE_REFERENCES
/// \internal_
memory_object(memory_object&& other) BOOST_NOEXCEPT
: m_mem(other.m_mem)
{
other.m_mem = 0;
}
/// \internal_
memory_object& operator=(memory_object&& other) BOOST_NOEXCEPT
{
if(m_mem){
clReleaseMemObject(m_mem);
}
m_mem = other.m_mem;
other.m_mem = 0;
return *this;
}
#endif // BOOST_COMPUTE_NO_RVALUE_REFERENCES
/// \internal_
~memory_object()
{
if(m_mem){
BOOST_COMPUTE_ASSERT_CL_SUCCESS(
clReleaseMemObject(m_mem)
);
}
}
protected:
cl_mem m_mem;
};
namespace detail {
// set_kernel_arg specialization for memory_object
template<>
struct set_kernel_arg<memory_object>
{
void operator()(kernel &kernel_, size_t index, const memory_object &mem)
{
kernel_.set_arg(index, mem.get());
}
};
} // end detail namespace
} // end compute namespace
} // end boost namespace
#endif // BOOST_COMPUTE_MEMORY_OBJECT_HPP
@@ -0,0 +1,117 @@
subroutine unpackmsg144(dat,msg,c1,c2)
! special unpackmsg for MSK144 - returns call1 and call2 to enable
! maintenance of a recent-calls-heard list
use packjt
parameter (NBASE=37*36*10*27*27*27)
parameter (NGBASE=180*180)
integer dat(12)
character c1*12,c2*12,grid*4,msg*22,grid6*6,psfx*4,junk2*4
logical cqnnn
cqnnn=.false.
nc1=ishft(dat(1),22) + ishft(dat(2),16) + ishft(dat(3),10)+ &
ishft(dat(4),4) + iand(ishft(dat(5),-2),15)
nc2=ishft(iand(dat(5),3),26) + ishft(dat(6),20) + &
ishft(dat(7),14) + ishft(dat(8),8) + ishft(dat(9),2) + &
iand(ishft(dat(10),-4),3)
ng=ishft(iand(dat(10),15),12) + ishft(dat(11),6) + dat(12)
if(ng.ge.32768) then
call unpacktext(nc1,nc2,ng,msg)
c1(1:12)=' '
c2(1:12)=' '
go to 100
endif
call unpackcall(nc1,c1,iv2,psfx)
if(iv2.eq.0) then
! This is an "original JT65" message
if(nc1.eq.NBASE+1) c1='CQ '
if(nc1.eq.NBASE+2) c1='QRZ '
nfreq=nc1-NBASE-3
if(nfreq.ge.0 .and. nfreq.le.999) then
write(c1,1002) nfreq
1002 format('CQ ',i3.3)
cqnnn=.true.
endif
endif
call unpackcall(nc2,c2,junk1,junk2)
call unpackgrid(ng,grid)
if(iv2.gt.0) then
! This is a JT65v2 message
do i=1,4
if(ichar(psfx(i:i)).eq.0) psfx(i:i)=' '
enddo
n1=len_trim(psfx)
n2=len_trim(c2)
if(iv2.eq.1) msg='CQ '//psfx(:n1)//'/'//c2(:n2)//' '//grid
if(iv2.eq.2) msg='QRZ '//psfx(:n1)//'/'//c2(:n2)//' '//grid
if(iv2.eq.3) msg='DE '//psfx(:n1)//'/'//c2(:n2)//' '//grid
if(iv2.eq.4) msg='CQ '//c2(:n2)//'/'//psfx(:n1)//' '//grid
if(iv2.eq.5) msg='QRZ '//c2(:n2)//'/'//psfx(:n1)//' '//grid
if(iv2.eq.6) msg='DE '//c2(:n2)//'/'//psfx(:n1)//' '//grid
if(iv2.eq.7) msg='DE '//c2(:n2)//' '//grid
if(iv2.eq.8) msg=' '
go to 100
else
endif
grid6=grid//'ma'
call grid2k(grid6,k)
if(k.ge.1 .and. k.le.450) call getpfx2(k,c1)
if(k.ge.451 .and. k.le.900) call getpfx2(k,c2)
i=index(c1,char(0))
if(i.ge.3) c1=c1(1:i-1)//' '
i=index(c2,char(0))
if(i.ge.3) c2=c2(1:i-1)//' '
msg=' '
j=0
if(cqnnn) then
msg=c1//' '
j=7 !### ??? ###
go to 10
endif
do i=1,12
j=j+1
msg(j:j)=c1(i:i)
if(c1(i:i).eq.' ') go to 10
enddo
j=j+1
msg(j:j)=' '
10 do i=1,12
if(j.le.21) j=j+1
msg(j:j)=c2(i:i)
if(c2(i:i).eq.' ') go to 20
enddo
if(j.le.21) j=j+1
msg(j:j)=' '
20 if(k.eq.0) then
do i=1,4
if(j.le.21) j=j+1
msg(j:j)=grid(i:i)
enddo
if(j.le.21) j=j+1
msg(j:j)=' '
endif
100 continue
if(msg(1:6).eq.'CQ9DX ') msg(3:3)=' '
if(msg(1:2).eq.'E9' .and. &
msg(3:3).ge.'A' .and. msg(3:3).le.'Z' .and. &
msg(4:4).ge.'A' .and. msg(4:4).le.'Z' .and. &
msg(5:5).eq.' ') msg='CQ '//msg(3:)
return
end subroutine unpackmsg144