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
@@ -0,0 +1,317 @@
//---------------------------------------------------------------------------//
// 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_CONTAINER_ARRAY_HPP
#define BOOST_COMPUTE_CONTAINER_ARRAY_HPP
#include <cstddef>
#include <iterator>
#include <exception>
#include <boost/array.hpp>
#include <boost/throw_exception.hpp>
#include <boost/compute/buffer.hpp>
#include <boost/compute/system.hpp>
#include <boost/compute/algorithm/fill.hpp>
#include <boost/compute/algorithm/swap_ranges.hpp>
#include <boost/compute/iterator/buffer_iterator.hpp>
#include <boost/compute/type_traits/detail/capture_traits.hpp>
#include <boost/compute/detail/buffer_value.hpp>
namespace boost {
namespace compute {
/// \class array
/// \brief A fixed-size container.
///
/// The array container is very similar to the \ref vector container except
/// its size is fixed at compile-time rather than being dynamically resizable
/// at run-time.
///
/// For example, to create a fixed-size array with eight values on the device:
/// \code
/// boost::compute::array<int, 8> values(context);
/// \endcode
///
/// The Boost.Compute \c array class provides a STL-like API and is modeled
/// after the \c std::array class from the C++ standard library.
///
/// \see \ref vector "vector<T>"
template<class T, std::size_t N>
class array
{
public:
typedef T value_type;
typedef std::size_t size_type;
typedef ptrdiff_t difference_type;
typedef detail::buffer_value<T> reference;
typedef const detail::buffer_value<T> const_reference;
typedef T* pointer;
typedef const T* const_pointer;
typedef buffer_iterator<T> iterator;
typedef buffer_iterator<T> const_iterator;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
enum {
static_size = N
};
explicit array(const context &context = system::default_context())
: m_buffer(context, sizeof(T) * N)
{
}
array(const array<T, N> &other)
: m_buffer(other.m_buffer.get_context(), sizeof(T) * N)
{
command_queue queue = default_queue();
boost::compute::copy(other.begin(), other.end(), begin(), queue);
queue.finish();
}
array(const boost::array<T, N> &array,
const context &context = system::default_context())
: m_buffer(context, sizeof(T) * N)
{
command_queue queue = default_queue();
boost::compute::copy(array.begin(), array.end(), begin(), queue);
queue.finish();
}
array(const array<T, N> &other,
const command_queue &queue)
: m_buffer(other.m_buffer.get_context(), sizeof(T) * N)
{
boost::compute::copy(other.begin(), other.end(), begin(), queue);
}
array<T, N>& operator=(const array<T, N> &other)
{
if(this != &other){
command_queue queue = default_queue();
boost::compute::copy(other.begin(), other.end(), begin(), queue);
queue.finish();
}
return *this;
}
array<T, N>& operator=(const boost::array<T, N> &array)
{
command_queue queue = default_queue();
boost::compute::copy(array.begin(), array.end(), begin(), queue);
queue.finish();
return *this;
}
~array()
{
}
iterator begin()
{
return buffer_iterator<T>(m_buffer, 0);
}
const_iterator begin() const
{
return buffer_iterator<T>(m_buffer, 0);
}
const_iterator cbegin() const
{
return begin();
}
iterator end()
{
return buffer_iterator<T>(m_buffer, N);
}
const_iterator end() const
{
return buffer_iterator<T>(m_buffer, N);
}
const_iterator cend() const
{
return end();
}
reverse_iterator rbegin()
{
return reverse_iterator(end() - 1);
}
const_reverse_iterator rbegin() const
{
return reverse_iterator(end() - 1);
}
const_reverse_iterator crbegin() const
{
return rbegin();
}
reverse_iterator rend()
{
return reverse_iterator(begin() - 1);
}
const_reverse_iterator rend() const
{
return reverse_iterator(begin() - 1);
}
const_reverse_iterator crend() const
{
return rend();
}
size_type size() const
{
return N;
}
bool empty() const
{
return N == 0;
}
size_type max_size() const
{
return N;
}
reference operator[](size_type index)
{
return *(begin() + static_cast<difference_type>(index));
}
const_reference operator[](size_type index) const
{
return *(begin() + static_cast<difference_type>(index));
}
reference at(size_type index)
{
if(index >= N){
BOOST_THROW_EXCEPTION(std::out_of_range("index out of range"));
}
return operator[](index);
}
const_reference at(size_type index) const
{
if(index >= N){
BOOST_THROW_EXCEPTION(std::out_of_range("index out of range"));
}
return operator[](index);
}
reference front()
{
return *begin();
}
const_reference front() const
{
return *begin();
}
reference back()
{
return *(end() - static_cast<difference_type>(1));
}
const_reference back() const
{
return *(end() - static_cast<difference_type>(1));
}
void fill(const value_type &value, const command_queue &queue)
{
::boost::compute::fill(begin(), end(), value, queue);
}
void swap(array<T, N> &other, const command_queue &queue)
{
::boost::compute::swap_ranges(begin(), end(), other.begin(), queue);
}
void fill(const value_type &value)
{
command_queue queue = default_queue();
::boost::compute::fill(begin(), end(), value, queue);
queue.finish();
}
void swap(array<T, N> &other)
{
command_queue queue = default_queue();
::boost::compute::swap_ranges(begin(), end(), other.begin(), queue);
queue.finish();
}
const buffer& get_buffer() const
{
return m_buffer;
}
private:
buffer m_buffer;
command_queue default_queue() const
{
const context &context = m_buffer.get_context();
command_queue queue(context, context.get_device());
return queue;
}
};
namespace detail {
// set_kernel_arg specialization for array<T, N>
template<class T, std::size_t N>
struct set_kernel_arg<array<T, N> >
{
void operator()(kernel &kernel_, size_t index, const array<T, N> &array)
{
kernel_.set_arg(index, array.get_buffer());
}
};
// for capturing array<T, N> with BOOST_COMPUTE_CLOSURE()
template<class T, size_t N>
struct capture_traits<array<T, N> >
{
static std::string type_name()
{
return std::string("__global ") + ::boost::compute::type_name<T>() + "*";
}
};
// meta_kernel streaming operator for array<T, N>
template<class T, size_t N>
meta_kernel& operator<<(meta_kernel &k, const array<T, N> &array)
{
return k << k.get_buffer_identifier<T>(array.get_buffer());
}
} // end detail namespace
} // end compute namespace
} // end boost namespace
#endif // BOOST_COMPUTE_CONTAINER_ARRAY_HPP
@@ -0,0 +1,47 @@
/*==============================================================================
Copyright (c) 2016 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)
==============================================================================*/
template <typename... A>
BOOST_PHOENIX_SCOPE_ACTOR_GEN_NAME<
typename vector_chooser<sizeof...(A)>::template apply<
typename proto::detail::uncvref<
typename proto::result_of::child_c<A, 1>::type
>::type...
>::type
, detail::map_local_index_to_tuple<
typename proto::detail::uncvref<
typename proto::result_of::value<
typename proto::result_of::child_c<A, 0>::type
>::type
>::type...
>
>
BOOST_PHOENIX_SCOPE_ACTOR_GEN_FUNCTION(A const&... a) BOOST_PHOENIX_SCOPE_ACTOR_GEN_CONST
{
typedef
typename vector_chooser<sizeof...(A)>::template apply<
typename proto::detail::uncvref<
typename proto::result_of::child_c<A, 1>::type
>::type...
>::type
locals_type;
locals_type locals = {proto::child_c<1>(a)...};
return
BOOST_PHOENIX_SCOPE_ACTOR_GEN_NAME<
locals_type
, detail::map_local_index_to_tuple<
typename proto::detail::uncvref<
typename proto::result_of::value<
typename proto::result_of::child_c<A, 0>::type
>::type
>::type...
>
>(locals);
}
@@ -0,0 +1,48 @@
subroutine extractmessage174(decoded,msgreceived,ncrcflag,recent_calls,nrecent)
use iso_c_binding, only: c_loc,c_size_t
use crc
use packjt
character*22 msgreceived
character*12 call1,call2
character*12 recent_calls(nrecent)
character*87 cbits
integer*1 decoded(87)
integer*1, target:: i1Dec8BitBytes(11)
integer*4 i4Dec6BitWords(12)
! Write decoded bits into cbits: 75-bit message plus 12-bit CRC
write(cbits,1000) decoded
1000 format(87i1)
read(cbits,1001) i1Dec8BitBytes
1001 format(11b8)
read(cbits,1002) ncrc12 !Received CRC12
1002 format(75x,b12)
i1Dec8BitBytes(10)=iand(i1Dec8BitBytes(10),128+64+32)
i1Dec8BitBytes(11)=0
icrc12=crc12(c_loc(i1Dec8BitBytes),11) !CRC12 computed from 75 msg bits
if(ncrc12.eq.icrc12) then
! CRC12 checks out --- unpack 72-bit message
do ibyte=1,12
itmp=0
do ibit=1,6
itmp=ishft(itmp,1)+iand(1,decoded((ibyte-1)*6+ibit))
enddo
i4Dec6BitWords(ibyte)=itmp
enddo
call unpackmsg144(i4Dec6BitWords,msgreceived,call1,call2)
ncrcflag=1
if( call1(1:2) .ne. 'CQ' .and. call1(1:2) .ne. ' ' ) then
call update_recent_calls(call1,recent_calls,nrecent)
endif
if( call2(1:2) .ne. ' ' ) then
call update_recent_calls(call2,recent_calls,nrecent)
endif
else
msgreceived=' '
ncrcflag=-1
endif
return
end subroutine extractmessage174
@@ -0,0 +1,527 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
// no include guards, this file is intended for multiple inclusion
// input: BOOST_FT_syntax type macro to use
// input: BOOST_FT_cc empty or cc specifier
// input: BOOST_FT_ell empty or "..."
// input: BOOST_FT_cv empty or cv qualifiers
// input: BOOST_FT_flags single decimal integer encoding the flags
// output: BOOST_FT_n number of component types (arity+1)
// output: BOOST_FT_arity current arity
// output: BOOST_FT_type macro that expands to the type
// output: BOOST_FT_tplargs(p) template arguments with given prefix
// output: BOOST_FT_params(p) parameters with given prefix
# include <boost/function_types/detail/synthesize_impl/arity10_1.hpp>
# define BOOST_FT_make_type(flags,cc,arity) BOOST_FT_make_type_impl(flags,cc,arity)
# define BOOST_FT_make_type_impl(flags,cc,arity) make_type_ ## flags ## _ ## cc ## _ ## arity
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 >
struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,11)
{
typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 BOOST_FT_ell) BOOST_FT_cv ;
};
template< >
struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 12 >
{
template<typename S> struct synthesize_impl_i
{
private:
typedef typename mpl::begin<S> ::type iter_0;
typedef typename mpl::next< iter_0 > ::type iter_1;
typedef typename mpl::next< iter_1 > ::type iter_2;
typedef typename mpl::next< iter_2 > ::type iter_3;
typedef typename mpl::next< iter_3 > ::type iter_4;
typedef typename mpl::next< iter_4 > ::type iter_5;
typedef typename mpl::next< iter_5 > ::type iter_6;
typedef typename mpl::next< iter_6 > ::type iter_7;
typedef typename mpl::next< iter_7 > ::type iter_8;
typedef typename mpl::next< iter_8 > ::type iter_9;
typedef typename mpl::next< iter_9 > ::type iter_10;
typedef typename mpl::next< iter_10 > ::type iter_11;
public:
typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,11)
< typename mpl::deref< iter_0 > ::type
, typename detail::cv_traits<
typename mpl::deref< iter_1 > ::type > ::type
, typename mpl::deref< iter_2 > ::type
, typename mpl::deref< iter_3 > ::type
, typename mpl::deref< iter_4 > ::type
, typename mpl::deref< iter_5 > ::type
, typename mpl::deref< iter_6 > ::type
, typename mpl::deref< iter_7 > ::type
, typename mpl::deref< iter_8 > ::type
, typename mpl::deref< iter_9 > ::type
, typename mpl::deref< iter_10 > ::type
, typename mpl::deref< iter_11 > ::type
> ::type type;
};
};
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 >
struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,12)
{
typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 BOOST_FT_ell) BOOST_FT_cv ;
};
template< >
struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 13 >
{
template<typename S> struct synthesize_impl_i
{
private:
typedef typename mpl::begin<S> ::type iter_0;
typedef typename mpl::next< iter_0 > ::type iter_1;
typedef typename mpl::next< iter_1 > ::type iter_2;
typedef typename mpl::next< iter_2 > ::type iter_3;
typedef typename mpl::next< iter_3 > ::type iter_4;
typedef typename mpl::next< iter_4 > ::type iter_5;
typedef typename mpl::next< iter_5 > ::type iter_6;
typedef typename mpl::next< iter_6 > ::type iter_7;
typedef typename mpl::next< iter_7 > ::type iter_8;
typedef typename mpl::next< iter_8 > ::type iter_9;
typedef typename mpl::next< iter_9 > ::type iter_10;
typedef typename mpl::next< iter_10 > ::type iter_11;
typedef typename mpl::next< iter_11 > ::type iter_12;
public:
typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,12)
< typename mpl::deref< iter_0 > ::type
, typename detail::cv_traits<
typename mpl::deref< iter_1 > ::type > ::type
, typename mpl::deref< iter_2 > ::type
, typename mpl::deref< iter_3 > ::type
, typename mpl::deref< iter_4 > ::type
, typename mpl::deref< iter_5 > ::type
, typename mpl::deref< iter_6 > ::type
, typename mpl::deref< iter_7 > ::type
, typename mpl::deref< iter_8 > ::type
, typename mpl::deref< iter_9 > ::type
, typename mpl::deref< iter_10 > ::type
, typename mpl::deref< iter_11 > ::type
, typename mpl::deref< iter_12 > ::type
> ::type type;
};
};
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 >
struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,13)
{
typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 BOOST_FT_ell) BOOST_FT_cv ;
};
template< >
struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 14 >
{
template<typename S> struct synthesize_impl_i
{
private:
typedef typename mpl::begin<S> ::type iter_0;
typedef typename mpl::next< iter_0 > ::type iter_1;
typedef typename mpl::next< iter_1 > ::type iter_2;
typedef typename mpl::next< iter_2 > ::type iter_3;
typedef typename mpl::next< iter_3 > ::type iter_4;
typedef typename mpl::next< iter_4 > ::type iter_5;
typedef typename mpl::next< iter_5 > ::type iter_6;
typedef typename mpl::next< iter_6 > ::type iter_7;
typedef typename mpl::next< iter_7 > ::type iter_8;
typedef typename mpl::next< iter_8 > ::type iter_9;
typedef typename mpl::next< iter_9 > ::type iter_10;
typedef typename mpl::next< iter_10 > ::type iter_11;
typedef typename mpl::next< iter_11 > ::type iter_12;
typedef typename mpl::next< iter_12 > ::type iter_13;
public:
typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,13)
< typename mpl::deref< iter_0 > ::type
, typename detail::cv_traits<
typename mpl::deref< iter_1 > ::type > ::type
, typename mpl::deref< iter_2 > ::type
, typename mpl::deref< iter_3 > ::type
, typename mpl::deref< iter_4 > ::type
, typename mpl::deref< iter_5 > ::type
, typename mpl::deref< iter_6 > ::type
, typename mpl::deref< iter_7 > ::type
, typename mpl::deref< iter_8 > ::type
, typename mpl::deref< iter_9 > ::type
, typename mpl::deref< iter_10 > ::type
, typename mpl::deref< iter_11 > ::type
, typename mpl::deref< iter_12 > ::type
, typename mpl::deref< iter_13 > ::type
> ::type type;
};
};
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 >
struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,14)
{
typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 BOOST_FT_ell) BOOST_FT_cv ;
};
template< >
struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 15 >
{
template<typename S> struct synthesize_impl_i
{
private:
typedef typename mpl::begin<S> ::type iter_0;
typedef typename mpl::next< iter_0 > ::type iter_1;
typedef typename mpl::next< iter_1 > ::type iter_2;
typedef typename mpl::next< iter_2 > ::type iter_3;
typedef typename mpl::next< iter_3 > ::type iter_4;
typedef typename mpl::next< iter_4 > ::type iter_5;
typedef typename mpl::next< iter_5 > ::type iter_6;
typedef typename mpl::next< iter_6 > ::type iter_7;
typedef typename mpl::next< iter_7 > ::type iter_8;
typedef typename mpl::next< iter_8 > ::type iter_9;
typedef typename mpl::next< iter_9 > ::type iter_10;
typedef typename mpl::next< iter_10 > ::type iter_11;
typedef typename mpl::next< iter_11 > ::type iter_12;
typedef typename mpl::next< iter_12 > ::type iter_13;
typedef typename mpl::next< iter_13 > ::type iter_14;
public:
typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,14)
< typename mpl::deref< iter_0 > ::type
, typename detail::cv_traits<
typename mpl::deref< iter_1 > ::type > ::type
, typename mpl::deref< iter_2 > ::type
, typename mpl::deref< iter_3 > ::type
, typename mpl::deref< iter_4 > ::type
, typename mpl::deref< iter_5 > ::type
, typename mpl::deref< iter_6 > ::type
, typename mpl::deref< iter_7 > ::type
, typename mpl::deref< iter_8 > ::type
, typename mpl::deref< iter_9 > ::type
, typename mpl::deref< iter_10 > ::type
, typename mpl::deref< iter_11 > ::type
, typename mpl::deref< iter_12 > ::type
, typename mpl::deref< iter_13 > ::type
, typename mpl::deref< iter_14 > ::type
> ::type type;
};
};
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 >
struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,15)
{
typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 BOOST_FT_ell) BOOST_FT_cv ;
};
template< >
struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 16 >
{
template<typename S> struct synthesize_impl_i
{
private:
typedef typename mpl::begin<S> ::type iter_0;
typedef typename mpl::next< iter_0 > ::type iter_1;
typedef typename mpl::next< iter_1 > ::type iter_2;
typedef typename mpl::next< iter_2 > ::type iter_3;
typedef typename mpl::next< iter_3 > ::type iter_4;
typedef typename mpl::next< iter_4 > ::type iter_5;
typedef typename mpl::next< iter_5 > ::type iter_6;
typedef typename mpl::next< iter_6 > ::type iter_7;
typedef typename mpl::next< iter_7 > ::type iter_8;
typedef typename mpl::next< iter_8 > ::type iter_9;
typedef typename mpl::next< iter_9 > ::type iter_10;
typedef typename mpl::next< iter_10 > ::type iter_11;
typedef typename mpl::next< iter_11 > ::type iter_12;
typedef typename mpl::next< iter_12 > ::type iter_13;
typedef typename mpl::next< iter_13 > ::type iter_14;
typedef typename mpl::next< iter_14 > ::type iter_15;
public:
typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,15)
< typename mpl::deref< iter_0 > ::type
, typename detail::cv_traits<
typename mpl::deref< iter_1 > ::type > ::type
, typename mpl::deref< iter_2 > ::type
, typename mpl::deref< iter_3 > ::type
, typename mpl::deref< iter_4 > ::type
, typename mpl::deref< iter_5 > ::type
, typename mpl::deref< iter_6 > ::type
, typename mpl::deref< iter_7 > ::type
, typename mpl::deref< iter_8 > ::type
, typename mpl::deref< iter_9 > ::type
, typename mpl::deref< iter_10 > ::type
, typename mpl::deref< iter_11 > ::type
, typename mpl::deref< iter_12 > ::type
, typename mpl::deref< iter_13 > ::type
, typename mpl::deref< iter_14 > ::type
, typename mpl::deref< iter_15 > ::type
> ::type type;
};
};
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 >
struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,16)
{
typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 BOOST_FT_ell) BOOST_FT_cv ;
};
template< >
struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 17 >
{
template<typename S> struct synthesize_impl_i
{
private:
typedef typename mpl::begin<S> ::type iter_0;
typedef typename mpl::next< iter_0 > ::type iter_1;
typedef typename mpl::next< iter_1 > ::type iter_2;
typedef typename mpl::next< iter_2 > ::type iter_3;
typedef typename mpl::next< iter_3 > ::type iter_4;
typedef typename mpl::next< iter_4 > ::type iter_5;
typedef typename mpl::next< iter_5 > ::type iter_6;
typedef typename mpl::next< iter_6 > ::type iter_7;
typedef typename mpl::next< iter_7 > ::type iter_8;
typedef typename mpl::next< iter_8 > ::type iter_9;
typedef typename mpl::next< iter_9 > ::type iter_10;
typedef typename mpl::next< iter_10 > ::type iter_11;
typedef typename mpl::next< iter_11 > ::type iter_12;
typedef typename mpl::next< iter_12 > ::type iter_13;
typedef typename mpl::next< iter_13 > ::type iter_14;
typedef typename mpl::next< iter_14 > ::type iter_15;
typedef typename mpl::next< iter_15 > ::type iter_16;
public:
typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,16)
< typename mpl::deref< iter_0 > ::type
, typename detail::cv_traits<
typename mpl::deref< iter_1 > ::type > ::type
, typename mpl::deref< iter_2 > ::type
, typename mpl::deref< iter_3 > ::type
, typename mpl::deref< iter_4 > ::type
, typename mpl::deref< iter_5 > ::type
, typename mpl::deref< iter_6 > ::type
, typename mpl::deref< iter_7 > ::type
, typename mpl::deref< iter_8 > ::type
, typename mpl::deref< iter_9 > ::type
, typename mpl::deref< iter_10 > ::type
, typename mpl::deref< iter_11 > ::type
, typename mpl::deref< iter_12 > ::type
, typename mpl::deref< iter_13 > ::type
, typename mpl::deref< iter_14 > ::type
, typename mpl::deref< iter_15 > ::type
, typename mpl::deref< iter_16 > ::type
> ::type type;
};
};
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 >
struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,17)
{
typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 BOOST_FT_ell) BOOST_FT_cv ;
};
template< >
struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 18 >
{
template<typename S> struct synthesize_impl_i
{
private:
typedef typename mpl::begin<S> ::type iter_0;
typedef typename mpl::next< iter_0 > ::type iter_1;
typedef typename mpl::next< iter_1 > ::type iter_2;
typedef typename mpl::next< iter_2 > ::type iter_3;
typedef typename mpl::next< iter_3 > ::type iter_4;
typedef typename mpl::next< iter_4 > ::type iter_5;
typedef typename mpl::next< iter_5 > ::type iter_6;
typedef typename mpl::next< iter_6 > ::type iter_7;
typedef typename mpl::next< iter_7 > ::type iter_8;
typedef typename mpl::next< iter_8 > ::type iter_9;
typedef typename mpl::next< iter_9 > ::type iter_10;
typedef typename mpl::next< iter_10 > ::type iter_11;
typedef typename mpl::next< iter_11 > ::type iter_12;
typedef typename mpl::next< iter_12 > ::type iter_13;
typedef typename mpl::next< iter_13 > ::type iter_14;
typedef typename mpl::next< iter_14 > ::type iter_15;
typedef typename mpl::next< iter_15 > ::type iter_16;
typedef typename mpl::next< iter_16 > ::type iter_17;
public:
typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,17)
< typename mpl::deref< iter_0 > ::type
, typename detail::cv_traits<
typename mpl::deref< iter_1 > ::type > ::type
, typename mpl::deref< iter_2 > ::type
, typename mpl::deref< iter_3 > ::type
, typename mpl::deref< iter_4 > ::type
, typename mpl::deref< iter_5 > ::type
, typename mpl::deref< iter_6 > ::type
, typename mpl::deref< iter_7 > ::type
, typename mpl::deref< iter_8 > ::type
, typename mpl::deref< iter_9 > ::type
, typename mpl::deref< iter_10 > ::type
, typename mpl::deref< iter_11 > ::type
, typename mpl::deref< iter_12 > ::type
, typename mpl::deref< iter_13 > ::type
, typename mpl::deref< iter_14 > ::type
, typename mpl::deref< iter_15 > ::type
, typename mpl::deref< iter_16 > ::type
, typename mpl::deref< iter_17 > ::type
> ::type type;
};
};
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 >
struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,18)
{
typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 BOOST_FT_ell) BOOST_FT_cv ;
};
template< >
struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 19 >
{
template<typename S> struct synthesize_impl_i
{
private:
typedef typename mpl::begin<S> ::type iter_0;
typedef typename mpl::next< iter_0 > ::type iter_1;
typedef typename mpl::next< iter_1 > ::type iter_2;
typedef typename mpl::next< iter_2 > ::type iter_3;
typedef typename mpl::next< iter_3 > ::type iter_4;
typedef typename mpl::next< iter_4 > ::type iter_5;
typedef typename mpl::next< iter_5 > ::type iter_6;
typedef typename mpl::next< iter_6 > ::type iter_7;
typedef typename mpl::next< iter_7 > ::type iter_8;
typedef typename mpl::next< iter_8 > ::type iter_9;
typedef typename mpl::next< iter_9 > ::type iter_10;
typedef typename mpl::next< iter_10 > ::type iter_11;
typedef typename mpl::next< iter_11 > ::type iter_12;
typedef typename mpl::next< iter_12 > ::type iter_13;
typedef typename mpl::next< iter_13 > ::type iter_14;
typedef typename mpl::next< iter_14 > ::type iter_15;
typedef typename mpl::next< iter_15 > ::type iter_16;
typedef typename mpl::next< iter_16 > ::type iter_17;
typedef typename mpl::next< iter_17 > ::type iter_18;
public:
typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,18)
< typename mpl::deref< iter_0 > ::type
, typename detail::cv_traits<
typename mpl::deref< iter_1 > ::type > ::type
, typename mpl::deref< iter_2 > ::type
, typename mpl::deref< iter_3 > ::type
, typename mpl::deref< iter_4 > ::type
, typename mpl::deref< iter_5 > ::type
, typename mpl::deref< iter_6 > ::type
, typename mpl::deref< iter_7 > ::type
, typename mpl::deref< iter_8 > ::type
, typename mpl::deref< iter_9 > ::type
, typename mpl::deref< iter_10 > ::type
, typename mpl::deref< iter_11 > ::type
, typename mpl::deref< iter_12 > ::type
, typename mpl::deref< iter_13 > ::type
, typename mpl::deref< iter_14 > ::type
, typename mpl::deref< iter_15 > ::type
, typename mpl::deref< iter_16 > ::type
, typename mpl::deref< iter_17 > ::type
, typename mpl::deref< iter_18 > ::type
> ::type type;
};
};
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 >
struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,19)
{
typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 BOOST_FT_ell) BOOST_FT_cv ;
};
template< >
struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 20 >
{
template<typename S> struct synthesize_impl_i
{
private:
typedef typename mpl::begin<S> ::type iter_0;
typedef typename mpl::next< iter_0 > ::type iter_1;
typedef typename mpl::next< iter_1 > ::type iter_2;
typedef typename mpl::next< iter_2 > ::type iter_3;
typedef typename mpl::next< iter_3 > ::type iter_4;
typedef typename mpl::next< iter_4 > ::type iter_5;
typedef typename mpl::next< iter_5 > ::type iter_6;
typedef typename mpl::next< iter_6 > ::type iter_7;
typedef typename mpl::next< iter_7 > ::type iter_8;
typedef typename mpl::next< iter_8 > ::type iter_9;
typedef typename mpl::next< iter_9 > ::type iter_10;
typedef typename mpl::next< iter_10 > ::type iter_11;
typedef typename mpl::next< iter_11 > ::type iter_12;
typedef typename mpl::next< iter_12 > ::type iter_13;
typedef typename mpl::next< iter_13 > ::type iter_14;
typedef typename mpl::next< iter_14 > ::type iter_15;
typedef typename mpl::next< iter_15 > ::type iter_16;
typedef typename mpl::next< iter_16 > ::type iter_17;
typedef typename mpl::next< iter_17 > ::type iter_18;
typedef typename mpl::next< iter_18 > ::type iter_19;
public:
typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,19)
< typename mpl::deref< iter_0 > ::type
, typename detail::cv_traits<
typename mpl::deref< iter_1 > ::type > ::type
, typename mpl::deref< iter_2 > ::type
, typename mpl::deref< iter_3 > ::type
, typename mpl::deref< iter_4 > ::type
, typename mpl::deref< iter_5 > ::type
, typename mpl::deref< iter_6 > ::type
, typename mpl::deref< iter_7 > ::type
, typename mpl::deref< iter_8 > ::type
, typename mpl::deref< iter_9 > ::type
, typename mpl::deref< iter_10 > ::type
, typename mpl::deref< iter_11 > ::type
, typename mpl::deref< iter_12 > ::type
, typename mpl::deref< iter_13 > ::type
, typename mpl::deref< iter_14 > ::type
, typename mpl::deref< iter_15 > ::type
, typename mpl::deref< iter_16 > ::type
, typename mpl::deref< iter_17 > ::type
, typename mpl::deref< iter_18 > ::type
, typename mpl::deref< iter_19 > ::type
> ::type type;
};
};
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 >
struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,20)
{
typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 BOOST_FT_ell) BOOST_FT_cv ;
};
template< >
struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 21 >
{
template<typename S> struct synthesize_impl_i
{
private:
typedef typename mpl::begin<S> ::type iter_0;
typedef typename mpl::next< iter_0 > ::type iter_1;
typedef typename mpl::next< iter_1 > ::type iter_2;
typedef typename mpl::next< iter_2 > ::type iter_3;
typedef typename mpl::next< iter_3 > ::type iter_4;
typedef typename mpl::next< iter_4 > ::type iter_5;
typedef typename mpl::next< iter_5 > ::type iter_6;
typedef typename mpl::next< iter_6 > ::type iter_7;
typedef typename mpl::next< iter_7 > ::type iter_8;
typedef typename mpl::next< iter_8 > ::type iter_9;
typedef typename mpl::next< iter_9 > ::type iter_10;
typedef typename mpl::next< iter_10 > ::type iter_11;
typedef typename mpl::next< iter_11 > ::type iter_12;
typedef typename mpl::next< iter_12 > ::type iter_13;
typedef typename mpl::next< iter_13 > ::type iter_14;
typedef typename mpl::next< iter_14 > ::type iter_15;
typedef typename mpl::next< iter_15 > ::type iter_16;
typedef typename mpl::next< iter_16 > ::type iter_17;
typedef typename mpl::next< iter_17 > ::type iter_18;
typedef typename mpl::next< iter_18 > ::type iter_19;
typedef typename mpl::next< iter_19 > ::type iter_20;
public:
typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,20)
< typename mpl::deref< iter_0 > ::type
, typename detail::cv_traits<
typename mpl::deref< iter_1 > ::type > ::type
, typename mpl::deref< iter_2 > ::type
, typename mpl::deref< iter_3 > ::type
, typename mpl::deref< iter_4 > ::type
, typename mpl::deref< iter_5 > ::type
, typename mpl::deref< iter_6 > ::type
, typename mpl::deref< iter_7 > ::type
, typename mpl::deref< iter_8 > ::type
, typename mpl::deref< iter_9 > ::type
, typename mpl::deref< iter_10 > ::type
, typename mpl::deref< iter_11 > ::type
, typename mpl::deref< iter_12 > ::type
, typename mpl::deref< iter_13 > ::type
, typename mpl::deref< iter_14 > ::type
, typename mpl::deref< iter_15 > ::type
, typename mpl::deref< iter_16 > ::type
, typename mpl::deref< iter_17 > ::type
, typename mpl::deref< iter_18 > ::type
, typename mpl::deref< iter_19 > ::type
, typename mpl::deref< iter_20 > ::type
> ::type type;
};
};
# undef BOOST_FT_make_type
# undef BOOST_FT_make_type_impl
@@ -0,0 +1,476 @@
/*
[auto_generated]
boost/numeric/odeint/stepper/dense_output_runge_kutta.hpp
[begin_description]
Implementation of the Dense-output stepper for all steppers. Note, that this class does
not computes the result but serves as an interface.
[end_description]
Copyright 2011-2013 Karsten Ahnert
Copyright 2011-2015 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_DENSE_OUTPUT_RUNGE_KUTTA_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_STEPPER_DENSE_OUTPUT_RUNGE_KUTTA_HPP_INCLUDED
#include <utility>
#include <stdexcept>
#include <boost/throw_exception.hpp>
#include <boost/numeric/odeint/util/bind.hpp>
#include <boost/numeric/odeint/util/copy.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/controlled_step_result.hpp>
#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
#include <boost/numeric/odeint/integrate/max_step_checker.hpp>
namespace boost {
namespace numeric {
namespace odeint {
template< class Stepper , class StepperCategory = typename Stepper::stepper_category >
class dense_output_runge_kutta;
/**
* \brief The class representing dense-output Runge-Kutta steppers.
* \note In this stepper, the initialize method has to be called before using
* the do_step method.
*
* The dense-output functionality allows to interpolate the solution between
* subsequent integration points using intermediate results obtained during the
* computation. This version works based on a normal stepper without step-size
* control.
*
*
* \tparam Stepper The stepper type of the underlying algorithm.
*/
template< class Stepper >
class dense_output_runge_kutta< Stepper , stepper_tag >
{
public:
/*
* We do not need all typedefs.
*/
typedef Stepper stepper_type;
typedef typename stepper_type::state_type state_type;
typedef typename stepper_type::wrapped_state_type wrapped_state_type;
typedef typename stepper_type::value_type value_type;
typedef typename stepper_type::deriv_type deriv_type;
typedef typename stepper_type::wrapped_deriv_type wrapped_deriv_type;
typedef typename stepper_type::time_type time_type;
typedef typename stepper_type::algebra_type algebra_type;
typedef typename stepper_type::operations_type operations_type;
typedef typename stepper_type::resizer_type resizer_type;
typedef dense_output_stepper_tag stepper_category;
typedef dense_output_runge_kutta< Stepper > dense_output_stepper_type;
/**
* \brief Constructs the dense_output_runge_kutta class. An instance of the
* underlying stepper can be provided.
* \param stepper An instance of the underlying stepper.
*/
dense_output_runge_kutta( const stepper_type &stepper = stepper_type() )
: m_stepper( stepper ) , m_resizer() ,
m_x1() , m_x2() , m_current_state_x1( true ) ,
m_t() , m_t_old() , m_dt()
{ }
/**
* \brief Initializes the stepper. Has to be called before do_step can be
* used to set the initial conditions and the step size.
* \param x0 The initial state of the ODE which should be solved.
* \param t0 The initial time, at which the step should be performed.
* \param dt0 The step size.
*/
template< class StateType >
void initialize( const StateType &x0 , time_type t0 , time_type dt0 )
{
m_resizer.adjust_size( x0 , detail::bind( &dense_output_stepper_type::template resize_impl< StateType > , detail::ref( *this ) , detail::_1 ) );
boost::numeric::odeint::copy( x0 , get_current_state() );
m_t = t0;
m_dt = dt0;
}
/**
* \brief Does one time step.
* \note initialize has to be called before using this method to set the
* initial conditions x,t and the stepsize.
* \param system The system function to solve, hence the r.h.s. of the ordinary differential equation. It must fulfill the
* Simple System concept.
* \return Pair with start and end time of the integration step.
*/
template< class System >
std::pair< time_type , time_type > do_step( System system )
{
m_stepper.do_step( system , get_current_state() , m_t , get_old_state() , m_dt );
m_t_old = m_t;
m_t += m_dt;
toggle_current_state();
return std::make_pair( m_t_old , m_dt );
}
/*
* The next two overloads are needed to solve the forwarding problem
*/
/**
* \brief Calculates the solution at an intermediate point.
* \param t The time at which the solution should be calculated, has to be
* in the current time interval.
* \param x The output variable where the result is written into.
*/
template< class StateOut >
void calc_state( time_type t , StateOut &x ) const
{
if( t == current_time() )
{
boost::numeric::odeint::copy( get_current_state() , x );
}
m_stepper.calc_state( x , t , get_old_state() , m_t_old , get_current_state() , m_t );
}
/**
* \brief Calculates the solution at an intermediate point. Solves the forwarding problem
* \param t The time at which the solution should be calculated, has to be
* in the current time interval.
* \param x The output variable where the result is written into, can be a boost range.
*/
template< class StateOut >
void calc_state( time_type t , const StateOut &x ) const
{
m_stepper.calc_state( x , t , get_old_state() , m_t_old , get_current_state() , m_t );
}
/**
* \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.
*/
template< class StateType >
void adjust_size( const StateType &x )
{
resize_impl( x );
m_stepper.stepper().resize( x );
}
/**
* \brief Returns the current state of the solution.
* \return The current state of the solution x(t).
*/
const state_type& current_state( void ) const
{
return get_current_state();
}
/**
* \brief Returns the current time of the solution.
* \return The current time of the solution t.
*/
time_type current_time( void ) const
{
return m_t;
}
/**
* \brief Returns the last state of the solution.
* \return The last state of the solution x(t-dt).
*/
const state_type& previous_state( void ) const
{
return get_old_state();
}
/**
* \brief Returns the last time of the solution.
* \return The last time of the solution t-dt.
*/
time_type previous_time( void ) const
{
return m_t_old;
}
/**
* \brief Returns the current time step.
* \return dt.
*/
time_type current_time_step( void ) const
{
return m_dt;
}
private:
state_type& get_current_state( void )
{
return m_current_state_x1 ? m_x1.m_v : m_x2.m_v ;
}
const state_type& get_current_state( void ) const
{
return m_current_state_x1 ? m_x1.m_v : m_x2.m_v ;
}
state_type& get_old_state( void )
{
return m_current_state_x1 ? m_x2.m_v : m_x1.m_v ;
}
const state_type& get_old_state( void ) const
{
return m_current_state_x1 ? m_x2.m_v : m_x1.m_v ;
}
void toggle_current_state( void )
{
m_current_state_x1 = ! m_current_state_x1;
}
template< class StateIn >
bool resize_impl( const StateIn &x )
{
bool resized = false;
resized |= adjust_size_by_resizeability( m_x1 , x , typename is_resizeable<state_type>::type() );
resized |= adjust_size_by_resizeability( m_x2 , x , typename is_resizeable<state_type>::type() );
return resized;
}
stepper_type m_stepper;
resizer_type m_resizer;
wrapped_state_type m_x1 , m_x2;
bool m_current_state_x1; // if true, the current state is m_x1
time_type m_t , m_t_old , m_dt;
};
/**
* \brief The class representing dense-output Runge-Kutta steppers with FSAL property.
*
* The interface is the same as for dense_output_runge_kutta< Stepper , stepper_tag >.
* This class provides dense output functionality based on methods with step size controlled
*
*
* \tparam Stepper The stepper type of the underlying algorithm.
*/
template< class Stepper >
class dense_output_runge_kutta< Stepper , explicit_controlled_stepper_fsal_tag >
{
public:
/*
* We do not need all typedefs.
*/
typedef Stepper controlled_stepper_type;
typedef typename controlled_stepper_type::stepper_type stepper_type;
typedef typename stepper_type::state_type state_type;
typedef typename stepper_type::wrapped_state_type wrapped_state_type;
typedef typename stepper_type::value_type value_type;
typedef typename stepper_type::deriv_type deriv_type;
typedef typename stepper_type::wrapped_deriv_type wrapped_deriv_type;
typedef typename stepper_type::time_type time_type;
typedef typename stepper_type::algebra_type algebra_type;
typedef typename stepper_type::operations_type operations_type;
typedef typename stepper_type::resizer_type resizer_type;
typedef dense_output_stepper_tag stepper_category;
typedef dense_output_runge_kutta< Stepper > dense_output_stepper_type;
dense_output_runge_kutta( const controlled_stepper_type &stepper = controlled_stepper_type() )
: m_stepper( stepper ) , m_resizer() ,
m_current_state_x1( true ) ,
m_x1() , m_x2() , m_dxdt1() , m_dxdt2() ,
m_t() , m_t_old() , m_dt() ,
m_is_deriv_initialized( false )
{ }
template< class StateType >
void initialize( const StateType &x0 , time_type t0 , time_type dt0 )
{
m_resizer.adjust_size( x0 , detail::bind( &dense_output_stepper_type::template resize< StateType > , detail::ref( *this ) , detail::_1 ) );
boost::numeric::odeint::copy( x0 , get_current_state() );
m_t = t0;
m_dt = dt0;
m_is_deriv_initialized = false;
}
template< class System >
std::pair< time_type , time_type > do_step( System system )
{
if( !m_is_deriv_initialized )
{
typename odeint::unwrap_reference< System >::type &sys = system;
sys( get_current_state() , get_current_deriv() , m_t );
m_is_deriv_initialized = true;
}
failed_step_checker fail_checker; // to throw a runtime_error if step size adjustment fails
controlled_step_result res = fail;
m_t_old = m_t;
do
{
res = m_stepper.try_step( system , get_current_state() , get_current_deriv() , m_t ,
get_old_state() , get_old_deriv() , m_dt );
fail_checker(); // check for overflow of failed steps
}
while( res == fail );
toggle_current_state();
return std::make_pair( m_t_old , m_t );
}
/*
* The two overloads are needed in order to solve the forwarding problem.
*/
template< class StateOut >
void calc_state( time_type t , StateOut &x ) const
{
m_stepper.stepper().calc_state( t , x , get_old_state() , get_old_deriv() , m_t_old ,
get_current_state() , get_current_deriv() , m_t );
}
template< class StateOut >
void calc_state( time_type t , const StateOut &x ) const
{
m_stepper.stepper().calc_state( t , x , get_old_state() , get_old_deriv() , m_t_old ,
get_current_state() , get_current_deriv() , m_t );
}
template< class StateIn >
bool resize( const StateIn &x )
{
bool resized = false;
resized |= adjust_size_by_resizeability( m_x1 , x , typename is_resizeable<state_type>::type() );
resized |= adjust_size_by_resizeability( m_x2 , x , typename is_resizeable<state_type>::type() );
resized |= adjust_size_by_resizeability( m_dxdt1 , x , typename is_resizeable<deriv_type>::type() );
resized |= adjust_size_by_resizeability( m_dxdt2 , x , typename is_resizeable<deriv_type>::type() );
return resized;
}
template< class StateType >
void adjust_size( const StateType &x )
{
resize( x );
m_stepper.stepper().resize( x );
}
const state_type& current_state( void ) const
{
return get_current_state();
}
time_type current_time( void ) const
{
return m_t;
}
const state_type& previous_state( void ) const
{
return get_old_state();
}
time_type previous_time( void ) const
{
return m_t_old;
}
time_type current_time_step( void ) const
{
return m_dt;
}
private:
state_type& get_current_state( void )
{
return m_current_state_x1 ? m_x1.m_v : m_x2.m_v ;
}
const state_type& get_current_state( void ) const
{
return m_current_state_x1 ? m_x1.m_v : m_x2.m_v ;
}
state_type& get_old_state( void )
{
return m_current_state_x1 ? m_x2.m_v : m_x1.m_v ;
}
const state_type& get_old_state( void ) const
{
return m_current_state_x1 ? m_x2.m_v : m_x1.m_v ;
}
deriv_type& get_current_deriv( void )
{
return m_current_state_x1 ? m_dxdt1.m_v : m_dxdt2.m_v ;
}
const deriv_type& get_current_deriv( void ) const
{
return m_current_state_x1 ? m_dxdt1.m_v : m_dxdt2.m_v ;
}
deriv_type& get_old_deriv( void )
{
return m_current_state_x1 ? m_dxdt2.m_v : m_dxdt1.m_v ;
}
const deriv_type& get_old_deriv( void ) const
{
return m_current_state_x1 ? m_dxdt2.m_v : m_dxdt1.m_v ;
}
void toggle_current_state( void )
{
m_current_state_x1 = ! m_current_state_x1;
}
controlled_stepper_type m_stepper;
resizer_type m_resizer;
bool m_current_state_x1;
wrapped_state_type m_x1 , m_x2;
wrapped_deriv_type m_dxdt1 , m_dxdt2;
time_type m_t , m_t_old , m_dt;
bool m_is_deriv_initialized;
};
} // namespace odeint
} // namespace numeric
} // namespace boost
#endif // BOOST_NUMERIC_ODEINT_STEPPER_DENSE_OUTPUT_RUNGE_KUTTA_HPP_INCLUDED
@@ -0,0 +1,83 @@
subroutine addit(itone,nfsample,nsym,nsps,ifreq,sig,dat)
integer itone(nsym)
real dat(60*12000)
real*8 f,dt,twopi,phi,dphi,baud,fsample,freq,tsym,t
tsym=nsps*1.d0/nfsample !Symbol duration
baud=1.d0/tsym
fsample=12000.d0 !Sample rate (Hz)
dt=1.d0/fsample !Sample interval (s)
twopi=8.d0*atan(1.d0)
dphi=0.
iters=1
if(nsym.eq.79) iters=2
do iter=1,iters
f=ifreq
phi=0.
ntot=nsym*tsym/dt
k=12000 !Start audio at t = 1.0 s
t=0.
if(nsym.eq.79) k=12000 + (iter-1)*12000*30 !Special case for FT8
isym0=-1
do i=1,ntot
t=t+dt
isym=nint(t/tsym) + 1
if(isym.ne.isym0) then
freq=f + itone(isym)*baud
dphi=twopi*freq*dt
isym0=isym
endif
phi=phi + dphi
if(phi.gt.twopi) phi=phi-twopi
xphi=phi
k=k+1
dat(k)=dat(k) + sig*sin(xphi)
enddo
enddo
return
end subroutine addit
subroutine addcw(icw,ncw,ifreq,sig,dat)
integer icw(ncw)
real dat(60*12000)
real s(60*12000)
real x(60*12000)
real y(60*12000)
real*8 dt,twopi,phi,dphi,fsample,tdit,t
wpm=25.0
nspd=nint(1.2*12000.0/wpm)
fsample=12000.d0 !Sample rate (Hz)
dt=1.d0/fsample !Sample interval (s)
tdit=nspd*dt
twopi=8.d0*atan(1.d0)
dphi=twopi*ifreq*dt
phi=0.
k=12000 !Start audio at t = 1.0 s
t=0.
npts=60*12000
x=0.
do i=1,npts
t=t+dt
j=nint(t/tdit) + 1
j=mod(j-1,ncw) + 1
phi=phi + dphi
if(phi.gt.twopi) phi=phi-twopi
xphi=phi
k=k+1
x(k)=icw(j)
s(k)=sin(xphi)
if(t.ge.59.5) exit
enddo
nadd=0.004/dt
call smo(x,npts,y,nadd)
y=y/nadd
dat=dat + sig*y*s
return
end subroutine addcw
@@ -0,0 +1,75 @@
/*
* 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)
*
* Copyright (c) 2009 Helge Bahmann
* Copyright (c) 2012 Tim Blechmann
* Copyright (c) 2013 - 2014 Andrey Semashev
*/
/*!
* \file atomic/detail/caps_gcc_x86.hpp
*
* This header defines feature capabilities macros
*/
#ifndef BOOST_ATOMIC_DETAIL_CAPS_GCC_X86_HPP_INCLUDED_
#define BOOST_ATOMIC_DETAIL_CAPS_GCC_X86_HPP_INCLUDED_
#include <boost/atomic/detail/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
#if defined(__GNUC__)
#if defined(__i386__) &&\
(\
defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) ||\
defined(__i586__) || defined(__i686__) || defined(__pentium4__) || defined(__nocona__) || defined(__core2__) || defined(__corei7__) ||\
defined(__k6__) || defined(__athlon__) || defined(__k8__) || defined(__amdfam10__) || defined(__bdver1__) || defined(__bdver2__) || defined(__bdver3__) || defined(__btver1__) || defined(__btver2__)\
)
#define BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG8B 1
#endif
#if defined(__x86_64__) && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16)
#define BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG16B 1
#endif
#if defined(__x86_64__) || defined(__SSE2__)
// Use mfence only if SSE2 is available
#define BOOST_ATOMIC_DETAIL_X86_HAS_MFENCE 1
#endif
#else // defined(__GNUC__)
#if defined(__i386__) && !defined(BOOST_ATOMIC_NO_CMPXCHG8B)
#define BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG8B 1
#endif
#if defined(__x86_64__) && !defined(BOOST_ATOMIC_NO_CMPXCHG16B)
#define BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG16B 1
#endif
#if !defined(BOOST_ATOMIC_NO_MFENCE)
#define BOOST_ATOMIC_DETAIL_X86_HAS_MFENCE 1
#endif
#endif // defined(__GNUC__)
#define BOOST_ATOMIC_INT8_LOCK_FREE 2
#define BOOST_ATOMIC_INT16_LOCK_FREE 2
#define BOOST_ATOMIC_INT32_LOCK_FREE 2
#if defined(__x86_64__) || defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG8B)
#define BOOST_ATOMIC_INT64_LOCK_FREE 2
#endif
#if defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG16B) && (defined(BOOST_HAS_INT128) || !defined(BOOST_NO_ALIGNMENT))
#define BOOST_ATOMIC_INT128_LOCK_FREE 2
#endif
#define BOOST_ATOMIC_POINTER_LOCK_FREE 2
#define BOOST_ATOMIC_THREAD_FENCE 2
#define BOOST_ATOMIC_SIGNAL_FENCE 2
#endif // BOOST_ATOMIC_DETAIL_CAPS_GCC_X86_HPP_INCLUDED_
@@ -0,0 +1,352 @@
// Boost Lambda Library - operators.hpp --------------------------------------
// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
//
// 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)
//
// For more information, see www.boost.org
// ---------------------------------------------------------------
#ifndef BOOST_LAMBDA_OPERATORS_HPP
#define BOOST_LAMBDA_OPERATORS_HPP
#include "boost/lambda/detail/is_instance_of.hpp"
namespace boost {
namespace lambda {
#if defined BOOST_LAMBDA_BE1
#error "Multiple defines of BOOST_LAMBDA_BE1"
#endif
// For all BOOSTA_LAMBDA_BE* macros:
// CONSTA must be either 'A' or 'const A'
// CONSTB must be either 'B' or 'const B'
// It is stupid to have the names A and B as macro arguments, but it avoids
// the need to pass in emtpy macro arguments, which gives warnings on some
// compilers
#define BOOST_LAMBDA_BE1(OPER_NAME, ACTION, CONSTA, CONSTB, CONVERSION) \
template<class Arg, class B> \
inline const \
lambda_functor< \
lambda_functor_base< \
ACTION, \
tuple<lambda_functor<Arg>, typename const_copy_argument <CONSTB>::type> \
> \
> \
OPER_NAME (const lambda_functor<Arg>& a, CONSTB& b) { \
return \
lambda_functor_base< \
ACTION, \
tuple<lambda_functor<Arg>, typename const_copy_argument <CONSTB>::type>\
> \
(tuple<lambda_functor<Arg>, typename const_copy_argument <CONSTB>::type>(a, b)); \
}
#if defined BOOST_LAMBDA_BE2
#error "Multiple defines of BOOST_LAMBDA_BE2"
#endif
#define BOOST_LAMBDA_BE2(OPER_NAME, ACTION, CONSTA, CONSTB, CONVERSION) \
template<class A, class Arg> \
inline const \
lambda_functor< \
lambda_functor_base< \
ACTION, \
tuple<typename CONVERSION <CONSTA>::type, lambda_functor<Arg> > \
> \
> \
OPER_NAME (CONSTA& a, const lambda_functor<Arg>& b) { \
return \
lambda_functor_base< \
ACTION, \
tuple<typename CONVERSION <CONSTA>::type, lambda_functor<Arg> > \
> \
(tuple<typename CONVERSION <CONSTA>::type, lambda_functor<Arg> >(a, b)); \
}
#if defined BOOST_LAMBDA_BE3
#error "Multiple defines of BOOST_LAMBDA_BE3"
#endif
#define BOOST_LAMBDA_BE3(OPER_NAME, ACTION, CONSTA, CONSTB, CONVERSION) \
template<class ArgA, class ArgB> \
inline const \
lambda_functor< \
lambda_functor_base< \
ACTION, \
tuple<lambda_functor<ArgA>, lambda_functor<ArgB> > \
> \
> \
OPER_NAME (const lambda_functor<ArgA>& a, const lambda_functor<ArgB>& b) { \
return \
lambda_functor_base< \
ACTION, \
tuple<lambda_functor<ArgA>, lambda_functor<ArgB> > \
> \
(tuple<lambda_functor<ArgA>, lambda_functor<ArgB> >(a, b)); \
}
#if defined BOOST_LAMBDA_BE
#error "Multiple defines of BOOST_LAMBDA_BE"
#endif
#define BOOST_LAMBDA_BE(OPER_NAME, ACTION, CONSTA, CONSTB, CONST_CONVERSION) \
BOOST_LAMBDA_BE1(OPER_NAME, ACTION, CONSTA, CONSTB, CONST_CONVERSION) \
BOOST_LAMBDA_BE2(OPER_NAME, ACTION, CONSTA, CONSTB, CONST_CONVERSION) \
BOOST_LAMBDA_BE3(OPER_NAME, ACTION, CONSTA, CONSTB, CONST_CONVERSION)
#define BOOST_LAMBDA_EMPTY()
BOOST_LAMBDA_BE(operator+, arithmetic_action<plus_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator-, arithmetic_action<minus_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator*, arithmetic_action<multiply_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator/, arithmetic_action<divide_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator%, arithmetic_action<remainder_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator<<, bitwise_action<leftshift_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator>>, bitwise_action<rightshift_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator&, bitwise_action<and_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator|, bitwise_action<or_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator^, bitwise_action<xor_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator&&, logical_action<and_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator||, logical_action<or_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator<, relational_action<less_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator>, relational_action<greater_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator<=, relational_action<lessorequal_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator>=, relational_action<greaterorequal_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator==, relational_action<equal_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator!=, relational_action<notequal_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator+=, arithmetic_assignment_action<plus_action>, A, const B, reference_argument)
BOOST_LAMBDA_BE(operator-=, arithmetic_assignment_action<minus_action>, A, const B, reference_argument)
BOOST_LAMBDA_BE(operator*=, arithmetic_assignment_action<multiply_action>, A, const B, reference_argument)
BOOST_LAMBDA_BE(operator/=, arithmetic_assignment_action<divide_action>, A, const B, reference_argument)
BOOST_LAMBDA_BE(operator%=, arithmetic_assignment_action<remainder_action>, A, const B, reference_argument)
BOOST_LAMBDA_BE(operator<<=, bitwise_assignment_action<leftshift_action>, A, const B, reference_argument)
BOOST_LAMBDA_BE(operator>>=, bitwise_assignment_action<rightshift_action>, A, const B, reference_argument)
BOOST_LAMBDA_BE(operator&=, bitwise_assignment_action<and_action>, A, const B, reference_argument)
BOOST_LAMBDA_BE(operator|=, bitwise_assignment_action<or_action>, A, const B, reference_argument)
BOOST_LAMBDA_BE(operator^=, bitwise_assignment_action<xor_action>, A, const B, reference_argument)
// A special trick for comma operator for correct preprocessing
#if defined BOOST_LAMBDA_COMMA_OPERATOR_NAME
#error "Multiple defines of BOOST_LAMBDA_COMMA_OPERATOR_NAME"
#endif
#define BOOST_LAMBDA_COMMA_OPERATOR_NAME operator,
BOOST_LAMBDA_BE1(BOOST_LAMBDA_COMMA_OPERATOR_NAME, other_action<comma_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE2(BOOST_LAMBDA_COMMA_OPERATOR_NAME, other_action<comma_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE3(BOOST_LAMBDA_COMMA_OPERATOR_NAME, other_action<comma_action>, const A, const B, const_copy_argument)
namespace detail {
// special cases for ostream& << Any and istream& >> Any ---------------
// the actual stream classes may vary and thus a specialisation for,
// say ostream& does not match (the general case above is chosen).
// Therefore we specialise for non-const reference:
// if the left argument is a stream, we store the stream as reference
// if it is something else, we store a const plain by default
// Note that the overloading is const vs. non-const first argument
template<class T> struct convert_ostream_to_ref_others_to_c_plain_by_default {
typedef typename detail::IF<
is_instance_of_2<
T, std::basic_ostream
>::value,
T&,
typename const_copy_argument <T>::type
>::RET type;
};
template<class T> struct convert_istream_to_ref_others_to_c_plain_by_default {
typedef typename detail::IF<
is_instance_of_2<
T, std::basic_istream
>::value,
T&,
typename const_copy_argument <T>::type
>::RET type;
};
} // detail
BOOST_LAMBDA_BE2(operator<<, bitwise_action< leftshift_action>, A, const B, detail::convert_ostream_to_ref_others_to_c_plain_by_default)
BOOST_LAMBDA_BE2(operator>>, bitwise_action< rightshift_action>, A, const B, detail::convert_istream_to_ref_others_to_c_plain_by_default)
// special case for io_manipulators.
// function references cannot be given as arguments to lambda operator
// expressions in general. With << and >> the use of manipulators is
// so common, that specializations are provided to make them work.
template<class Arg, class Ret, class ManipArg>
inline const
lambda_functor<
lambda_functor_base<
bitwise_action<leftshift_action>,
tuple<lambda_functor<Arg>, Ret(&)(ManipArg)>
>
>
operator<<(const lambda_functor<Arg>& a, Ret(&b)(ManipArg))
{
return
lambda_functor_base<
bitwise_action<leftshift_action>,
tuple<lambda_functor<Arg>, Ret(&)(ManipArg)>
>
( tuple<lambda_functor<Arg>, Ret(&)(ManipArg)>(a, b) );
}
template<class Arg, class Ret, class ManipArg>
inline const
lambda_functor<
lambda_functor_base<
bitwise_action<rightshift_action>,
tuple<lambda_functor<Arg>, Ret(&)(ManipArg)>
>
>
operator>>(const lambda_functor<Arg>& a, Ret(&b)(ManipArg))
{
return
lambda_functor_base<
bitwise_action<rightshift_action>,
tuple<lambda_functor<Arg>, Ret(&)(ManipArg)>
>
( tuple<lambda_functor<Arg>, Ret(&)(ManipArg)>(a, b) );
}
// (+ and -) take their arguments as const references.
// This has consquences with pointer artihmetic
// E.g int a[]; ... *a = 1 works but not *(a+1) = 1.
// the result of a+1 would be const
// To make the latter work too,
// non-const arrays are taken as non-const and stored as non-const as well.
#if defined BOOST_LAMBDA_PTR_ARITHMETIC_E1
#error "Multiple defines of BOOST_LAMBDA_PTR_ARITHMETIC_E1"
#endif
#define BOOST_LAMBDA_PTR_ARITHMETIC_E1(OPER_NAME, ACTION, CONSTB) \
template<class Arg, int N, class B> \
inline const \
lambda_functor< \
lambda_functor_base<ACTION, tuple<lambda_functor<Arg>, CONSTB(&)[N]> > \
> \
OPER_NAME (const lambda_functor<Arg>& a, CONSTB(&b)[N]) \
{ \
return \
lambda_functor_base<ACTION, tuple<lambda_functor<Arg>, CONSTB(&)[N]> > \
(tuple<lambda_functor<Arg>, CONSTB(&)[N]>(a, b)); \
}
#if defined BOOST_LAMBDA_PTR_ARITHMETIC_E2
#error "Multiple defines of BOOST_LAMBDA_PTR_ARITHMETIC_E2"
#endif
#define BOOST_LAMBDA_PTR_ARITHMETIC_E2(OPER_NAME, ACTION, CONSTA) \
template<int N, class A, class Arg> \
inline const \
lambda_functor< \
lambda_functor_base<ACTION, tuple<CONSTA(&)[N], lambda_functor<Arg> > > \
> \
OPER_NAME (CONSTA(&a)[N], const lambda_functor<Arg>& b) \
{ \
return \
lambda_functor_base<ACTION, tuple<CONSTA(&)[N], lambda_functor<Arg> > > \
(tuple<CONSTA(&)[N], lambda_functor<Arg> >(a, b)); \
}
BOOST_LAMBDA_PTR_ARITHMETIC_E1(operator+, arithmetic_action<plus_action>, B)
BOOST_LAMBDA_PTR_ARITHMETIC_E2(operator+, arithmetic_action<plus_action>, A)
BOOST_LAMBDA_PTR_ARITHMETIC_E1(operator+, arithmetic_action<plus_action>,const B)
BOOST_LAMBDA_PTR_ARITHMETIC_E2(operator+, arithmetic_action<plus_action>,const A)
//BOOST_LAMBDA_PTR_ARITHMETIC_E1(operator-, arithmetic_action<minus_action>)
// This is not needed, since the result of ptr-ptr is an rvalue anyway
BOOST_LAMBDA_PTR_ARITHMETIC_E2(operator-, arithmetic_action<minus_action>, A)
BOOST_LAMBDA_PTR_ARITHMETIC_E2(operator-, arithmetic_action<minus_action>, const A)
#undef BOOST_LAMBDA_BE1
#undef BOOST_LAMBDA_BE2
#undef BOOST_LAMBDA_BE3
#undef BOOST_LAMBDA_BE
#undef BOOST_LAMBDA_COMMA_OPERATOR_NAME
#undef BOOST_LAMBDA_PTR_ARITHMETIC_E1
#undef BOOST_LAMBDA_PTR_ARITHMETIC_E2
// ---------------------------------------------------------------------
// unary operators -----------------------------------------------------
// ---------------------------------------------------------------------
#if defined BOOST_LAMBDA_UE
#error "Multiple defines of BOOST_LAMBDA_UE"
#endif
#define BOOST_LAMBDA_UE(OPER_NAME, ACTION) \
template<class Arg> \
inline const \
lambda_functor<lambda_functor_base<ACTION, tuple<lambda_functor<Arg> > > > \
OPER_NAME (const lambda_functor<Arg>& a) \
{ \
return \
lambda_functor_base<ACTION, tuple<lambda_functor<Arg> > > \
( tuple<lambda_functor<Arg> >(a) ); \
}
BOOST_LAMBDA_UE(operator+, unary_arithmetic_action<plus_action>)
BOOST_LAMBDA_UE(operator-, unary_arithmetic_action<minus_action>)
BOOST_LAMBDA_UE(operator~, bitwise_action<not_action>)
BOOST_LAMBDA_UE(operator!, logical_action<not_action>)
BOOST_LAMBDA_UE(operator++, pre_increment_decrement_action<increment_action>)
BOOST_LAMBDA_UE(operator--, pre_increment_decrement_action<decrement_action>)
BOOST_LAMBDA_UE(operator*, other_action<contentsof_action>)
BOOST_LAMBDA_UE(operator&, other_action<addressof_action>)
#if defined BOOST_LAMBDA_POSTFIX_UE
#error "Multiple defines of BOOST_LAMBDA_POSTFIX_UE"
#endif
#define BOOST_LAMBDA_POSTFIX_UE(OPER_NAME, ACTION) \
template<class Arg> \
inline const \
lambda_functor<lambda_functor_base<ACTION, tuple<lambda_functor<Arg> > > > \
OPER_NAME (const lambda_functor<Arg>& a, int) \
{ \
return \
lambda_functor_base<ACTION, tuple<lambda_functor<Arg> > > \
( tuple<lambda_functor<Arg> >(a) ); \
}
BOOST_LAMBDA_POSTFIX_UE(operator++, post_increment_decrement_action<increment_action>)
BOOST_LAMBDA_POSTFIX_UE(operator--, post_increment_decrement_action<decrement_action>)
#undef BOOST_LAMBDA_UE
#undef BOOST_LAMBDA_POSTFIX_UE
} // namespace lambda
} // namespace boost
#endif
@@ -0,0 +1,65 @@
// (C) Copyright Gennadiy Rozental 2001.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
/// @file
/// Defines global_fixture
// ***************************************************************************
#ifndef BOOST_TEST_TREE_GLOBAL_FIXTURE_HPP_091911GER
#define BOOST_TEST_TREE_GLOBAL_FIXTURE_HPP_091911GER
// Boost.Test
#include <boost/test/detail/config.hpp>
#include <boost/test/detail/global_typedef.hpp>
#include <boost/test/tree/observer.hpp>
#include <boost/test/detail/suppress_warnings.hpp>
//____________________________________________________________________________//
namespace boost {
namespace unit_test {
// ************************************************************************** //
// ************** global_fixture ************** //
// ************************************************************************** //
class BOOST_TEST_DECL global_fixture : public test_observer {
public:
// Constructor
global_fixture();
};
//____________________________________________________________________________//
namespace ut_detail {
template<typename F>
struct global_fixture_impl : public global_fixture {
// Constructor
global_fixture_impl() : m_fixture( 0 ) {}
// test observer interface
virtual void test_start( counter_t ) { m_fixture = new F; }
virtual void test_finish() { delete m_fixture; m_fixture = 0; }
virtual void test_aborted() { delete m_fixture; m_fixture = 0; }
private:
// Data members
F* m_fixture;
};
} // namespace ut_detail
} // namespace unit_test
} // namespace boost
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_TREE_GLOBAL_FIXTURE_HPP_091911GER
@@ -0,0 +1,132 @@
#ifndef BOOST_ARCHIVE_TEXT_IARCHIVE_HPP
#define BOOST_ARCHIVE_TEXT_IARCHIVE_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER)
# pragma once
#endif
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// text_iarchive.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for updates, documentation, and revision history.
#include <istream>
#include <boost/config.hpp>
#include <boost/archive/detail/auto_link_archive.hpp>
#include <boost/archive/basic_text_iprimitive.hpp>
#include <boost/archive/basic_text_iarchive.hpp>
#include <boost/archive/detail/register_archive.hpp>
#include <boost/serialization/item_version_type.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
#ifdef BOOST_MSVC
# pragma warning(push)
# pragma warning(disable : 4511 4512)
#endif
namespace boost {
namespace archive {
namespace detail {
template<class Archive> class interface_iarchive;
} // namespace detail
template<class Archive>
class BOOST_SYMBOL_VISIBLE text_iarchive_impl :
public basic_text_iprimitive<std::istream>,
public basic_text_iarchive<Archive>
{
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
public:
#else
protected:
friend class detail::interface_iarchive<Archive>;
friend class load_access;
#endif
template<class T>
void load(T & t){
basic_text_iprimitive<std::istream>::load(t);
}
void load(version_type & t){
unsigned int v;
load(v);
t = version_type(v);
}
void load(boost::serialization::item_version_type & t){
unsigned int v;
load(v);
t = boost::serialization::item_version_type(v);
}
BOOST_ARCHIVE_DECL void
load(char * t);
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
BOOST_ARCHIVE_DECL void
load(wchar_t * t);
#endif
BOOST_ARCHIVE_DECL void
load(std::string &s);
#ifndef BOOST_NO_STD_WSTRING
BOOST_ARCHIVE_DECL void
load(std::wstring &ws);
#endif
template<class T>
void load_override(T & t){
basic_text_iarchive<Archive>::load_override(t);
}
BOOST_ARCHIVE_DECL void
load_override(class_name_type & t);
BOOST_ARCHIVE_DECL void
init();
BOOST_ARCHIVE_DECL
text_iarchive_impl(std::istream & is, unsigned int flags);
// don't import inline definitions! leave this as a reminder.
//BOOST_ARCHIVE_DECL
~text_iarchive_impl(){};
};
} // namespace archive
} // namespace boost
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
#ifdef BOOST_MSVC
# pragma warning(push)
# pragma warning(disable : 4511 4512)
#endif
namespace boost {
namespace archive {
class BOOST_SYMBOL_VISIBLE text_iarchive :
public text_iarchive_impl<text_iarchive>{
public:
text_iarchive(std::istream & is_, unsigned int flags = 0) :
// note: added _ to suppress useless gcc warning
text_iarchive_impl<text_iarchive>(is_, flags)
{}
~text_iarchive(){}
};
} // namespace archive
} // namespace boost
// required by export
BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_iarchive)
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
#endif // BOOST_ARCHIVE_TEXT_IARCHIVE_HPP
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

@@ -0,0 +1,188 @@
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2014-2014. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/intrusive for documentation.
//
//////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_INTRUSIVE_POINTER_REBIND_HPP
#define BOOST_INTRUSIVE_POINTER_REBIND_HPP
#ifndef BOOST_INTRUSIVE_DETAIL_WORKAROUND_HPP
#include <boost/intrusive/detail/workaround.hpp>
#endif //BOOST_INTRUSIVE_DETAIL_WORKAROUND_HPP
#ifndef BOOST_CONFIG_HPP
# include <boost/config.hpp>
#endif
#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
namespace boost {
namespace intrusive {
///////////////////////////
//struct pointer_rebind_mode
///////////////////////////
template <typename Ptr, typename U>
struct pointer_has_rebind
{
template <typename V> struct any
{ any(const V&) { } };
template <typename X>
static char test(int, typename X::template rebind<U>*);
template <typename X>
static int test(any<int>, void*);
static const bool value = (1 == sizeof(test<Ptr>(0, 0)));
};
template <typename Ptr, typename U>
struct pointer_has_rebind_other
{
template <typename V> struct any
{ any(const V&) { } };
template <typename X>
static char test(int, typename X::template rebind<U>::other*);
template <typename X>
static int test(any<int>, void*);
static const bool value = (1 == sizeof(test<Ptr>(0, 0)));
};
template <typename Ptr, typename U>
struct pointer_rebind_mode
{
static const unsigned int rebind = (unsigned int)pointer_has_rebind<Ptr, U>::value;
static const unsigned int rebind_other = (unsigned int)pointer_has_rebind_other<Ptr, U>::value;
static const unsigned int mode = rebind + rebind*rebind_other;
};
////////////////////////
//struct pointer_rebinder
////////////////////////
template <typename Ptr, typename U, unsigned int RebindMode>
struct pointer_rebinder;
// Implementation of pointer_rebinder<U>::type if Ptr has
// its own rebind<U>::other type (C++03)
template <typename Ptr, typename U>
struct pointer_rebinder< Ptr, U, 2u >
{
typedef typename Ptr::template rebind<U>::other type;
};
// Implementation of pointer_rebinder<U>::type if Ptr has
// its own rebind template.
template <typename Ptr, typename U>
struct pointer_rebinder< Ptr, U, 1u >
{
typedef typename Ptr::template rebind<U> type;
};
// Specialization of pointer_rebinder if Ptr does not
// have its own rebind template but has a the form Ptr<A, An...>,
// where An... comprises zero or more type parameters.
// Many types fit this form, hence many pointers will get a
// reasonable default for rebind.
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template <template <class, class...> class Ptr, typename A, class... An, class U>
struct pointer_rebinder<Ptr<A, An...>, U, 0u >
{
typedef Ptr<U, An...> type;
};
//Needed for non-conforming compilers like GCC 4.3
template <template <class> class Ptr, typename A, class U>
struct pointer_rebinder<Ptr<A>, U, 0u >
{
typedef Ptr<U> type;
};
#else //C++03 compilers
template <template <class> class Ptr //0arg
, typename A
, class U>
struct pointer_rebinder<Ptr<A>, U, 0u>
{ typedef Ptr<U> type; };
template <template <class, class> class Ptr //1arg
, typename A, class P0
, class U>
struct pointer_rebinder<Ptr<A, P0>, U, 0u>
{ typedef Ptr<U, P0> type; };
template <template <class, class, class> class Ptr //2arg
, typename A, class P0, class P1
, class U>
struct pointer_rebinder<Ptr<A, P0, P1>, U, 0u>
{ typedef Ptr<U, P0, P1> type; };
template <template <class, class, class, class> class Ptr //3arg
, typename A, class P0, class P1, class P2
, class U>
struct pointer_rebinder<Ptr<A, P0, P1, P2>, U, 0u>
{ typedef Ptr<U, P0, P1, P2> type; };
template <template <class, class, class, class, class> class Ptr //4arg
, typename A, class P0, class P1, class P2, class P3
, class U>
struct pointer_rebinder<Ptr<A, P0, P1, P2, P3>, U, 0u>
{ typedef Ptr<U, P0, P1, P2, P3> type; };
template <template <class, class, class, class, class, class> class Ptr //5arg
, typename A, class P0, class P1, class P2, class P3, class P4
, class U>
struct pointer_rebinder<Ptr<A, P0, P1, P2, P3, P4>, U, 0u>
{ typedef Ptr<U, P0, P1, P2, P3, P4> type; };
template <template <class, class, class, class, class, class, class> class Ptr //6arg
, typename A, class P0, class P1, class P2, class P3, class P4, class P5
, class U>
struct pointer_rebinder<Ptr<A, P0, P1, P2, P3, P4, P5>, U, 0u>
{ typedef Ptr<U, P0, P1, P2, P3, P4, P5> type; };
template <template <class, class, class, class, class, class, class, class> class Ptr //7arg
, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6
, class U>
struct pointer_rebinder<Ptr<A, P0, P1, P2, P3, P4, P5, P6>, U, 0u>
{ typedef Ptr<U, P0, P1, P2, P3, P4, P5, P6> type; };
template <template <class, class, class, class, class, class, class, class, class> class Ptr //8arg
, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7
, class U>
struct pointer_rebinder<Ptr<A, P0, P1, P2, P3, P4, P5, P6, P7>, U, 0u>
{ typedef Ptr<U, P0, P1, P2, P3, P4, P5, P6, P7> type; };
template <template <class, class, class, class, class, class, class, class, class, class> class Ptr //9arg
, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8
, class U>
struct pointer_rebinder<Ptr<A, P0, P1, P2, P3, P4, P5, P6, P7, P8>, U, 0u>
{ typedef Ptr<U, P0, P1, P2, P3, P4, P5, P6, P7, P8> type; };
#endif //!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template <typename Ptr, typename U>
struct pointer_rebind
: public pointer_rebinder<Ptr, U, pointer_rebind_mode<Ptr, U>::mode>
{};
template <typename T, typename U>
struct pointer_rebind<T*, U>
{ typedef U* type; };
} //namespace container {
} //namespace boost {
#endif // defined(BOOST_INTRUSIVE_POINTER_REBIND_HPP)
@@ -0,0 +1,148 @@
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// Preprocessed version of "boost/mpl/minus.hpp" header
// -- DO NOT modify by hand!
namespace boost { namespace mpl {
template<
typename Tag1
, typename Tag2
, BOOST_MPL_AUX_NTTP_DECL(int, tag1_) = BOOST_MPL_AUX_MSVC_VALUE_WKND(Tag1)::value
, BOOST_MPL_AUX_NTTP_DECL(int, tag2_) = BOOST_MPL_AUX_MSVC_VALUE_WKND(Tag2)::value
>
struct minus_impl
: if_c<
( tag1_ > tag2_ )
, aux::cast2nd_impl< minus_impl< Tag1,Tag1 >,Tag1, Tag2 >
, aux::cast1st_impl< minus_impl< Tag2,Tag2 >,Tag1, Tag2 >
>::type
{
};
/// for Digital Mars C++/compilers with no CTPS/TTP support
template<> struct minus_impl< na,na >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template<> struct minus_impl< na,integral_c_tag >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template<> struct minus_impl< integral_c_tag,na >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template< typename T > struct minus_tag
{
typedef typename T::tag type;
};
/// forward declaration
template<
typename BOOST_MPL_AUX_NA_PARAM(N1)
, typename BOOST_MPL_AUX_NA_PARAM(N2)
>
struct minus2;
template<
typename BOOST_MPL_AUX_NA_PARAM(N1)
, typename BOOST_MPL_AUX_NA_PARAM(N2)
, typename N3 = na, typename N4 = na, typename N5 = na
>
struct minus
: if_<
is_na<N3>
, minus2< N1,N2 >
, minus<
minus2< N1,N2 >
, N3, N4, N5
>
>::type
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(
5
, minus
, ( N1, N2, N3, N4, N5 )
)
};
template<
typename N1
, typename N2
>
struct minus2
: aux::msvc_eti_base< typename apply_wrap2<
minus_impl<
typename minus_tag<N1>::type
, typename minus_tag<N2>::type
>
, N1
, N2
>::type >::type
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(2, minus2, (N1, N2))
};
BOOST_MPL_AUX_NA_SPEC2(2, 5, minus)
}}
namespace boost { namespace mpl {
namespace aux {
template< typename T, T n1, T n2 >
struct minus_wknd
{
BOOST_STATIC_CONSTANT(T, value = (n1 - n2));
typedef integral_c< T,value > type;
};
}
template<>
struct minus_impl< integral_c_tag,integral_c_tag >
{
template< typename N1, typename N2 > struct apply
: aux::minus_wknd<
typename aux::largest_int<
typename N1::value_type
, typename N2::value_type
>::type
, N1::value
, N2::value
>::type
{
};
};
}}
@@ -0,0 +1,136 @@
//---------------------------------------------------------------------------//
// Copyright (c) 2014 Roshan <thisisroshansmail@gmail.com>
//
// Distributed under the Boost Software License, Version 1.0
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
// See http://boostorg.github.com/compute for more information.
//---------------------------------------------------------------------------//
#ifndef BOOST_COMPUTE_ALGORITHM_FIND_END_HPP
#define BOOST_COMPUTE_ALGORITHM_FIND_END_HPP
#include <boost/compute/algorithm/copy.hpp>
#include <boost/compute/algorithm/detail/search_all.hpp>
#include <boost/compute/container/detail/scalar.hpp>
#include <boost/compute/container/vector.hpp>
#include <boost/compute/detail/iterator_range_size.hpp>
#include <boost/compute/detail/meta_kernel.hpp>
#include <boost/compute/system.hpp>
namespace boost {
namespace compute {
namespace detail {
///
/// \brief Helper function for find_end
///
/// Basically a copy of find_if which returns last occurence
/// instead of first occurence
///
template<class InputIterator, class UnaryPredicate>
inline InputIterator find_end_helper(InputIterator first,
InputIterator last,
UnaryPredicate predicate,
command_queue &queue)
{
typedef typename std::iterator_traits<InputIterator>::value_type value_type;
typedef typename std::iterator_traits<InputIterator>::difference_type difference_type;
size_t count = detail::iterator_range_size(first, last);
if(count == 0){
return last;
}
const context &context = queue.get_context();
detail::meta_kernel k("find_end");
size_t index_arg = k.add_arg<int *>(memory_object::global_memory, "index");
atomic_max<int_> atomic_max_int;
k << k.decl<const int_>("i") << " = get_global_id(0);\n"
<< k.decl<const value_type>("value") << "="
<< first[k.var<const int_>("i")] << ";\n"
<< "if(" << predicate(k.var<const value_type>("value")) << "){\n"
<< " " << atomic_max_int(k.var<int_ *>("index"), k.var<int_>("i")) << ";\n"
<< "}\n";
kernel kernel = k.compile(context);
scalar<int_> index(context);
kernel.set_arg(index_arg, index.get_buffer());
index.write(static_cast<int_>(-1), queue);
queue.enqueue_1d_range_kernel(kernel, 0, count, 0);
int result = static_cast<int>(index.read(queue));
if(result == -1){
return last;
}
else {
return first + static_cast<difference_type>(result);
}
}
} // end detail namespace
///
/// \brief Substring matching algorithm
///
/// Searches for the last match of the pattern [p_first, p_last)
/// in text [t_first, t_last).
/// \return Iterator pointing to beginning of last occurence
///
/// \param t_first Iterator pointing to start of text
/// \param t_last Iterator pointing to end of text
/// \param p_first Iterator pointing to start of pattern
/// \param p_last Iterator pointing to end of pattern
/// \param queue Queue on which to execute
///
template<class TextIterator, class PatternIterator>
inline TextIterator find_end(TextIterator t_first,
TextIterator t_last,
PatternIterator p_first,
PatternIterator p_last,
command_queue &queue = system::default_queue())
{
const context &context = queue.get_context();
// there is no need to check if pattern starts at last n - 1 indices
vector<uint_> matching_indices(
detail::iterator_range_size(t_first, t_last)
+ 1 - detail::iterator_range_size(p_first, p_last),
context
);
detail::search_kernel<PatternIterator,
TextIterator,
vector<uint_>::iterator> kernel;
kernel.set_range(p_first, p_last, t_first, t_last, matching_indices.begin());
kernel.exec(queue);
using boost::compute::_1;
vector<uint_>::iterator index =
detail::find_end_helper(
matching_indices.begin(),
matching_indices.end(),
_1 == 1,
queue
);
// pattern was not found
if(index == matching_indices.end())
return t_last;
return t_first + detail::iterator_range_size(matching_indices.begin(), index);
}
} //end compute namespace
} //end boost namespace
#endif // BOOST_COMPUTE_ALGORITHM_FIND_END_HPP
@@ -0,0 +1,28 @@
# /* **************************************************************************
# * *
# * (C) Copyright Edward Diener 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 for most recent version. */
#
# ifndef BOOST_PREPROCESSOR_TUPLE_DETAIL_IS_SINGLE_RETURN_HPP
# define BOOST_PREPROCESSOR_TUPLE_DETAIL_IS_SINGLE_RETURN_HPP
#
# include <boost/preprocessor/config/config.hpp>
#
# /* BOOST_PP_TUPLE_IS_SINGLE_RETURN */
#
# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC
# include <boost/preprocessor/control/iif.hpp>
# include <boost/preprocessor/facilities/is_1.hpp>
# include <boost/preprocessor/tuple/size.hpp>
# define BOOST_PP_TUPLE_IS_SINGLE_RETURN(sr,nsr,tuple) \
BOOST_PP_IIF(BOOST_PP_IS_1(BOOST_PP_TUPLE_SIZE(tuple)),sr,nsr) \
/**/
# endif /* BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC */
#
# endif /* BOOST_PREPROCESSOR_TUPLE_DETAIL_IS_SINGLE_RETURN_HPP */
@@ -0,0 +1,18 @@
integer ii(16) !Locations of sync symbols
data ii/ 1,2,5,10,16,23,33,35,51,52,55,60,66,73,83,85/
integer ii2(16) !Locations of sync half-symbols
data ii2/1,3,9,19,31,45,65,69,101,103,109,119,131,145,165,169/
integer ka(16),kb(16) !Reference symbols for sync
data ka/5,5,11,21,33,47,63,71,97,105,111,121,133,147,159,163/
data kb/7,7,13,23,35,49,67,73,99,107,113,123,135,149,161,167/
integer isync(85) !Sync vector
data isync/ &
1,1,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0, &
0,0,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0, &
0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,1, &
0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0, &
0,0,1,0,1/
@@ -0,0 +1,120 @@
// Boost string_algo library formatter.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003.
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_FORMATTER_HPP
#define BOOST_STRING_FORMATTER_HPP
#include <boost/detail/iterator.hpp>
#include <boost/range/value_type.hpp>
#include <boost/range/iterator_range_core.hpp>
#include <boost/range/as_literal.hpp>
#include <boost/algorithm/string/detail/formatter.hpp>
/*! \file
Defines Formatter generators. Formatter is a functor which formats
a string according to given parameters. A Formatter works
in conjunction with a Finder. A Finder can provide additional information
for a specific Formatter. An example of such a cooperation is regex_finder
and regex_formatter.
Formatters are used as pluggable components for replace facilities.
This header contains generator functions for the Formatters provided in this library.
*/
namespace boost {
namespace algorithm {
// generic formatters ---------------------------------------------------------------//
//! Constant formatter
/*!
Constructs a \c const_formatter. Const formatter always returns
the same value, regardless of the parameter.
\param Format A predefined value used as a result for formatting
\return An instance of the \c const_formatter object.
*/
template<typename RangeT>
inline detail::const_formatF<
iterator_range<
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> >
const_formatter(const RangeT& Format)
{
return detail::const_formatF<
iterator_range<
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> >(::boost::as_literal(Format));
}
//! Identity formatter
/*!
Constructs an \c identity_formatter. Identity formatter always returns
the parameter.
\return An instance of the \c identity_formatter object.
*/
template<typename RangeT>
inline detail::identity_formatF<
iterator_range<
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> >
identity_formatter()
{
return detail::identity_formatF<
iterator_range<
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> >();
}
//! Empty formatter
/*!
Constructs an \c empty_formatter. Empty formatter always returns an empty
sequence.
\param Input container used to select a correct value_type for the
resulting empty_container<>.
\return An instance of the \c empty_formatter object.
*/
template<typename RangeT>
inline detail::empty_formatF<
BOOST_STRING_TYPENAME range_value<RangeT>::type>
empty_formatter(const RangeT&)
{
return detail::empty_formatF<
BOOST_STRING_TYPENAME range_value<RangeT>::type>();
}
//! Empty formatter
/*!
Constructs a \c dissect_formatter. Dissect formatter uses a specified finder
to extract a portion of the formatted sequence. The first finder's match is returned
as a result
\param Finder a finder used to select a portion of the formatted sequence
\return An instance of the \c dissect_formatter object.
*/
template<typename FinderT>
inline detail::dissect_formatF< FinderT >
dissect_formatter(const FinderT& Finder)
{
return detail::dissect_formatF<FinderT>(Finder);
}
} // namespace algorithm
// pull the names to the boost namespace
using algorithm::const_formatter;
using algorithm::identity_formatter;
using algorithm::empty_formatter;
using algorithm::dissect_formatter;
} // namespace boost
#endif // BOOST_FORMATTER_HPP
@@ -0,0 +1,66 @@
#if !BOOST_PHOENIX_IS_ITERATING
/*==============================================================================
Copyright (c) 2005-2010 Joel de Guzman
Copyright (c) 2010 Thomas Heller
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#include <boost/phoenix/support/iterate.hpp>
#define BOOST_PHOENIX_EXTRACT_LOCAL_TYPE(Z, N, D) \
typename proto::detail::uncvref< \
typename proto::result_of::child_c< \
BOOST_PP_CAT(A, N) \
, 1 \
>::type \
>::type
/**/
#define BOOST_PHOENIX_EXTRACT_LOCAL(Z, N, D) \
proto::child_c<1>(BOOST_PP_CAT(a, N)) \
/**/
#define BOOST_PHOENIX_EXTRACT_LOCAL_KEY(Z, N, D) \
typename proto::detail::uncvref< \
typename proto::result_of::value< \
typename proto::result_of::child_c< \
BOOST_PP_CAT(A, N) \
, 0 \
>::type \
>::type \
>::type
/**/
#define BOOST_PHOENIX_ITERATION_PARAMS \
(3, (1, BOOST_PHOENIX_LOCAL_LIMIT, \
<boost/phoenix/scope/detail/cpp03/local_gen.hpp>))
#include BOOST_PHOENIX_ITERATE()
#else
template <BOOST_PHOENIX_typename_A>
BOOST_PHOENIX_SCOPE_ACTOR_GEN_NAME<
BOOST_PP_CAT(vector, BOOST_PHOENIX_ITERATION)<BOOST_PP_ENUM(BOOST_PHOENIX_ITERATION, BOOST_PHOENIX_EXTRACT_LOCAL_TYPE, _)>
, detail::map_local_index_to_tuple<BOOST_PP_ENUM(BOOST_PHOENIX_ITERATION, BOOST_PHOENIX_EXTRACT_LOCAL_KEY, _)>
>
BOOST_PHOENIX_SCOPE_ACTOR_GEN_FUNCTION (BOOST_PHOENIX_A_const_ref_a) BOOST_PHOENIX_SCOPE_ACTOR_GEN_CONST
{
typedef
BOOST_PP_CAT(vector, BOOST_PHOENIX_ITERATION)<BOOST_PP_ENUM(BOOST_PHOENIX_ITERATION, BOOST_PHOENIX_EXTRACT_LOCAL_TYPE, _)>
locals_type;
locals_type locals = {BOOST_PP_ENUM(BOOST_PHOENIX_ITERATION, BOOST_PHOENIX_EXTRACT_LOCAL, _)};
return
BOOST_PHOENIX_SCOPE_ACTOR_GEN_NAME<
locals_type
, detail::map_local_index_to_tuple<
BOOST_PP_ENUM(BOOST_PHOENIX_ITERATION, BOOST_PHOENIX_EXTRACT_LOCAL_KEY, _)
>
>(locals);
}
#endif
@@ -0,0 +1,29 @@
subroutine flat1b(psavg,nsmo,s2,nh,nsteps,nhmax,nsmax)
real psavg(nh)
real s2(nhmax,nsmax)
real x(8192)
ia=nsmo/2 + 1
ib=nh - nsmo/2 - 1
do i=ia,ib
call pctile(psavg(i-nsmo/2),nsmo,50,x(i))
enddo
do i=1,ia-1
x(i)=x(ia)
enddo
do i=ib+1,nh
x(i)=x(ib)
enddo
do i=1,nh
psavg(i)=psavg(i)/x(i)
do j=1,nsteps
s2(i,j)=s2(i,j)/x(i)
enddo
enddo
return
end subroutine flat1b
@@ -0,0 +1,9 @@
subroutine graycode(ia,n,idir,ib)
integer ia(n),ib(n)
do i=1,n
ib(i)=igray(ia(i),idir)
enddo
return
end subroutine graycode
@@ -0,0 +1,130 @@
/*
[auto_generated]
boost/numeric/odeint/util/multi_array_adaption.hpp
[begin_description]
tba.
[end_description]
Copyright 2009-2012 Karsten Ahnert
Copyright 2009-2012 Mario Mulansky
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_UTIL_MULTI_ARRAY_ADAPTION_HPP_DEFINED
#define BOOST_NUMERIC_ODEINT_UTIL_MULTI_ARRAY_ADAPTION_HPP_DEFINED
#include <boost/numeric/odeint/util/is_resizeable.hpp>
#include <boost/numeric/odeint/util/resize.hpp>
#include <boost/numeric/odeint/util/same_size.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/multi_array.hpp>
namespace boost {
namespace numeric {
namespace odeint {
template< typename T >
struct is_multi_array
{
typedef boost::false_type type;
const static bool value = type::value;
};
template< typename T >
struct is_resizeable_multi_array
{
typedef boost::false_type type;
const static bool value = type::value;
};
template< typename V , size_t Dim , typename A >
struct is_multi_array< boost::multi_array< V , Dim , A > >
{
typedef boost::true_type type;
const static bool value = type::value;
};
template< typename V , size_t Dim , typename A >
struct is_resizeable_multi_array< boost::multi_array< V , Dim , A > >
{
typedef boost::true_type type;
const static bool value = type::value;
};
template< typename T >
struct is_resizeable_sfinae< T , typename boost::enable_if< typename is_resizeable_multi_array< T >::type >::type >
{
typedef boost::true_type type;
const static bool value = type::value;
};
template< typename T1 , typename T2 >
struct same_size_impl_sfinae< T1 , T2 ,
typename boost::enable_if<
typename boost::mpl::and_<
is_multi_array< T1 > ,
is_multi_array< T2 > ,
boost::mpl::bool_< T1::dimensionality == T2::dimensionality >
>::type
>::type >
{
static bool same_size( T1 const &x1 , T2 const &x2 )
{
for( size_t i=0 ; i<T1::dimensionality ; ++i )
{
if( x1.shape()[i] != x2.shape()[i] ) return false;
if( x1.index_bases()[i] != x2.index_bases()[i] ) return false;
}
return true;
}
};
template< typename T1 , typename T2 >
struct resize_impl_sfinae< T1 , T2 ,
typename boost::enable_if<
typename boost::mpl::and_<
is_resizeable_multi_array< T1 > ,
is_multi_array< T2 > ,
boost::mpl::bool_< T1::dimensionality == T2::dimensionality >
>::type
>::type >
{
static void resize( T1 &x1 , const T2 &x2 )
{
boost::array< int , T1::dimensionality > extents;
for( size_t i=0 ; i<T1::dimensionality ; ++i ) extents[i] = x2.shape()[i];
x1.resize( extents );
boost::array< int , T1::dimensionality > origins;
for( size_t i=0 ; i<T1::dimensionality ; ++i ) origins[i] = x2.index_bases()[i];
x1.reindex( origins );
}
};
} // namespace odeint
} // namespace numeric
} // namespace boost
#endif // BOOST_NUMERIC_ODEINT_UTIL_MULTI_ARRAY_ADAPTION_HPP_DEFINED
@@ -0,0 +1,116 @@
//---------------------------------------------------------------------------//
// Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com>
//
// Distributed under the Boost Software License, Version 1.0
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
// See http://boostorg.github.com/compute for more information.
//---------------------------------------------------------------------------//
#ifndef BOOST_COMPUTE_ALGORITHM_ADJACENT_DIFFERENCE_HPP
#define BOOST_COMPUTE_ALGORITHM_ADJACENT_DIFFERENCE_HPP
#include <iterator>
#include <boost/compute/system.hpp>
#include <boost/compute/command_queue.hpp>
#include <boost/compute/detail/meta_kernel.hpp>
#include <boost/compute/detail/iterator_range_size.hpp>
#include <boost/compute/functional/operator.hpp>
#include <boost/compute/container/vector.hpp>
namespace boost {
namespace compute {
namespace detail {
template<class InputIterator, class OutputIterator, class BinaryFunction>
inline OutputIterator
dispatch_adjacent_difference(InputIterator first,
InputIterator last,
OutputIterator result,
BinaryFunction op,
command_queue &queue = system::default_queue())
{
size_t count = detail::iterator_range_size(first, last);
detail::meta_kernel k("adjacent_difference");
k << "const uint i = get_global_id(0);\n"
<< "if(i == 0){\n"
<< " " << result[k.var<uint_>("0")] << " = " << first[k.var<uint_>("0")] << ";\n"
<< "}\n"
<< "else {\n"
<< " " << result[k.var<uint_>("i")] << " = "
<< op(first[k.var<uint_>("i")], first[k.var<uint_>("i-1")]) << ";\n"
<< "}\n";
k.exec_1d(queue, 0, count, 1);
return result + count;
}
} // end detail namespace
/// Stores the difference of each pair of consecutive values in the range
/// [\p first, \p last) to the range beginning at \p result. If \p op is not
/// provided, \c minus<T> is used.
///
/// \param first first element in the input range
/// \param last last element in the input range
/// \param result first element in the output range
/// \param op binary difference function
/// \param queue command queue to perform the operation
///
/// \return \c OutputIterator to the end of the result range
///
/// \see adjacent_find()
template<class InputIterator, class OutputIterator, class BinaryFunction>
inline OutputIterator
adjacent_difference(InputIterator first,
InputIterator last,
OutputIterator result,
BinaryFunction op,
command_queue &queue = system::default_queue())
{
typedef typename std::iterator_traits<InputIterator>::value_type value_type;
if(first == last) {
return result;
}
if (first == result) {
vector<value_type> temp(detail::iterator_range_size(first, last),
queue.get_context());
copy(first, last, temp.begin(), queue);
return ::boost::compute::detail::dispatch_adjacent_difference(
temp.begin(), temp.end(), result, op, queue
);
}
else {
return ::boost::compute::detail::dispatch_adjacent_difference(
first, last, result, op, queue
);
}
}
/// \overload
template<class InputIterator, class OutputIterator>
inline OutputIterator
adjacent_difference(InputIterator first,
InputIterator last,
OutputIterator result,
command_queue &queue = system::default_queue())
{
typedef typename std::iterator_traits<InputIterator>::value_type value_type;
return ::boost::compute::adjacent_difference(
first, last, result, ::boost::compute::minus<value_type>(), queue
);
}
} // end compute namespace
} // end boost namespace
#endif // BOOST_COMPUTE_ALGORITHM_ADJACENT_DIFFERENCE_HPP
@@ -0,0 +1,66 @@
// (C) Copyright Gennadiy Rozental 2001.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
/// @file
/// @brief defines simple text based progress monitor
// ***************************************************************************
#ifndef BOOST_TEST_PROGRESS_MONITOR_HPP_020105GER
#define BOOST_TEST_PROGRESS_MONITOR_HPP_020105GER
// Boost.Test
#include <boost/test/tree/observer.hpp>
#include <boost/test/utils/trivial_singleton.hpp>
// STL
#include <iosfwd> // for std::ostream&
#include <boost/test/detail/suppress_warnings.hpp>
//____________________________________________________________________________//
namespace boost {
namespace unit_test {
// ************************************************************************** //
// ************** progress_monitor ************** //
// ************************************************************************** //
/// This class implements test observer interface and updates test progress as test units finish or get aborted
class BOOST_TEST_DECL progress_monitor_t : public test_observer, public singleton<progress_monitor_t> {
public:
/// @name Test observer interface
/// @{
virtual void test_start( counter_t test_cases_amount );
virtual void test_aborted();
virtual void test_unit_finish( test_unit const&, unsigned long );
virtual void test_unit_skipped( test_unit const&, const_string );
virtual int priority() { return 3; }
/// @}
/// @name Configuration
/// @{
void set_stream( std::ostream& );
/// @}
private:
BOOST_TEST_SINGLETON_CONS( progress_monitor_t )
}; // progress_monitor_t
BOOST_TEST_SINGLETON_INST( progress_monitor )
} // namespace unit_test
} // namespace boost
//____________________________________________________________________________//
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_PROGRESS_MONITOR_HPP_020105GER
@@ -0,0 +1,22 @@
#ifndef BOOST_MPL_INT_HPP_INCLUDED
#define BOOST_MPL_INT_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/int_fwd.hpp>
#define AUX_WRAPPER_VALUE_TYPE int
#include <boost/mpl/aux_/integral_wrapper.hpp>
#endif // BOOST_MPL_INT_HPP_INCLUDED