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,27 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QTimer>
#include "qcustomplot.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
void setupPlot();
void plotspec(QCustomPlot *customPlot);
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
@@ -0,0 +1,121 @@
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2007-2013
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/intrusive for documentation.
//
/////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_INTRUSIVE_DETAIL_PARENT_FROM_MEMBER_HPP
#define BOOST_INTRUSIVE_DETAIL_PARENT_FROM_MEMBER_HPP
#ifndef BOOST_CONFIG_HPP
# include <boost/config.hpp>
#endif
#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
#include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/detail/workaround.hpp>
#include <cstddef>
#if defined(_MSC_VER)
#define BOOST_INTRUSIVE_MSVC_ABI_PTR_TO_MEMBER
#include <boost/static_assert.hpp>
#endif
namespace boost {
namespace intrusive {
namespace detail {
template<class Parent, class Member>
BOOST_INTRUSIVE_FORCEINLINE std::ptrdiff_t offset_from_pointer_to_member(const Member Parent::* ptr_to_member)
{
//The implementation of a pointer to member is compiler dependent.
#if defined(BOOST_INTRUSIVE_MSVC_ABI_PTR_TO_MEMBER)
//MSVC compliant compilers use their the first 32 bits as offset (even in 64 bit mode)
union caster_union
{
const Member Parent::* ptr_to_member;
int offset;
} caster;
//MSVC ABI can use up to 3 int32 to represent pointer to member data
//with virtual base classes, in those cases there is no simple to
//obtain the address of the parent. So static assert to avoid runtime errors
BOOST_STATIC_ASSERT( sizeof(caster) == sizeof(int) );
caster.ptr_to_member = ptr_to_member;
return std::ptrdiff_t(caster.offset);
//Additional info on MSVC behaviour for the future. For 2/3 int ptr-to-member
//types dereference seems to be:
//
// vboffset = [compile_time_offset if 2-int ptr2memb] /
// [ptr2memb.i32[2] if 3-int ptr2memb].
// vbtable = *(this + vboffset);
// adj = vbtable[ptr2memb.i32[1]];
// var = adj + (this + vboffset) + ptr2memb.i32[0];
//
//To reverse the operation we need to
// - obtain vboffset (in 2-int ptr2memb implementation only)
// - Go to Parent's vbtable and obtain adjustment at index ptr2memb.i32[1]
// - parent = member - adj - vboffset - ptr2memb.i32[0]
//
//Even accessing to RTTI we might not be able to obtain this information
//so anyone who thinks it's possible, please send a patch.
//This works with gcc, msvc, ac++, ibmcpp
#elif defined(__GNUC__) || defined(__HP_aCC) || defined(BOOST_INTEL) || \
defined(__IBMCPP__) || defined(__DECCXX)
const Parent * const parent = 0;
const char *const member = static_cast<const char*>(static_cast<const void*>(&(parent->*ptr_to_member)));
return std::ptrdiff_t(member - static_cast<const char*>(static_cast<const void*>(parent)));
#else
//This is the traditional C-front approach: __MWERKS__, __DMC__, __SUNPRO_CC
union caster_union
{
const Member Parent::* ptr_to_member;
std::ptrdiff_t offset;
} caster;
caster.ptr_to_member = ptr_to_member;
return caster.offset - 1;
#endif
}
template<class Parent, class Member>
BOOST_INTRUSIVE_FORCEINLINE Parent *parent_from_member(Member *member, const Member Parent::* ptr_to_member)
{
return static_cast<Parent*>
(
static_cast<void*>
(
static_cast<char*>(static_cast<void*>(member)) - offset_from_pointer_to_member(ptr_to_member)
)
);
}
template<class Parent, class Member>
BOOST_INTRUSIVE_FORCEINLINE const Parent *parent_from_member(const Member *member, const Member Parent::* ptr_to_member)
{
return static_cast<const Parent*>
(
static_cast<const void*>
(
static_cast<const char*>(static_cast<const void*>(member)) - offset_from_pointer_to_member(ptr_to_member)
)
);
}
} //namespace detail {
} //namespace intrusive {
} //namespace boost {
#include <boost/intrusive/detail/config_end.hpp>
#endif //#ifndef BOOST_INTRUSIVE_DETAIL_PARENT_FROM_MEMBER_HPP
@@ -0,0 +1,180 @@
// Copyright Neil Groves 2009. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
//
// For more information, see http://www.boost.org/libs/range/
//
#ifndef BOOST_RANGE_DETAIL_RANGE_RETURN_HPP_INCLUDED
#define BOOST_RANGE_DETAIL_RANGE_RETURN_HPP_INCLUDED
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/iterator_range.hpp>
namespace boost
{
enum range_return_value
{
// (*) indicates the most common values
return_found, // only the found resulting iterator (*)
return_next, // next(found) iterator
return_prior, // prior(found) iterator
return_begin_found, // [begin, found) range (*)
return_begin_next, // [begin, next(found)) range
return_begin_prior, // [begin, prior(found)) range
return_found_end, // [found, end) range (*)
return_next_end, // [next(found), end) range
return_prior_end, // [prior(found), end) range
return_begin_end // [begin, end) range
};
template< class SinglePassRange, range_return_value >
struct range_return
{
typedef boost::iterator_range<
BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange>::type > type;
static type pack(BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange>::type found,
SinglePassRange& rng)
{
return type(found, boost::end(rng));
}
};
template< class SinglePassRange >
struct range_return< SinglePassRange, return_found >
{
typedef BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange>::type type;
static type pack(type found, SinglePassRange&)
{
return found;
}
};
template< class SinglePassRange >
struct range_return< SinglePassRange, return_next >
{
typedef BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange>::type type;
static type pack(type found, SinglePassRange& rng)
{
return found == boost::end(rng)
? found
: boost::next(found);
}
};
template< class BidirectionalRange >
struct range_return< BidirectionalRange, return_prior >
{
typedef BOOST_DEDUCED_TYPENAME range_iterator<BidirectionalRange>::type type;
static type pack(type found, BidirectionalRange& rng)
{
return found == boost::begin(rng)
? found
: boost::prior(found);
}
};
template< class SinglePassRange >
struct range_return< SinglePassRange, return_begin_found >
{
typedef boost::iterator_range<
BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange>::type > type;
static type pack(BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange>::type found,
SinglePassRange& rng)
{
return type(boost::begin(rng), found);
}
};
template< class SinglePassRange >
struct range_return< SinglePassRange, return_begin_next >
{
typedef boost::iterator_range<
BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange>::type > type;
static type pack(BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange>::type found,
SinglePassRange& rng)
{
return type( boost::begin(rng),
found == boost::end(rng) ? found : boost::next(found) );
}
};
template< class BidirectionalRange >
struct range_return< BidirectionalRange, return_begin_prior >
{
typedef boost::iterator_range<
BOOST_DEDUCED_TYPENAME range_iterator<BidirectionalRange>::type > type;
static type pack(BOOST_DEDUCED_TYPENAME range_iterator<BidirectionalRange>::type found,
BidirectionalRange& rng)
{
return type( boost::begin(rng),
found == boost::begin(rng) ? found : boost::prior(found) );
}
};
template< class SinglePassRange >
struct range_return< SinglePassRange, return_found_end >
{
typedef boost::iterator_range<
BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange>::type > type;
static type pack(BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange>::type found,
SinglePassRange& rng)
{
return type(found, boost::end(rng));
}
};
template< class SinglePassRange >
struct range_return< SinglePassRange, return_next_end >
{
typedef boost::iterator_range<
BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange>::type > type;
static type pack(BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange>::type found,
SinglePassRange& rng)
{
return type( found == boost::end(rng) ? found : boost::next(found),
boost::end(rng) );
}
};
template< class BidirectionalRange >
struct range_return< BidirectionalRange, return_prior_end >
{
typedef boost::iterator_range<
BOOST_DEDUCED_TYPENAME range_iterator<BidirectionalRange>::type > type;
static type pack(BOOST_DEDUCED_TYPENAME range_iterator<BidirectionalRange>::type found,
BidirectionalRange& rng)
{
return type( found == boost::begin(rng) ? found : boost::prior(found),
boost::end(rng) );
}
};
template< class SinglePassRange >
struct range_return< SinglePassRange, return_begin_end >
{
typedef boost::iterator_range<
BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange>::type > type;
static type pack(BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange>::type,
SinglePassRange& rng)
{
return type(boost::begin(rng), boost::end(rng));
}
};
}
#endif // include guard
@@ -0,0 +1,180 @@
/*
[auto_generated]
boost/numeric/odeint/iterator/const_step_iterator.hpp
[begin_description]
Iterator for iterating through the solution of an ODE with constant step size.
[end_description]
Copyright 2012-2013 Karsten Ahnert
Copyright 2013 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_ITERATOR_CONST_STEP_ODE_ITERATOR_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_ITERATOR_CONST_STEP_ODE_ITERATOR_HPP_INCLUDED
#include <boost/numeric/odeint/util/stepper_traits.hpp>
#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
#include <boost/numeric/odeint/iterator/detail/ode_iterator_base.hpp>
#include <boost/numeric/odeint/iterator/impl/const_step_iterator_impl.hpp>
namespace boost {
namespace numeric {
namespace odeint {
/* use the const_step_iterator_impl with the right tags */
template< class Stepper , class System , class State
#ifndef DOXYGEN_SKIP
, class StepperTag = typename base_tag< typename traits::stepper_category< Stepper >::type >::type
#endif
>
class const_step_iterator : public const_step_iterator_impl<
const_step_iterator< Stepper , System , State , StepperTag > ,
Stepper , System , State , detail::ode_state_iterator_tag , StepperTag
>
{
typedef typename traits::time_type< Stepper >::type time_type;
typedef const_step_iterator< Stepper , System , State , StepperTag > iterator_type;
public:
const_step_iterator( Stepper stepper , System sys , State &s , time_type t_start , time_type t_end , time_type dt )
: const_step_iterator_impl< iterator_type , Stepper , System , State , detail::ode_state_iterator_tag , StepperTag >( stepper , sys , s , t_start , t_end , dt )
{}
const_step_iterator( Stepper stepper , System sys , State &s )
: const_step_iterator_impl< iterator_type , Stepper , System , State , detail::ode_state_iterator_tag , StepperTag >( stepper , sys , s )
{}
};
/* make functions */
template< class Stepper , class System , class State >
const_step_iterator< Stepper , System, State > make_const_step_iterator_begin(
Stepper stepper ,
System system ,
State &x ,
typename traits::time_type< Stepper >::type t_start ,
typename traits::time_type< Stepper >::type t_end ,
typename traits::time_type< Stepper >::type dt )
{
return const_step_iterator< Stepper , System , State >( stepper , system , x , t_start , t_end , dt );
}
template< class Stepper , class System , class State >
const_step_iterator< Stepper , System , State > make_const_step_iterator_end(
Stepper stepper ,
System system ,
State &x )
{
return const_step_iterator< Stepper , System , State >( stepper , system , x );
}
template< class Stepper , class System , class State >
std::pair< const_step_iterator< Stepper , System , State > , const_step_iterator< Stepper , System , State > >
make_const_step_range(
Stepper stepper ,
System system ,
State &x ,
typename traits::time_type< Stepper >::type t_start ,
typename traits::time_type< Stepper >::type t_end ,
typename traits::time_type< Stepper >::type dt )
{
return std::make_pair(
const_step_iterator< Stepper , System , State >( stepper , system , x , t_start , t_end , dt ) ,
const_step_iterator< Stepper , System , State >( stepper , system , x )
);
}
/**
* \class const_step_iterator
*
* \brief ODE Iterator with constant step size. The value type of this iterator is the state type of the stepper.
*
* Implements an iterator representing the solution of an ODE from t_start
* to t_end evaluated at steps with constant step size dt.
* After each iteration the iterator dereferences to the state x at the next
* time t+dt.
* This iterator can be used with Steppers and
* DenseOutputSteppers and it always makes use of the all the given steppers
* capabilities. A for_each over such an iterator range behaves similar to
* the integrate_const routine.
*
* const_step_iterator is a model of single-pass iterator.
*
* The value type of this iterator is the state type of the stepper. Hence one can only access the state and not the current time.
*
* \tparam Stepper The stepper type which should be used during the iteration.
* \tparam System The type of the system function (ODE) which should be solved.
* \tparam State The state type of the ODE.
*/
/**
* \fn make_const_step_iterator_begin(
Stepper stepper ,
System system ,
State &x ,
typename traits::time_type< Stepper >::type t_start ,
typename traits::time_type< Stepper >::type t_end ,
typename traits::time_type< Stepper >::type dt )
*
* \brief Factory function for const_step_iterator. Constructs a begin iterator.
*
* \param stepper The stepper to use during the iteration.
* \param system The system function (ODE) to solve.
* \param x The initial state. const_step_iterator stores a reference of s and changes its value during the iteration.
* \param t_start The initial time.
* \param t_end The end time, at which the iteration should stop.
* \param dt The initial time step.
* \returns The const step iterator.
*/
/**
* \fn make_const_step_iterator_end( Stepper stepper , System system , State &x )
* \brief Factory function for const_step_iterator. Constructs a end iterator.
*
* \param stepper The stepper to use during the iteration.
* \param system The system function (ODE) to solve.
* \param x The initial state. const_step_iterator stores a reference of s and changes its value during the iteration.
* \returns The const_step_iterator.
*/
/**
* \fn make_const_step_range( Stepper stepper , System system , State &x ,
typename traits::time_type< Stepper >::type t_start ,
typename traits::time_type< Stepper >::type t_end ,
typename traits::time_type< Stepper >::type dt )
*
* \brief Factory function to construct a single pass range of const step iterators. A range is here a pair
* of const_step_iterator.
*
* \param stepper The stepper to use during the iteration.
* \param system The system function (ODE) to solve.
* \param x The initial state. const_step_iterator store a reference of s and changes its value during the iteration.
* \param t_start The initial time.
* \param t_end The end time, at which the iteration should stop.
* \param dt The initial time step.
* \returns The const step range.
*/
} // namespace odeint
} // namespace numeric
} // namespace boost
//#include <boost/numeric/odeint/iterator/impl/const_step_iterator_dense_output_impl.hpp>
#endif // BOOST_NUMERIC_ODEINT_ITERATOR_CONST_STEP_ODE_ITERATOR_HPP_INCLUDED
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,397 @@
// Copyright Peter Dimov 2001
// Copyright Aleksey Gurtovoy 2001-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 the main "bind.hpp" header
// -- DO NOT modify by hand!
namespace boost { namespace mpl {
namespace aux {
template<
typename T, typename U1, typename U2, typename U3, typename U4
, typename U5
>
struct resolve_bind_arg
{
typedef T type;
};
template<
typename T
, typename Arg
>
struct replace_unnamed_arg
{
typedef Arg next;
typedef T type;
};
template<
typename Arg
>
struct replace_unnamed_arg< arg< -1 >, Arg >
{
typedef typename Arg::next next;
typedef Arg type;
};
template<
int N, typename U1, typename U2, typename U3, typename U4, typename U5
>
struct resolve_bind_arg< arg<N>, U1, U2, U3, U4, U5 >
{
typedef typename apply_wrap5<mpl::arg<N>, U1, U2, U3, U4, U5>::type type;
};
} // namespace aux
template<
typename F
>
struct bind0
{
template<
typename U1, typename U2, typename U3, typename U4, typename U5
>
struct apply
{
private:
typedef aux::replace_unnamed_arg< F, mpl::arg<1> > r0;
typedef typename r0::type a0;
typedef typename r0::next n1;
typedef typename aux::resolve_bind_arg< a0,U1,U2,U3,U4,U5 >::type f_;
///
public:
typedef typename apply_wrap0<
f_
>::type type;
};
};
namespace aux {
template<
typename F, typename U1, typename U2, typename U3, typename U4
, typename U5
>
struct resolve_bind_arg<
bind0<F>, U1, U2, U3, U4, U5
>
{
typedef bind0<F> f_;
typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
};
} // namespace aux
BOOST_MPL_AUX_ARITY_SPEC(1, bind0)
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(1, bind0)
template<
typename F, typename T1
>
struct bind1
{
template<
typename U1, typename U2, typename U3, typename U4, typename U5
>
struct apply
{
private:
typedef aux::replace_unnamed_arg< F, mpl::arg<1> > r0;
typedef typename r0::type a0;
typedef typename r0::next n1;
typedef typename aux::resolve_bind_arg< a0,U1,U2,U3,U4,U5 >::type f_;
///
typedef aux::replace_unnamed_arg< T1,n1 > r1;
typedef typename r1::type a1;
typedef typename r1::next n2;
typedef aux::resolve_bind_arg< a1,U1,U2,U3,U4,U5 > t1;
///
public:
typedef typename apply_wrap1<
f_
, typename t1::type
>::type type;
};
};
namespace aux {
template<
typename F, typename T1, typename U1, typename U2, typename U3
, typename U4, typename U5
>
struct resolve_bind_arg<
bind1< F,T1 >, U1, U2, U3, U4, U5
>
{
typedef bind1< F,T1 > f_;
typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
};
} // namespace aux
BOOST_MPL_AUX_ARITY_SPEC(2, bind1)
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(2, bind1)
template<
typename F, typename T1, typename T2
>
struct bind2
{
template<
typename U1, typename U2, typename U3, typename U4, typename U5
>
struct apply
{
private:
typedef aux::replace_unnamed_arg< F, mpl::arg<1> > r0;
typedef typename r0::type a0;
typedef typename r0::next n1;
typedef typename aux::resolve_bind_arg< a0,U1,U2,U3,U4,U5 >::type f_;
///
typedef aux::replace_unnamed_arg< T1,n1 > r1;
typedef typename r1::type a1;
typedef typename r1::next n2;
typedef aux::resolve_bind_arg< a1,U1,U2,U3,U4,U5 > t1;
///
typedef aux::replace_unnamed_arg< T2,n2 > r2;
typedef typename r2::type a2;
typedef typename r2::next n3;
typedef aux::resolve_bind_arg< a2,U1,U2,U3,U4,U5 > t2;
///
public:
typedef typename apply_wrap2<
f_
, typename t1::type, typename t2::type
>::type type;
};
};
namespace aux {
template<
typename F, typename T1, typename T2, typename U1, typename U2
, typename U3, typename U4, typename U5
>
struct resolve_bind_arg<
bind2< F,T1,T2 >, U1, U2, U3, U4, U5
>
{
typedef bind2< F,T1,T2 > f_;
typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
};
} // namespace aux
BOOST_MPL_AUX_ARITY_SPEC(3, bind2)
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(3, bind2)
template<
typename F, typename T1, typename T2, typename T3
>
struct bind3
{
template<
typename U1, typename U2, typename U3, typename U4, typename U5
>
struct apply
{
private:
typedef aux::replace_unnamed_arg< F, mpl::arg<1> > r0;
typedef typename r0::type a0;
typedef typename r0::next n1;
typedef typename aux::resolve_bind_arg< a0,U1,U2,U3,U4,U5 >::type f_;
///
typedef aux::replace_unnamed_arg< T1,n1 > r1;
typedef typename r1::type a1;
typedef typename r1::next n2;
typedef aux::resolve_bind_arg< a1,U1,U2,U3,U4,U5 > t1;
///
typedef aux::replace_unnamed_arg< T2,n2 > r2;
typedef typename r2::type a2;
typedef typename r2::next n3;
typedef aux::resolve_bind_arg< a2,U1,U2,U3,U4,U5 > t2;
///
typedef aux::replace_unnamed_arg< T3,n3 > r3;
typedef typename r3::type a3;
typedef typename r3::next n4;
typedef aux::resolve_bind_arg< a3,U1,U2,U3,U4,U5 > t3;
///
public:
typedef typename apply_wrap3<
f_
, typename t1::type, typename t2::type, typename t3::type
>::type type;
};
};
namespace aux {
template<
typename F, typename T1, typename T2, typename T3, typename U1
, typename U2, typename U3, typename U4, typename U5
>
struct resolve_bind_arg<
bind3< F,T1,T2,T3 >, U1, U2, U3, U4, U5
>
{
typedef bind3< F,T1,T2,T3 > f_;
typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
};
} // namespace aux
BOOST_MPL_AUX_ARITY_SPEC(4, bind3)
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(4, bind3)
template<
typename F, typename T1, typename T2, typename T3, typename T4
>
struct bind4
{
template<
typename U1, typename U2, typename U3, typename U4, typename U5
>
struct apply
{
private:
typedef aux::replace_unnamed_arg< F, mpl::arg<1> > r0;
typedef typename r0::type a0;
typedef typename r0::next n1;
typedef typename aux::resolve_bind_arg< a0,U1,U2,U3,U4,U5 >::type f_;
///
typedef aux::replace_unnamed_arg< T1,n1 > r1;
typedef typename r1::type a1;
typedef typename r1::next n2;
typedef aux::resolve_bind_arg< a1,U1,U2,U3,U4,U5 > t1;
///
typedef aux::replace_unnamed_arg< T2,n2 > r2;
typedef typename r2::type a2;
typedef typename r2::next n3;
typedef aux::resolve_bind_arg< a2,U1,U2,U3,U4,U5 > t2;
///
typedef aux::replace_unnamed_arg< T3,n3 > r3;
typedef typename r3::type a3;
typedef typename r3::next n4;
typedef aux::resolve_bind_arg< a3,U1,U2,U3,U4,U5 > t3;
///
typedef aux::replace_unnamed_arg< T4,n4 > r4;
typedef typename r4::type a4;
typedef typename r4::next n5;
typedef aux::resolve_bind_arg< a4,U1,U2,U3,U4,U5 > t4;
///
public:
typedef typename apply_wrap4<
f_
, typename t1::type, typename t2::type, typename t3::type
, typename t4::type
>::type type;
};
};
namespace aux {
template<
typename F, typename T1, typename T2, typename T3, typename T4
, typename U1, typename U2, typename U3, typename U4, typename U5
>
struct resolve_bind_arg<
bind4< F,T1,T2,T3,T4 >, U1, U2, U3, U4, U5
>
{
typedef bind4< F,T1,T2,T3,T4 > f_;
typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
};
} // namespace aux
BOOST_MPL_AUX_ARITY_SPEC(5, bind4)
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(5, bind4)
template<
typename F, typename T1, typename T2, typename T3, typename T4
, typename T5
>
struct bind5
{
template<
typename U1, typename U2, typename U3, typename U4, typename U5
>
struct apply
{
private:
typedef aux::replace_unnamed_arg< F, mpl::arg<1> > r0;
typedef typename r0::type a0;
typedef typename r0::next n1;
typedef typename aux::resolve_bind_arg< a0,U1,U2,U3,U4,U5 >::type f_;
///
typedef aux::replace_unnamed_arg< T1,n1 > r1;
typedef typename r1::type a1;
typedef typename r1::next n2;
typedef aux::resolve_bind_arg< a1,U1,U2,U3,U4,U5 > t1;
///
typedef aux::replace_unnamed_arg< T2,n2 > r2;
typedef typename r2::type a2;
typedef typename r2::next n3;
typedef aux::resolve_bind_arg< a2,U1,U2,U3,U4,U5 > t2;
///
typedef aux::replace_unnamed_arg< T3,n3 > r3;
typedef typename r3::type a3;
typedef typename r3::next n4;
typedef aux::resolve_bind_arg< a3,U1,U2,U3,U4,U5 > t3;
///
typedef aux::replace_unnamed_arg< T4,n4 > r4;
typedef typename r4::type a4;
typedef typename r4::next n5;
typedef aux::resolve_bind_arg< a4,U1,U2,U3,U4,U5 > t4;
///
typedef aux::replace_unnamed_arg< T5,n5 > r5;
typedef typename r5::type a5;
typedef typename r5::next n6;
typedef aux::resolve_bind_arg< a5,U1,U2,U3,U4,U5 > t5;
///
public:
typedef typename apply_wrap5<
f_
, typename t1::type, typename t2::type, typename t3::type
, typename t4::type, typename t5::type
>::type type;
};
};
namespace aux {
template<
typename F, typename T1, typename T2, typename T3, typename T4
, typename T5, typename U1, typename U2, typename U3, typename U4
, typename U5
>
struct resolve_bind_arg<
bind5< F,T1,T2,T3,T4,T5 >, U1, U2, U3, U4, U5
>
{
typedef bind5< F,T1,T2,T3,T4,T5 > f_;
typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
};
} // namespace aux
BOOST_MPL_AUX_ARITY_SPEC(6, bind5)
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(6, bind5)
}}
@@ -0,0 +1,157 @@
// Boost.Range library
//
// Copyright Jonathan Turkanis 2005. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// For more information, see http://www.boost.org/libs/range/
//
#ifndef BOOST_RANGE_DETAIL_REMOVE_BOUNDS_HPP
#define BOOST_RANGE_DETAIL_REMOVE_BOUNDS_HPP
#include <boost/config.hpp> // MSVC, NO_INTRINSIC_WCHAR_T, put size_t in std.
#include <cstddef>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/type_traits/is_same.hpp>
namespace boost
{
namespace range_detail
{
template< typename Case1 = mpl::true_,
typename Type1 = mpl::void_,
typename Case2 = mpl::true_,
typename Type2 = mpl::void_,
typename Case3 = mpl::true_,
typename Type3 = mpl::void_,
typename Case4 = mpl::true_,
typename Type4 = mpl::void_,
typename Case5 = mpl::true_,
typename Type5 = mpl::void_,
typename Case6 = mpl::true_,
typename Type6 = mpl::void_,
typename Case7 = mpl::true_,
typename Type7 = mpl::void_,
typename Case8 = mpl::true_,
typename Type8 = mpl::void_,
typename Case9 = mpl::true_,
typename Type9 = mpl::void_,
typename Case10 = mpl::true_,
typename Type10 = mpl::void_,
typename Case11 = mpl::true_,
typename Type11 = mpl::void_,
typename Case12 = mpl::true_,
typename Type12 = mpl::void_,
typename Case13 = mpl::true_,
typename Type13 = mpl::void_,
typename Case14 = mpl::true_,
typename Type14 = mpl::void_,
typename Case15 = mpl::true_,
typename Type15 = mpl::void_,
typename Case16 = mpl::true_,
typename Type16 = mpl::void_,
typename Case17 = mpl::true_,
typename Type17 = mpl::void_,
typename Case18 = mpl::true_,
typename Type18 = mpl::void_,
typename Case19 = mpl::true_,
typename Type19 = mpl::void_,
typename Case20 = mpl::true_,
typename Type20 = mpl::void_>
struct select {
typedef typename
mpl::eval_if<
Case1, mpl::identity<Type1>, mpl::eval_if<
Case2, mpl::identity<Type2>, mpl::eval_if<
Case3, mpl::identity<Type3>, mpl::eval_if<
Case4, mpl::identity<Type4>, mpl::eval_if<
Case5, mpl::identity<Type5>, mpl::eval_if<
Case6, mpl::identity<Type6>, mpl::eval_if<
Case7, mpl::identity<Type7>, mpl::eval_if<
Case8, mpl::identity<Type8>, mpl::eval_if<
Case9, mpl::identity<Type9>, mpl::if_<
Case10, Type10, mpl::void_ > > > > > > > > >
>::type result1;
typedef typename
mpl::eval_if<
Case11, mpl::identity<Type11>, mpl::eval_if<
Case12, mpl::identity<Type12>, mpl::eval_if<
Case13, mpl::identity<Type13>, mpl::eval_if<
Case14, mpl::identity<Type14>, mpl::eval_if<
Case15, mpl::identity<Type15>, mpl::eval_if<
Case16, mpl::identity<Type16>, mpl::eval_if<
Case17, mpl::identity<Type17>, mpl::eval_if<
Case18, mpl::identity<Type18>, mpl::eval_if<
Case19, mpl::identity<Type19>, mpl::if_<
Case20, Type20, mpl::void_ > > > > > > > > >
> result2;
typedef typename
mpl::eval_if<
is_same<result1, mpl::void_>,
result2,
mpl::identity<result1>
>::type type;
};
template<typename T>
struct remove_extent {
static T* ar;
BOOST_STATIC_CONSTANT(std::size_t, size = sizeof(*ar) / sizeof((*ar)[0]));
typedef typename
select<
is_same<T, bool[size]>, bool,
is_same<T, char[size]>, char,
is_same<T, signed char[size]>, signed char,
is_same<T, unsigned char[size]>, unsigned char,
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
is_same<T, wchar_t[size]>, wchar_t,
#endif
is_same<T, short[size]>, short,
is_same<T, unsigned short[size]>, unsigned short,
is_same<T, int[size]>, int,
is_same<T, unsigned int[size]>, unsigned int,
is_same<T, long[size]>, long,
is_same<T, unsigned long[size]>, unsigned long,
is_same<T, float[size]>, float,
is_same<T, double[size]>, double,
is_same<T, long double[size]>, long double
>::type result1;
typedef typename
select<
is_same<T, const bool[size]>, const bool,
is_same<T, const char[size]>, const char,
is_same<T, const signed char[size]>, const signed char,
is_same<T, const unsigned char[size]>, const unsigned char,
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
is_same<T, const wchar_t[size]>, const wchar_t,
#endif
is_same<T, const short[size]>, const short,
is_same<T, const unsigned short[size]>, const unsigned short,
is_same<T, const int[size]>, const int,
is_same<T, const unsigned int[size]>, const unsigned int,
is_same<T, const long[size]>, const long,
is_same<T, const unsigned long[size]>, const unsigned long,
is_same<T, const float[size]>, const float,
is_same<T, const double[size]>, const double,
is_same<T, const long double[size]>, const long double
> result2;
typedef typename
mpl::eval_if<
is_same<result1, mpl::void_>,
result2,
mpl::identity<result1>
>::type type;
};
} // namespace 'range_detail'
} // namespace 'boost'
#endif
@@ -0,0 +1,246 @@
/*
[auto_generated]
boost/numeric/odeint/stepper/explicit_generic_rk.hpp
[begin_description]
Implementation of the generic Runge-Kutta steppers. This is the base class for many Runge-Kutta steppers.
[end_description]
Copyright 2011-2013 Mario Mulansky
Copyright 2011-2013 Karsten Ahnert
Copyright 2012 Christoph Koke
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or
copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_EXPLICIT_GENERIC_RK_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_STEPPER_EXPLICIT_GENERIC_RK_HPP_INCLUDED
#include <boost/array.hpp>
#include <boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp>
#include <boost/numeric/odeint/algebra/range_algebra.hpp>
#include <boost/numeric/odeint/algebra/default_operations.hpp>
#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp>
#include <boost/numeric/odeint/algebra/operations_dispatcher.hpp>
#include <boost/numeric/odeint/stepper/detail/generic_rk_algorithm.hpp>
#include <boost/numeric/odeint/util/state_wrapper.hpp>
#include <boost/numeric/odeint/util/is_resizeable.hpp>
#include <boost/numeric/odeint/util/resizer.hpp>
namespace boost {
namespace numeric {
namespace odeint {
//forward declarations
#ifndef DOXYGEN_SKIP
template<
size_t StageCount,
size_t Order,
class State ,
class Value = double ,
class Deriv = State ,
class Time = Value ,
class Algebra = typename algebra_dispatcher< State >::algebra_type ,
class Operations = typename operations_dispatcher< State >::operations_type ,
class Resizer = initially_resizer
>
class explicit_generic_rk;
struct stage_vector;
template< class T , class Constant >
struct array_wrapper
{
typedef const typename boost::array< T , Constant::value > type;
};
template< class T , size_t i >
struct stage
{
T c;
boost::array< T , i > a;
};
template< class T , class Constant >
struct stage_wrapper
{
typedef stage< T , Constant::value > type;
};
#endif
template<
size_t StageCount,
size_t Order,
class State ,
class Value ,
class Deriv ,
class Time ,
class Algebra ,
class Operations ,
class Resizer
>
#ifndef DOXYGEN_SKIP
class explicit_generic_rk : public explicit_stepper_base<
explicit_generic_rk< StageCount , Order , State , Value , Deriv , Time , Algebra , Operations , Resizer > ,
Order , State , Value , Deriv , Time , Algebra , Operations , Resizer >
#else
class explicit_generic_rk : public explicit_stepper_base
#endif
{
public:
#ifndef DOXYGEN_SKIP
typedef explicit_stepper_base<
explicit_generic_rk< StageCount , Order , State , Value , Deriv ,Time , Algebra , Operations , Resizer > ,
Order , State , Value , Deriv , Time , Algebra ,
Operations , Resizer > stepper_base_type;
#else
typedef explicit_stepper_base< ... > stepper_base_type;
#endif
typedef typename stepper_base_type::state_type state_type;
typedef typename stepper_base_type::wrapped_state_type wrapped_state_type;
typedef typename stepper_base_type::value_type value_type;
typedef typename stepper_base_type::deriv_type deriv_type;
typedef typename stepper_base_type::wrapped_deriv_type wrapped_deriv_type;
typedef typename stepper_base_type::time_type time_type;
typedef typename stepper_base_type::algebra_type algebra_type;
typedef typename stepper_base_type::operations_type operations_type;
typedef typename stepper_base_type::resizer_type resizer_type;
#ifndef DOXYGEN_SKIP
typedef explicit_generic_rk< StageCount , Order , State , Value , Deriv ,Time , Algebra , Operations , Resizer > stepper_type;
#endif
typedef detail::generic_rk_algorithm< StageCount , Value , Algebra , Operations > rk_algorithm_type;
typedef typename rk_algorithm_type::coef_a_type coef_a_type;
typedef typename rk_algorithm_type::coef_b_type coef_b_type;
typedef typename rk_algorithm_type::coef_c_type coef_c_type;
#ifndef DOXYGEN_SKIP
static const size_t stage_count = StageCount;
#endif
public:
explicit_generic_rk( const coef_a_type &a , const coef_b_type &b , const coef_c_type &c ,
const algebra_type &algebra = algebra_type() )
: stepper_base_type( algebra ) , m_rk_algorithm( a , b , c )
{ }
template< class System , class StateIn , class DerivIn , class StateOut >
void do_step_impl( System system , const StateIn &in , const DerivIn &dxdt ,
time_type t , StateOut &out , time_type dt )
{
m_resizer.adjust_size( in , detail::bind( &stepper_type::template resize_impl< StateIn > , detail::ref( *this ) , detail::_1 ) );
// actual calculation done in generic_rk.hpp
m_rk_algorithm.do_step( stepper_base_type::m_algebra , system , in , dxdt , t , out , dt , m_x_tmp.m_v , m_F );
}
template< class StateIn >
void adjust_size( const StateIn &x )
{
resize_impl( x );
stepper_base_type::adjust_size( x );
}
private:
template< class StateIn >
bool resize_impl( const StateIn &x )
{
bool resized( false );
resized |= adjust_size_by_resizeability( m_x_tmp , x , typename is_resizeable<state_type>::type() );
for( size_t i = 0 ; i < StageCount-1 ; ++i )
{
resized |= adjust_size_by_resizeability( m_F[i] , x , typename is_resizeable<deriv_type>::type() );
}
return resized;
}
rk_algorithm_type m_rk_algorithm;
resizer_type m_resizer;
wrapped_state_type m_x_tmp;
wrapped_deriv_type m_F[StageCount-1];
};
/*********** DOXYGEN *************/
/**
* \class explicit_generic_rk
* \brief A generic implementation of explicit Runge-Kutta algorithms. This class is as a base class
* for all explicit Runge-Kutta steppers.
*
* This class implements the explicit Runge-Kutta algorithms without error estimation in a generic way.
* The Butcher tableau is passed to the stepper which constructs the stepper scheme with the help of a
* template-metaprogramming algorithm. ToDo : Add example!
*
* This class derives explicit_stepper_base which provides the stepper interface.
*
* \tparam StageCount The number of stages of the Runge-Kutta algorithm.
* \tparam Order The order of the stepper.
* \tparam State The type representing the state of the ODE.
* \tparam Value The floating point type which is used in the computations.
* \tparam Time The type representing the independent variable - the time - of the ODE.
* \tparam Algebra The algebra type.
* \tparam Operations The operations type.
* \tparam Resizer The resizer policy type.
*/
/**
* \fn explicit_generic_rk::explicit_generic_rk( const coef_a_type &a , const coef_b_type &b , const coef_c_type &c , const algebra_type &algebra )
* \brief Constructs the explicit_generic_rk class. See examples section for details on the coefficients.
* \param a Triangular matrix of parameters b in the Butcher tableau.
* \param b Last row of the butcher tableau.
* \param c Parameters to calculate the time points in the Butcher tableau.
* \param algebra A copy of algebra is made and stored inside explicit_stepper_base.
*/
/**
* \fn explicit_generic_rk::do_step_impl( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt )
* \brief This method performs one step. The derivative `dxdt` of `in` at the time `t` is passed to the method.
* The result is updated out of place, hence the input is in `in` and the output in `out`.
* Access to this step functionality is provided by explicit_stepper_base and
* `do_step_impl` should not be called directly.
*
* \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the
* Simple System concept.
* \param in The state of the ODE which should be solved. in is not modified in this method
* \param dxdt The derivative of x at t.
* \param t The value of the time, at which the step should be performed.
* \param out The result of the step is written in out.
* \param dt The step size.
*/
/**
* \fn explicit_generic_rk::adjust_size( const StateIn &x )
* \brief Adjust the size of all temporaries in the stepper manually.
* \param x A state from which the size of the temporaries to be resized is deduced.
*/
}
}
}
#endif // BOOST_NUMERIC_ODEINT_STEPPER_EXPLICIT_GENERIC_RK_HPP_INCLUDED
@@ -0,0 +1,106 @@
// Copyright (C) 2007 Douglas Gregor
// 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)
// This file contains a simplification of the "trigger" method for
// process groups. The simple trigger handles the common case where
// the handler associated with a trigger is a member function bound to
// a particular pointer.
#ifndef BOOST_PROPERTY_MAP_PARALLEL_SIMPLE_TRIGGER_HPP
#define BOOST_PROPERTY_MAP_PARALLEL_SIMPLE_TRIGGER_HPP
#include <boost/property_map/parallel/process_group.hpp>
namespace boost { namespace parallel {
namespace detail {
/**
* INTERNAL ONLY
*
* The actual function object that bridges from the normal trigger
* interface to the simplified interface. This is the equivalent of
* bind(pmf, self, _1, _2, _3, _4), but without the compile-time
* overhead of bind.
*/
template<typename Class, typename T, typename Result>
class simple_trigger_t
{
public:
simple_trigger_t(Class* self,
Result (Class::*pmf)(int, int, const T&,
trigger_receive_context))
: self(self), pmf(pmf) { }
Result
operator()(int source, int tag, const T& data,
trigger_receive_context context) const
{
return (self->*pmf)(source, tag, data, context);
}
private:
Class* self;
Result (Class::*pmf)(int, int, const T&, trigger_receive_context);
};
} // end namespace detail
/**
* Simplified trigger interface that reduces the amount of code
* required to connect a process group trigger to a handler that is
* just a bound member function.
*
* INTERNAL ONLY
*/
template<typename ProcessGroup, typename Class, typename T>
inline void
simple_trigger(ProcessGroup& pg, int tag, Class* self,
void (Class::*pmf)(int source, int tag, const T& data,
trigger_receive_context context), int)
{
pg.template trigger<T>(tag,
detail::simple_trigger_t<Class, T, void>(self, pmf));
}
/**
* Simplified trigger interface that reduces the amount of code
* required to connect a process group trigger with a reply to a
* handler that is just a bound member function.
*
* INTERNAL ONLY
*/
template<typename ProcessGroup, typename Class, typename T, typename Result>
inline void
simple_trigger(ProcessGroup& pg, int tag, Class* self,
Result (Class::*pmf)(int source, int tag, const T& data,
trigger_receive_context context), long)
{
pg.template trigger_with_reply<T>
(tag, detail::simple_trigger_t<Class, T, Result>(self, pmf));
}
/**
* Simplified trigger interface that reduces the amount of code
* required to connect a process group trigger to a handler that is
* just a bound member function.
*/
template<typename ProcessGroup, typename Class, typename T, typename Result>
inline void
simple_trigger(ProcessGroup& pg, int tag, Class* self,
Result (Class::*pmf)(int source, int tag, const T& data,
trigger_receive_context context))
{
// We pass 0 (an int) to help VC++ disambiguate calls to simple_trigger
// with Result=void.
simple_trigger(pg, tag, self, pmf, 0);
}
} } // end namespace boost::parallel
namespace boost { namespace graph { namespace parallel { using boost::parallel::simple_trigger; } } }
#endif // BOOST_PROPERTY_MAP_PARALLEL_SIMPLE_TRIGGER_HPP
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,198 @@
#ifndef BOOST_CORE_LIGHTWEIGHT_TEST_HPP
#define BOOST_CORE_LIGHTWEIGHT_TEST_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER)
# pragma once
#endif
//
// boost/core/lightweight_test.hpp - lightweight test library
//
// Copyright (c) 2002, 2009, 2014 Peter Dimov
// Copyright (2) Beman Dawes 2010, 2011
// Copyright (3) Ion Gaztanaga 2013
//
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
#include <boost/assert.hpp>
#include <boost/current_function.hpp>
#include <boost/core/no_exceptions_support.hpp>
#include <iostream>
// IDE's like Visual Studio perform better if output goes to std::cout or
// some other stream, so allow user to configure output stream:
#ifndef BOOST_LIGHTWEIGHT_TEST_OSTREAM
# define BOOST_LIGHTWEIGHT_TEST_OSTREAM std::cerr
#endif
namespace boost
{
namespace detail
{
struct report_errors_reminder
{
bool called_report_errors_function;
report_errors_reminder() : called_report_errors_function(false) {}
~report_errors_reminder()
{
BOOST_ASSERT(called_report_errors_function); // verify report_errors() was called
}
};
inline report_errors_reminder& report_errors_remind()
{
static report_errors_reminder r;
return r;
}
inline int & test_errors()
{
static int x = 0;
report_errors_remind();
return x;
}
inline void test_failed_impl(char const * expr, char const * file, int line, char const * function)
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): test '" << expr << "' failed in function '"
<< function << "'" << std::endl;
++test_errors();
}
inline void error_impl(char const * msg, char const * file, int line, char const * function)
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): " << msg << " in function '"
<< function << "'" << std::endl;
++test_errors();
}
inline void throw_failed_impl(char const * excep, char const * file, int line, char const * function)
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): Exception '" << excep << "' not thrown in function '"
<< function << "'" << std::endl;
++test_errors();
}
// In the comparisons below, it is possible that T and U are signed and unsigned integer types, which generates warnings in some compilers.
// A cleaner fix would require common_type trait or some meta-programming, which would introduce a dependency on Boost.TypeTraits. To avoid
// the dependency we just disable the warnings.
#if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable: 4389)
#elif defined(__clang__) && defined(__has_warning)
# if __has_warning("-Wsign-compare")
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wsign-compare"
# endif
#elif defined(__GNUC__) && !(defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 406
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wsign-compare"
#endif
template<class T, class U> inline void test_eq_impl( char const * expr1, char const * expr2,
char const * file, int line, char const * function, T const & t, U const & u )
{
if( t == u )
{
report_errors_remind();
}
else
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): test '" << expr1 << " == " << expr2
<< "' failed in function '" << function << "': "
<< "'" << t << "' != '" << u << "'" << std::endl;
++test_errors();
}
}
template<class T, class U> inline void test_ne_impl( char const * expr1, char const * expr2,
char const * file, int line, char const * function, T const & t, U const & u )
{
if( t != u )
{
report_errors_remind();
}
else
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): test '" << expr1 << " != " << expr2
<< "' failed in function '" << function << "': "
<< "'" << t << "' == '" << u << "'" << std::endl;
++test_errors();
}
}
#if defined(_MSC_VER)
# pragma warning(pop)
#elif defined(__clang__) && defined(__has_warning)
# if __has_warning("-Wsign-compare")
# pragma clang diagnostic pop
# endif
#elif defined(__GNUC__) && !(defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 406
# pragma GCC diagnostic pop
#endif
} // namespace detail
inline int report_errors()
{
boost::detail::report_errors_remind().called_report_errors_function = true;
int errors = boost::detail::test_errors();
if( errors == 0 )
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< "No errors detected." << std::endl;
return 0;
}
else
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< errors << " error" << (errors == 1? "": "s") << " detected." << std::endl;
return 1;
}
}
} // namespace boost
#define BOOST_TEST(expr) ((expr)? (void)0: ::boost::detail::test_failed_impl(#expr, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION))
#define BOOST_TEST_NOT(expr) BOOST_TEST(!(expr))
#define BOOST_ERROR(msg) ( ::boost::detail::error_impl(msg, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) )
#define BOOST_TEST_EQ(expr1,expr2) ( ::boost::detail::test_eq_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
#define BOOST_TEST_NE(expr1,expr2) ( ::boost::detail::test_ne_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
#ifndef BOOST_NO_EXCEPTIONS
#define BOOST_TEST_THROWS( EXPR, EXCEP ) \
try { \
EXPR; \
::boost::detail::throw_failed_impl \
(#EXCEP, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \
} \
catch(EXCEP const&) { \
} \
catch(...) { \
::boost::detail::throw_failed_impl \
(#EXCEP, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \
} \
//
#else
#define BOOST_TEST_THROWS( EXPR, EXCEP )
#endif
#endif // #ifndef BOOST_CORE_LIGHTWEIGHT_TEST_HPP
@@ -0,0 +1,322 @@
// Copyright (C) 2004 The Trustees of Indiana University.
// Copyright (C) 2005-2006 Douglas Gregor <doug.gregor -at- gmail.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)
// Authors: Douglas Gregor
// Andrew Lumsdaine
/** @file operations.hpp
*
* This header provides a mapping from function objects to @c MPI_Op
* constants used in MPI collective operations. It also provides
* several new function object types not present in the standard @c
* <functional> header that have direct mappings to @c MPI_Op.
*/
#ifndef BOOST_MPI_IS_MPI_OP_HPP
#define BOOST_MPI_IS_MPI_OP_HPP
#include <boost/mpi/config.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpi/datatype.hpp>
#include <boost/utility/enable_if.hpp>
#include <functional>
namespace boost { namespace mpi {
template<typename Op, typename T> struct is_mpi_op;
/**
* @brief Determine if a function object type is commutative.
*
* This trait determines if an operation @c Op is commutative when
* applied to values of type @c T. Parallel operations such as @c
* reduce and @c prefix_sum can be implemented more efficiently with
* commutative operations. To mark an operation as commutative, users
* should specialize @c is_commutative and derive from the class @c
* mpl::true_.
*/
template<typename Op, typename T>
struct is_commutative : public mpl::false_ { };
/**************************************************************************
* Function objects for MPI operations not in <functional> header *
**************************************************************************/
/**
* @brief Compute the maximum of two values.
*
* This binary function object computes the maximum of the two values
* it is given. When used with MPI and a type @c T that has an
* associated, built-in MPI data type, translates to @c MPI_MAX.
*/
template<typename T>
struct maximum : public std::binary_function<T, T, T>
{
/** @returns the maximum of x and y. */
const T& operator()(const T& x, const T& y) const
{
return x < y? y : x;
}
};
/**
* @brief Compute the minimum of two values.
*
* This binary function object computes the minimum of the two values
* it is given. When used with MPI and a type @c T that has an
* associated, built-in MPI data type, translates to @c MPI_MIN.
*/
template<typename T>
struct minimum : public std::binary_function<T, T, T>
{
/** @returns the minimum of x and y. */
const T& operator()(const T& x, const T& y) const
{
return x < y? x : y;
}
};
/**
* @brief Compute the bitwise AND of two integral values.
*
* This binary function object computes the bitwise AND of the two
* values it is given. When used with MPI and a type @c T that has an
* associated, built-in MPI data type, translates to @c MPI_BAND.
*/
template<typename T>
struct bitwise_and : public std::binary_function<T, T, T>
{
/** @returns @c x & y. */
T operator()(const T& x, const T& y) const
{
return x & y;
}
};
/**
* @brief Compute the bitwise OR of two integral values.
*
* This binary function object computes the bitwise OR of the two
* values it is given. When used with MPI and a type @c T that has an
* associated, built-in MPI data type, translates to @c MPI_BOR.
*/
template<typename T>
struct bitwise_or : public std::binary_function<T, T, T>
{
/** @returns the @c x | y. */
T operator()(const T& x, const T& y) const
{
return x | y;
}
};
/**
* @brief Compute the logical exclusive OR of two integral values.
*
* This binary function object computes the logical exclusive of the
* two values it is given. When used with MPI and a type @c T that has
* an associated, built-in MPI data type, translates to @c MPI_LXOR.
*/
template<typename T>
struct logical_xor : public std::binary_function<T, T, T>
{
/** @returns the logical exclusive OR of x and y. */
T operator()(const T& x, const T& y) const
{
return (x || y) && !(x && y);
}
};
/**
* @brief Compute the bitwise exclusive OR of two integral values.
*
* This binary function object computes the bitwise exclusive OR of
* the two values it is given. When used with MPI and a type @c T that
* has an associated, built-in MPI data type, translates to @c
* MPI_BXOR.
*/
template<typename T>
struct bitwise_xor : public std::binary_function<T, T, T>
{
/** @returns @c x ^ y. */
T operator()(const T& x, const T& y) const
{
return x ^ y;
}
};
/**************************************************************************
* MPI_Op queries *
**************************************************************************/
/**
* @brief Determine if a function object has an associated @c MPI_Op.
*
* This trait determines if a function object type @c Op, when used
* with argument type @c T, has an associated @c MPI_Op. If so, @c
* is_mpi_op<Op,T> will derive from @c mpl::false_ and will
* contain a static member function @c op that takes no arguments but
* returns the associated @c MPI_Op value. For instance, @c
* is_mpi_op<std::plus<int>,int>::op() returns @c MPI_SUM.
*
* Users may specialize @c is_mpi_op for any other class templates
* that map onto operations that have @c MPI_Op equivalences, such as
* bitwise OR, logical and, or maximum. However, users are encouraged
* to use the standard function objects in the @c functional and @c
* boost/mpi/operations.hpp headers whenever possible. For
* function objects that are class templates with a single template
* parameter, it may be easier to specialize @c is_builtin_mpi_op.
*/
template<typename Op, typename T>
struct is_mpi_op : public mpl::false_ { };
/// INTERNAL ONLY
template<typename T>
struct is_mpi_op<maximum<T>, T>
: public boost::mpl::or_<is_mpi_integer_datatype<T>,
is_mpi_floating_point_datatype<T> >
{
static MPI_Op op() { return MPI_MAX; }
};
/// INTERNAL ONLY
template<typename T>
struct is_mpi_op<minimum<T>, T>
: public boost::mpl::or_<is_mpi_integer_datatype<T>,
is_mpi_floating_point_datatype<T> >
{
static MPI_Op op() { return MPI_MIN; }
};
/// INTERNAL ONLY
template<typename T>
struct is_mpi_op<std::plus<T>, T>
: public boost::mpl::or_<is_mpi_integer_datatype<T>,
is_mpi_floating_point_datatype<T>,
is_mpi_complex_datatype<T> >
{
static MPI_Op op() { return MPI_SUM; }
};
/// INTERNAL ONLY
template<typename T>
struct is_mpi_op<std::multiplies<T>, T>
: public boost::mpl::or_<is_mpi_integer_datatype<T>,
is_mpi_floating_point_datatype<T>,
is_mpi_complex_datatype<T> >
{
static MPI_Op op() { return MPI_PROD; }
};
/// INTERNAL ONLY
template<typename T>
struct is_mpi_op<std::logical_and<T>, T>
: public boost::mpl::or_<is_mpi_integer_datatype<T>,
is_mpi_logical_datatype<T> >
{
static MPI_Op op() { return MPI_LAND; }
};
/// INTERNAL ONLY
template<typename T>
struct is_mpi_op<std::logical_or<T>, T>
: public boost::mpl::or_<is_mpi_integer_datatype<T>,
is_mpi_logical_datatype<T> >
{
static MPI_Op op() { return MPI_LOR; }
};
/// INTERNAL ONLY
template<typename T>
struct is_mpi_op<logical_xor<T>, T>
: public boost::mpl::or_<is_mpi_integer_datatype<T>,
is_mpi_logical_datatype<T> >
{
static MPI_Op op() { return MPI_LXOR; }
};
/// INTERNAL ONLY
template<typename T>
struct is_mpi_op<bitwise_and<T>, T>
: public boost::mpl::or_<is_mpi_integer_datatype<T>,
is_mpi_byte_datatype<T> >
{
static MPI_Op op() { return MPI_BAND; }
};
/// INTERNAL ONLY
template<typename T>
struct is_mpi_op<bitwise_or<T>, T>
: public boost::mpl::or_<is_mpi_integer_datatype<T>,
is_mpi_byte_datatype<T> >
{
static MPI_Op op() { return MPI_BOR; }
};
/// INTERNAL ONLY
template<typename T>
struct is_mpi_op<bitwise_xor<T>, T>
: public boost::mpl::or_<is_mpi_integer_datatype<T>,
is_mpi_byte_datatype<T> >
{
static MPI_Op op() { return MPI_BXOR; }
};
namespace detail {
// A helper class used to create user-defined MPI_Ops
template<typename Op, typename T>
class user_op
{
public:
explicit user_op(Op& op)
{
BOOST_MPI_CHECK_RESULT(MPI_Op_create,
(&user_op<Op, T>::perform,
is_commutative<Op, T>::value,
&mpi_op));
op_ptr = &op;
}
~user_op()
{
if (std::uncaught_exception()) {
// Ignore failure cases: there are obviously other problems
// already, and we don't want to cause program termination if
// MPI_Op_free fails.
MPI_Op_free(&mpi_op);
} else {
BOOST_MPI_CHECK_RESULT(MPI_Op_free, (&mpi_op));
}
}
MPI_Op& get_mpi_op()
{
return mpi_op;
}
private:
MPI_Op mpi_op;
static Op* op_ptr;
static void BOOST_MPI_CALLING_CONVENTION perform(void* vinvec, void* voutvec, int* plen, MPI_Datatype*)
{
T* invec = static_cast<T*>(vinvec);
T* outvec = static_cast<T*>(voutvec);
std::transform(invec, invec + *plen, outvec, outvec, *op_ptr);
}
};
template<typename Op, typename T> Op* user_op<Op, T>::op_ptr = 0;
} // end namespace detail
} } // end namespace boost::mpi
#endif // BOOST_MPI_GET_MPI_OP_HPP
@@ -0,0 +1,54 @@
#ifndef LIVE_FREQUENCY_VALIDATOR_HPP__
#define LIVE_FREQUENCY_VALIDATOR_HPP__
#include <QObject>
#include <QRegExpValidator>
#include "Radio.hpp"
class Bands;
class FrequencyList_v2;
class QComboBox;
class QWidget;
//
// Class LiveFrequencyValidator
//
// QLineEdit validator that controls input to an editable
// QComboBox where the user can enter a valid band or a valid
// frequency in megahetz.
//
// Collabrations
//
// Implements the QRegExpValidator interface. Validates input
// from the supplied QComboBox as either a valid frequency in
// megahertz or a valid band as defined by the supplied column of
// the supplied QAbstractItemModel.
//
class LiveFrequencyValidator final
: public QRegExpValidator
{
Q_OBJECT;
public:
using Frequency = Radio::Frequency;
LiveFrequencyValidator (QComboBox * combo_box // associated combo box
, Bands const * bands // bands model
, FrequencyList_v2 const * frequencies // working frequencies model
, Frequency const * nominal_frequency
, QWidget * parent = nullptr);
State validate (QString& input, int& pos) const override;
void fixup (QString& input) const override;
Q_SIGNAL void valid (Frequency) const;
private:
Bands const * bands_;
FrequencyList_v2 const * frequencies_;
Frequency const * nominal_frequency_;
QComboBox * combo_box_;
};
#endif
@@ -0,0 +1,122 @@
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2005-2016.
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/interprocess for documentation.
//
//////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_INTERPROCESS_DETAIL_MPL_HPP
#define BOOST_INTERPROCESS_DETAIL_MPL_HPP
#ifndef BOOST_CONFIG_HPP
# include <boost/config.hpp>
#endif
#
#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
#include <cstddef>
namespace boost {
namespace interprocess {
namespace ipcdetail {
template <class T, T val>
struct integral_constant
{
static const T value = val;
typedef integral_constant<T,val> type;
};
template< bool C_ >
struct bool_ : integral_constant<bool, C_>
{
static const bool value = C_;
};
typedef bool_<true> true_;
typedef bool_<false> false_;
typedef true_ true_type;
typedef false_ false_type;
typedef char yes_type;
struct no_type
{
char padding[8];
};
template <bool B, class T = void>
struct enable_if_c {
typedef T type;
};
template <class T>
struct enable_if_c<false, T> {};
template <class Cond, class T = void>
struct enable_if : public enable_if_c<Cond::value, T> {};
template <class Cond, class T = void>
struct disable_if : public enable_if_c<!Cond::value, T> {};
template<
bool C
, typename T1
, typename T2
>
struct if_c
{
typedef T1 type;
};
template<
typename T1
, typename T2
>
struct if_c<false,T1,T2>
{
typedef T2 type;
};
template<
typename T1
, typename T2
, typename T3
>
struct if_
{
typedef typename if_c<0 != T1::value, T2, T3>::type type;
};
template<std::size_t S>
struct ls_zeros
{
static const std::size_t value = (S & std::size_t(1)) ? 0 : (1u + ls_zeros<(S >> 1u)>::value);
};
template<>
struct ls_zeros<0>
{
static const std::size_t value = 0;
};
template<>
struct ls_zeros<1>
{
static const std::size_t value = 0;
};
} //namespace ipcdetail {
} //namespace interprocess {
} //namespace boost {
#endif //#ifndef BOOST_INTERPROCESS_DETAIL_MPL_HPP
@@ -0,0 +1,87 @@
#ifndef BOOST_ARCHIVE_DETAIL_INTERFACE_OARCHIVE_HPP
#define BOOST_ARCHIVE_DETAIL_INTERFACE_OARCHIVE_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER)
# pragma once
#endif
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// interface_oarchive.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 <cstddef> // NULL
#include <boost/cstdint.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/archive/detail/auto_link_archive.hpp>
#include <boost/archive/detail/oserializer.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
#include <boost/serialization/singleton.hpp>
namespace boost {
namespace archive {
namespace detail {
class basic_pointer_oserializer;
template<class Archive>
class interface_oarchive
{
protected:
interface_oarchive(){};
public:
/////////////////////////////////////////////////////////
// archive public interface
typedef mpl::bool_<false> is_loading;
typedef mpl::bool_<true> is_saving;
// return a pointer to the most derived class
Archive * This(){
return static_cast<Archive *>(this);
}
template<class T>
const basic_pointer_oserializer *
register_type(const T * = NULL){
const basic_pointer_oserializer & bpos =
boost::serialization::singleton<
pointer_oserializer<Archive, T>
>::get_const_instance();
this->This()->register_basic_serializer(bpos.get_basic_serializer());
return & bpos;
}
template<class Helper>
Helper &
get_helper(void * const id = 0){
helper_collection & hc = this->This()->get_helper_collection();
return hc.template find_helper<Helper>(id);
}
template<class T>
Archive & operator<<(const T & t){
this->This()->save_override(t);
return * this->This();
}
// the & operator
template<class T>
Archive & operator&(const T & t){
return * this ->This() << t;
}
};
} // namespace detail
} // namespace archive
} // namespace boost
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
#endif // BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP
@@ -0,0 +1,85 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// text_woarchive_impl.ipp:
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.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://www.boost.org for updates, documentation, and revision history.
#include <boost/config.hpp>
#ifndef BOOST_NO_STD_WSTREAMBUF
#include <cstring>
#include <cstddef> // size_t
#if defined(BOOST_NO_STDC_NAMESPACE) && ! defined(__LIBCOMO__)
namespace std{
using ::strlen;
using ::size_t;
} // namespace std
#endif
#include <ostream>
#include <boost/archive/text_woarchive.hpp>
namespace boost {
namespace archive {
//////////////////////////////////////////////////////////////////////
// implementation of woarchive functions
//
template<class Archive>
BOOST_WARCHIVE_DECL void
text_woarchive_impl<Archive>::save(const char *s)
{
// note: superfluous local variable fixes borland warning
const std::size_t size = std::strlen(s);
* this->This() << size;
this->This()->newtoken();
while(*s != '\0')
os.put(os.widen(*s++));
}
template<class Archive>
BOOST_WARCHIVE_DECL void
text_woarchive_impl<Archive>::save(const std::string &s)
{
const std::size_t size = s.size();
* this->This() << size;
this->This()->newtoken();
const char * cptr = s.data();
for(std::size_t i = size; i-- > 0;)
os.put(os.widen(*cptr++));
}
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
template<class Archive>
BOOST_WARCHIVE_DECL void
text_woarchive_impl<Archive>::save(const wchar_t *ws)
{
const std::size_t size = std::wostream::traits_type::length(ws);
* this->This() << size;
this->This()->newtoken();
os.write(ws, size);
}
#endif
#ifndef BOOST_NO_STD_WSTRING
template<class Archive>
BOOST_WARCHIVE_DECL void
text_woarchive_impl<Archive>::save(const std::wstring &ws)
{
const std::size_t size = ws.length();
* this->This() << size;
this->This()->newtoken();
os.write(ws.data(), size);
}
#endif
} // namespace archive
} // namespace boost
#endif
@@ -0,0 +1,108 @@
//---------------------------------------------------------------------------//
// Copyright (c) 2015 Jakub Szuppe <j.szuppe@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_DETAIL_SERIAL_REDUCE_BY_KEY_HPP
#define BOOST_COMPUTE_ALGORITHM_DETAIL_SERIAL_REDUCE_BY_KEY_HPP
#include <iterator>
#include <boost/compute/command_queue.hpp>
#include <boost/compute/functional.hpp>
#include <boost/compute/container/vector.hpp>
#include <boost/compute/container/detail/scalar.hpp>
#include <boost/compute/detail/meta_kernel.hpp>
#include <boost/compute/detail/iterator_range_size.hpp>
#include <boost/compute/type_traits/result_of.hpp>
namespace boost {
namespace compute {
namespace detail {
template<class InputKeyIterator, class InputValueIterator,
class OutputKeyIterator, class OutputValueIterator,
class BinaryFunction, class BinaryPredicate>
inline size_t serial_reduce_by_key(InputKeyIterator keys_first,
InputKeyIterator keys_last,
InputValueIterator values_first,
OutputKeyIterator keys_result,
OutputValueIterator values_result,
BinaryFunction function,
BinaryPredicate predicate,
command_queue &queue)
{
typedef typename
std::iterator_traits<InputValueIterator>::value_type value_type;
typedef typename
std::iterator_traits<InputKeyIterator>::value_type key_type;
typedef typename
::boost::compute::result_of<BinaryFunction(value_type, value_type)>::type result_type;
const context &context = queue.get_context();
size_t count = detail::iterator_range_size(keys_first, keys_last);
if(count < 1){
return count;
}
meta_kernel k("serial_reduce_by_key");
size_t count_arg = k.add_arg<uint_>("count");
size_t result_size_arg = k.add_arg<uint_ *>(memory_object::global_memory,
"result_size");
convert<result_type> to_result_type;
k <<
k.decl<result_type>("result") <<
" = " << to_result_type(values_first[0]) << ";\n" <<
k.decl<key_type>("previous_key") << " = " << keys_first[0] << ";\n" <<
k.decl<result_type>("value") << ";\n" <<
k.decl<key_type>("key") << ";\n" <<
k.decl<uint_>("size") << " = 1;\n" <<
keys_result[0] << " = previous_key;\n" <<
values_result[0] << " = result;\n" <<
"for(ulong i = 1; i < count; i++) {\n" <<
" value = " << to_result_type(values_first[k.var<uint_>("i")]) << ";\n" <<
" key = " << keys_first[k.var<uint_>("i")] << ";\n" <<
" if (" << predicate(k.var<key_type>("previous_key"),
k.var<key_type>("key")) << ") {\n" <<
" result = " << function(k.var<result_type>("result"),
k.var<result_type>("value")) << ";\n" <<
" }\n " <<
" else { \n" <<
keys_result[k.var<uint_>("size - 1")] << " = previous_key;\n" <<
values_result[k.var<uint_>("size - 1")] << " = result;\n" <<
" result = value;\n" <<
" size++;\n" <<
" } \n" <<
" previous_key = key;\n" <<
"}\n" <<
keys_result[k.var<uint_>("size - 1")] << " = previous_key;\n" <<
values_result[k.var<uint_>("size - 1")] << " = result;\n" <<
"*result_size = size;";
kernel kernel = k.compile(context);
scalar<uint_> result_size(context);
kernel.set_arg(result_size_arg, result_size.get_buffer());
kernel.set_arg(count_arg, static_cast<uint_>(count));
queue.enqueue_task(kernel);
return static_cast<size_t>(result_size.read(queue));
}
} // end detail namespace
} // end compute namespace
} // end boost namespace
#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_SERIAL_REDUCE_BY_KEY_HPP
@@ -0,0 +1,89 @@
<HTML><HEAD>
<TITLE> Modules Used in LDPC Programs </TITLE>
</HEAD><BODY>
<H1> Modules Used in LDPC Programs </H1>
You may need to familiarize yourself with the modules documented here
in order to <A HREF="modify.html">modify the LDPC programs</A>.
These modules may also be useful for other purposes.
<P>Click on the title of a module below for general information, or on
specific routines for detailed documentation.
<P><A HREF="mod2dense.html">Dense modulo-2 matrix routines</A>:
<BLOCKQUOTE><PRE>
<A HREF="mod2dense.html#dimension-sec"><I>Dimension macros:</I> mod2dense_rows mod2dense_cols</A>
<I><A HREF="mod2dense.html#alloc-sec">Allocation:</A> <A HREF="mod2dense.html#copy-clear-sec">Copy/Clear:</A> <A HREF="mod2dense.html#input-output-sec">Input/Output:</A> <A HREF="mod2dense.html#elementary-sec">Elementary ops:</A></I>
<A HREF="mod2dense.html#allocate">mod2dense_allocate</A> <A HREF="mod2dense.html#clear">mod2dense_clear</A> <A HREF="mod2dense.html#print">mod2dense_print</A> <A HREF="mod2dense.html#get">mod2dense_get</A>
<A HREF="mod2dense.html#free">mod2dense_free</A> <A HREF="mod2dense.html#copy">mod2dense_copy</A> <A HREF="mod2dense.html#write">mod2dense_write</A> <A HREF="mod2dense.html#set">mod2dense_set</A>
<A HREF="mod2dense.html#copyrows">mod2dense_copyrows</A> <A HREF="mod2dense.html#read">mod2dense_read</A> <A HREF="mod2dense.html#flip">mod2dense_flip</A>
<A HREF="mod2dense.html#copycols">mod2dense_copycols</A>
<I><A HREF="mod2dense.html#arith-sec">Matrix arithmetic:</A> <A HREF="mod2dense.html#invert-sec">Matrix inversion:</A></I>
<A HREF="mod2dense.html#transpose">mod2dense_transpose</A> <A HREF="mod2dense.html#invert">mod2dense_invert</A>
<A HREF="mod2dense.html#add">mod2dense_add</A> <A HREF="mod2dense.html#forcibly_invert">mod2dense_forcibly_invert</A>
<A HREF="mod2dense.html#multiply">mod2dense_multiply</A> <A HREF="mod2dense.html#invert_selected">mod2dense_invert_selected</A>
<A HREF="mod2dense.html#equal">mod2dense_equal</A>
</PRE></BLOCKQUOTE>
<P><A HREF="mod2sparse.html">Sparse modulo-2 matrix routines</A>:
<BLOCKQUOTE><PRE>
<A HREF="mod2sparse.html#dimension-sec"><I>Dimension macros:</I> mod2sparse_rows mod2sparse_cols</A>
<A HREF="mod2sparse.html#traversal-sec"><I>Traversal macros:</I> mod2sparse_first_in_row mod2sparse_next_in_row ...</A>
<I><A HREF="mod2sparse.html#alloc-sec">Allocation:</A> <A HREF="mod2sparse.html#copy-clear-sec">Copy/Clear:</A> <A HREF="mod2sparse.html#input-output-sec">Input/Output:</A> <A HREF="mod2sparse.html#elementary-sec">Elementary ops:</A></I>
<A HREF="mod2sparse.html#allocate">mod2sparse_allocate</A> <A HREF="mod2sparse.html#clear">mod2sparse_clear</A> <A HREF="mod2sparse.html#print">mod2sparse_print</A> <A HREF="mod2sparse.html#find">mod2sparse_find</A>
<A HREF="mod2sparse.html#free">mod2sparse_free</A> <A HREF="mod2sparse.html#copy">mod2sparse_copy</A> <A HREF="mod2sparse.html#write">mod2sparse_write</A> <A HREF="mod2sparse.html#insert">mod2sparse_insert</A>
<A HREF="mod2sparse.html#copyrows">mod2sparse_copyrows</A> <A HREF="mod2sparse.html#read">mod2sparse_read</A> <A HREF="mod2sparse.html#delete">mod2sparse_delete</A>
<A HREF="mod2sparse.html#copycols">mod2sparse_copycols</A>
<I><A HREF="mod2sparse.html#arith-sec">Matrix arithmetic:</A> <A HREF="mod2sparse.html#row-col-ops-sec">Row/Column ops:</A> <A HREF="mod2sparse.html#lu-decomp-sec">LU decomposition:</A></I>
<A HREF="mod2sparse.html#transpose">mod2sparse_transpose</A> <A HREF="mod2sparse.html#count_row">mod2sparse_count_row</A> <A HREF="mod2sparse.html#decomp">mod2sparse_decomp</A>
<A HREF="mod2sparse.html#add">mod2sparse_add</A> <A HREF="mod2sparse.html#count_col">mod2sparse_count_col</A> <A HREF="mod2sparse.html#forward_sub">mod2sparse_forward_sub</A>
<A HREF="mod2sparse.html#multiply">mod2sparse_multiply</A> <A HREF="mod2sparse.html#add_row">mod2sparse_add_row</A> <A HREF="mod2sparse.html#backward_sub">mod2sparse_backward_sub</A>
<A HREF="mod2sparse.html#mulvec">mod2sparse_mulvec</A> <A HREF="mod2sparse.html#add_col">mod2sparse_add_col</A>
<A HREF="mod2sparse.html#equal">mod2sparse_equal</A>
</PRE>
<A HREF="sparse-LU.html">Discussion of sparse LU decomposition methods.</A>
</BLOCKQUOTE>
<P><A HREF="mod2convert.html">Modulo-2 matrix sparse/dense conversion</A>:
<BLOCKQUOTE><PRE>
<A HREF="mod2convert.html#sparse_to_dense">mod2sparse_to_dense</A>
<A HREF="mod2convert.html#dense_to_sparse">mod2dense_to_sparse</A>
</PRE></BLOCKQUOTE>
<P><A HREF="rand.html">Random variate generation routines</A>:
<BLOCKQUOTE><PRE>
<I><A HREF="rand.html#get-set-sec">Set/Get state:<A> <A HREF="rand.html#uniform-sec">Uniform:</A> <A HREF="rand.html#discrete-sec">Discrete:</A> <A HREF="rand.html#continuous-sec">Continuous:</A></I>
<A HREF="rand.html#seed">rand_seed</A> <A HREF="rand.html#uniform">rand_uniform</A> <A HREF="rand.html#int">rand_int</A> <A HREF="rand.html#gaussian">rand_gaussian</A>
<A HREF="rand.html#get_state">rand_get_state</A> <A HREF="rand.html#uniopen">rand_uniopen</A> <A HREF="rand.html#pickd">rand_pickd</A> <A HREF="rand.html#logistic">rand_logistic</A>
<A HREF="rand.html#use_state">rand_use_state</A> <A HREF="rand.html#pickf">rand_pickf</A> <A HREF="rand.html#cauchy">rand_cauchy</A>
<A HREF="rand.html#poisson">rand_poisson</A> <A HREF="rand.html#gamma">rand_gamma</A>
<A HREF="rand.html#permutation">rand_permutation</A> <A HREF="rand.html#exp">rand_exp</A>
<A HREF="rand.html#beta">rand_beta</A>
</PRE></BLOCKQUOTE>
<P>Each of the modules above has a test program, called
<TT><I>module</I>-test</TT>. These programs are compiled by the command
<BLOCKQUOTE><PRE>
make tests
</PRE></BLOCKQUOTE>
See the source files for these test programs for further information.
<HR>
<A HREF="index.html">Back to index for LDPC software</A>
</BODY></HTML>
@@ -0,0 +1,262 @@
#ifndef CONFIGURATION_HPP_
#define CONFIGURATION_HPP_
#include <QObject>
#include <QFont>
#include "Radio.hpp"
#include "IARURegions.hpp"
#include "AudioDevice.hpp"
#include "Transceiver.hpp"
#include "pimpl_h.hpp"
class QSettings;
class QWidget;
class QAudioDeviceInfo;
class QString;
class QDir;
class Bands;
class FrequencyList;
class StationList;
class QStringListModel;
class QHostAddress;
//
// Class Configuration
//
// Encapsulates the control, access and, persistence of user defined
// settings for the wsjtx GUI. Setting values are accessed through a
// QDialog window containing concept orientated tab windows.
//
// Responsibilities
//
// Provides management of the CAT and PTT rig interfaces, providing
// control access via a minimal generic set of Qt slots and status
// updates via Qt signals. Internally the rig control capability is
// farmed out to a separate thread since many of the rig control
// functions are blocking.
//
// All user settings required by the wsjtx GUI are exposed through
// query methods. Settings only become visible once they have been
// accepted by the user which is done by clicking the "OK" button on
// the settings dialog.
//
// The QSettings instance passed to the constructor is used to read
// and write user settings.
//
// Pointers to three QAbstractItemModel objects are provided to give
// access to amateur band information, user working frequencies and,
// user operating band information. These porovide consistent data
// models that can be used in GUI lists or tables or simply queried
// for user defined bands, default operating frequencies and, station
// descriptions.
//
class Configuration final
: public QObject
{
Q_OBJECT
Q_ENUMS (DataMode Type2MsgGen)
public:
using MODE = Transceiver::MODE;
using TransceiverState = Transceiver::TransceiverState;
using Frequency = Radio::Frequency;
using port_type = quint16;
enum DataMode {data_mode_none, data_mode_USB, data_mode_data};
Q_ENUM (DataMode)
enum Type2MsgGen {type_2_msg_1_full, type_2_msg_3_full, type_2_msg_5_only};
Q_ENUM (Type2MsgGen)
explicit Configuration (QDir const& temp_directory, QSettings * settings,
QWidget * parent = nullptr);
~Configuration ();
void select_tab (int);
int exec ();
bool is_active () const;
QDir temp_dir () const;
QDir doc_dir () const;
QDir data_dir () const;
QDir writeable_data_dir () const;
QAudioDeviceInfo const& audio_input_device () const;
AudioDevice::Channel audio_input_channel () const;
QAudioDeviceInfo const& audio_output_device () const;
AudioDevice::Channel audio_output_channel () const;
// These query methods should be used after a call to exec() to
// determine if either the audio input or audio output stream
// parameters have changed. The respective streams should be
// re-opened if they return true.
bool restart_audio_input () const;
bool restart_audio_output () const;
QString my_callsign () const;
QString my_grid () const;
QFont decoded_text_font () const;
qint32 id_interval () const;
qint32 ntrials() const;
qint32 aggressive() const;
qint32 RxBandwidth() const;
double degrade() const;
double txDelay() const;
bool id_after_73 () const;
bool tx_QSY_allowed () const;
bool spot_to_psk_reporter () const;
bool monitor_off_at_startup () const;
bool monitor_last_used () const;
bool log_as_RTTY () const;
bool report_in_comments () const;
bool prompt_to_log () const;
bool insert_blank () const;
bool DXCC () const;
bool clear_DX () const;
bool miles () const;
bool quick_call () const;
bool disable_TX_on_73 () const;
int watchdog () const;
bool TX_messages () const;
bool split_mode () const;
bool enable_VHF_features () const;
bool decode_at_52s () const;
bool single_decode () const;
bool twoPass() const;
bool x2ToneSpacing() const;
bool contestMode() const;
bool realTimeDecode() const;
bool MyDx() const;
bool CQMyN() const;
bool NDxG() const;
bool NN() const;
bool EMEonly() const;
bool post_decodes () const;
QString udp_server_name () const;
port_type udp_server_port () const;
bool accept_udp_requests () const;
bool udpWindowToFront () const;
bool udpWindowRestore () const;
Bands * bands ();
Bands const * bands () const;
IARURegions::Region region () const;
FrequencyList * frequencies ();
FrequencyList const * frequencies () const;
StationList * stations ();
StationList const * stations () const;
QStringListModel * macros ();
QStringListModel const * macros () const;
QDir save_directory () const;
QDir azel_directory () const;
QString rig_name () const;
Type2MsgGen type_2_msg_gen () const;
QColor color_CQ () const;
QColor color_MyCall () const;
QColor color_TxMsg () const;
QColor color_DXCC () const;
QColor color_NewCall () const;
bool pwrBandTxMemory () const;
bool pwrBandTuneMemory () const;
// This method queries if a CAT and PTT connection is operational.
bool is_transceiver_online () const;
// Start the rig connection, safe and normal to call when rig is
// already open.
bool transceiver_online ();
// check if a real rig is configured
bool is_dummy_rig () const;
// Frequency resolution of the rig
//
// 0 - 1Hz
// 1 - 10Hz rounded
// -1 - 10Hz truncated
// 2 - 100Hz rounded
// -2 - 100Hz truncated
int transceiver_resolution () const;
// Close down connection to rig.
void transceiver_offline ();
// Set transceiver frequency in Hertz.
Q_SLOT void transceiver_frequency (Frequency);
// Setting a non zero TX frequency means split operation
// rationalise_mode means ensure TX uses same mode as RX.
Q_SLOT void transceiver_tx_frequency (Frequency = 0u);
// Set transceiver mode.
//
// Rationalise means ensure TX uses same mode as RX.
Q_SLOT void transceiver_mode (MODE);
// Set/unset PTT.
//
// Note that this must be called even if VOX PTT is selected since
// the "Emulate Split" mode requires PTT information to coordinate
// frequency changes.
Q_SLOT void transceiver_ptt (bool = true);
// Attempt to (re-)synchronise transceiver state.
//
// Force signal guarantees either a transceiver_update or a
// transceiver_failure signal.
//
// The enforce_mode_and_split parameter ensures that future
// transceiver updates have the correct mode and split setting
// i.e. the transceiver is ready for use.
Q_SLOT void sync_transceiver (bool force_signal = false, bool enforce_mode_and_split = false);
//
// This signal indicates that a font has been selected and accepted
// for the decoded text.
//
Q_SIGNAL void decoded_text_font_changed (QFont);
//
// This signal is emitted when the UDP server changes
//
Q_SIGNAL void udp_server_changed (QString const& udp_server);
Q_SIGNAL void udp_server_port_changed (port_type server_port);
//
// These signals are emitted and reflect transceiver state changes
//
// signals a change in one of the TransceiverState members
Q_SIGNAL void transceiver_update (Transceiver::TransceiverState const&) const;
// Signals a failure of a control rig CAT or PTT connection.
//
// A failed rig CAT or PTT connection is fatal and the underlying
// connections are closed automatically. The connections can be
// re-established with a call to transceiver_online(true) assuming
// the fault condition has been rectified or is transient.
Q_SIGNAL void transceiver_failure (QString const& reason) const;
private:
class impl;
pimpl<impl> m_;
};
#if QT_VERSION < 0x050500
Q_DECLARE_METATYPE (Configuration::DataMode);
Q_DECLARE_METATYPE (Configuration::Type2MsgGen);
#endif
#if !defined (QT_NO_DEBUG_STREAM)
ENUM_QDEBUG_OPS_DECL (Configuration, DataMode);
ENUM_QDEBUG_OPS_DECL (Configuration, Type2MsgGen);
#endif
ENUM_QDATASTREAM_OPS_DECL (Configuration, DataMode);
ENUM_QDATASTREAM_OPS_DECL (Configuration, Type2MsgGen);
ENUM_CONVERSION_OPS_DECL (Configuration, DataMode);
ENUM_CONVERSION_OPS_DECL (Configuration, Type2MsgGen);
#endif
@@ -0,0 +1,111 @@
// 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/modulus.hpp" header
// -- DO NOT modify by hand!
namespace boost { namespace mpl {
template<
typename Tag1
, typename Tag2
>
struct modulus_impl
: if_c<
( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1)
> BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2)
)
, aux::cast2nd_impl< modulus_impl< Tag1,Tag1 >,Tag1, Tag2 >
, aux::cast1st_impl< modulus_impl< Tag2,Tag2 >,Tag1, Tag2 >
>::type
{
};
/// for Digital Mars C++/compilers with no CTPS/TTP support
template<> struct modulus_impl< na,na >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template< typename Tag > struct modulus_impl< na,Tag >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template< typename Tag > struct modulus_impl< Tag,na >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template< typename T > struct modulus_tag
{
typedef typename T::tag type;
};
template<
typename BOOST_MPL_AUX_NA_PARAM(N1)
, typename BOOST_MPL_AUX_NA_PARAM(N2)
>
struct modulus
: modulus_impl<
typename modulus_tag<N1>::type
, typename modulus_tag<N2>::type
>::template apply< N1,N2 >::type
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(2, modulus, (N1, N2))
};
BOOST_MPL_AUX_NA_SPEC2(2, 2, modulus)
}}
namespace boost { namespace mpl {
namespace aux {
template< typename T, T n1, T n2 >
struct modulus_wknd
{
BOOST_STATIC_CONSTANT(T, value = (n1 % n2));
typedef integral_c< T,value > type;
};
}
template<>
struct modulus_impl< integral_c_tag,integral_c_tag >
{
template< typename N1, typename N2 > struct apply
: aux::modulus_wknd<
typename aux::largest_int<
typename N1::value_type
, typename N2::value_type
>::type
, N1::value
, N2::value
>::type
{
};
};
}}
@@ -0,0 +1,21 @@
#ifndef BOOST_MPL_GREATER_EQUAL_HPP_INCLUDED
#define BOOST_MPL_GREATER_EQUAL_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$
#define AUX778076_OP_NAME greater_equal
#define AUX778076_OP_TOKEN >=
#include <boost/mpl/aux_/comparison_op.hpp>
#endif // BOOST_MPL_GREATER_EQUAL_HPP_INCLUDED
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,48 @@
///////////////////////////////////////////////////////////////////////////////
// Copyright Vicente J. Botet Escriba 2009-2011
// Copyright 2012 John Maddock. 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_MP_RESTRICTED_CONVERSION_HPP
#define BOOST_MP_RESTRICTED_CONVERSION_HPP
#include <boost/multiprecision/traits/explicit_conversion.hpp>
#include <boost/mpl/if.hpp>
#include <boost/multiprecision/detail/number_base.hpp>
namespace boost{ namespace multiprecision{ namespace detail{
template <class From, class To>
struct is_lossy_conversion
{
typedef typename mpl::if_c<
((number_category<From>::value == number_kind_floating_point) && (number_category<To>::value == number_kind_integer))
/* || ((number_category<From>::value == number_kind_floating_point) && (number_category<To>::value == number_kind_rational))*/
|| ((number_category<From>::value == number_kind_rational) && (number_category<To>::value == number_kind_integer))
|| ((number_category<From>::value == number_kind_fixed_point) && (number_category<To>::value == number_kind_integer))
|| (number_category<From>::value == number_kind_unknown)
|| (number_category<To>::value == number_kind_unknown),
mpl::true_,
mpl::false_
>::type type;
static const bool value = type::value;
};
template<typename From, typename To>
struct is_restricted_conversion
{
typedef typename mpl::if_c<
((is_explicitly_convertible<From, To>::value && !is_convertible<From, To>::value)
|| is_lossy_conversion<From, To>::value),
mpl::true_,
mpl::false_
>::type type;
static const bool value = type::value;
};
}}} // namespaces
#endif // BOOST_MP_RESTRICTED_CONVERSION_HPP
@@ -0,0 +1,13 @@
// Copyright David Abrahams 2005.
// 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 IS_XXX_DWA2003224_HPP
# define IS_XXX_DWA2003224_HPP
# include <boost/detail/is_xxx.hpp>
# define BOOST_PYTHON_IS_XXX_DEF(name, qualified_name, nargs) \
BOOST_DETAIL_IS_XXX_DEF(name, qualified_name, nargs)
#endif // IS_XXX_DWA2003224_HPP
@@ -0,0 +1,136 @@
// Copyright David Abrahams 2002.
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef OBJECT_OPERATORS_DWA2002617_HPP
# define OBJECT_OPERATORS_DWA2002617_HPP
# include <boost/python/detail/prefix.hpp>
# include <boost/python/object_core.hpp>
# include <boost/python/call.hpp>
# include <boost/iterator/detail/enable_if.hpp>
# include <boost/mpl/bool.hpp>
# include <boost/iterator/detail/config_def.hpp>
namespace boost { namespace python { namespace api {
template <class X>
char is_object_operators_helper(object_operators<X> const*);
typedef char (&no_type)[2];
no_type is_object_operators_helper(...);
template <class X> X* make_ptr();
template <class L, class R = L>
struct is_object_operators
{
enum {
value
= (sizeof(api::is_object_operators_helper(api::make_ptr<L>()))
+ sizeof(api::is_object_operators_helper(api::make_ptr<R>()))
< 4
)
};
typedef mpl::bool_<value> type;
};
# if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_IS_CONVERTIBLE)
template <class L, class R, class T>
struct enable_binary
: boost::iterators::enable_if<is_object_operators<L,R>, T>
{};
# define BOOST_PYTHON_BINARY_RETURN(T) typename enable_binary<L,R,T>::type
# else
# define BOOST_PYTHON_BINARY_RETURN(T) T
# endif
template <class U>
object object_operators<U>::operator()() const
{
object_cref2 f = *static_cast<U const*>(this);
return call<object>(f.ptr());
}
template <class U>
inline
object_operators<U>::operator bool_type() const
{
object_cref2 x = *static_cast<U const*>(this);
int is_true = PyObject_IsTrue(x.ptr());
if (is_true < 0) throw_error_already_set();
return is_true ? &object::ptr : 0;
}
template <class U>
inline bool
object_operators<U>::operator!() const
{
object_cref2 x = *static_cast<U const*>(this);
int is_true = PyObject_IsTrue(x.ptr());
if (is_true < 0) throw_error_already_set();
return !is_true;
}
# define BOOST_PYTHON_COMPARE_OP(op, opid) \
template <class L, class R> \
BOOST_PYTHON_BINARY_RETURN(object) operator op(L const& l, R const& r) \
{ \
return PyObject_RichCompare( \
object(l).ptr(), object(r).ptr(), opid); \
}
# undef BOOST_PYTHON_COMPARE_OP
# define BOOST_PYTHON_BINARY_OPERATOR(op) \
BOOST_PYTHON_DECL object operator op(object const& l, object const& r); \
template <class L, class R> \
BOOST_PYTHON_BINARY_RETURN(object) operator op(L const& l, R const& r) \
{ \
return object(l) op object(r); \
}
BOOST_PYTHON_BINARY_OPERATOR(>)
BOOST_PYTHON_BINARY_OPERATOR(>=)
BOOST_PYTHON_BINARY_OPERATOR(<)
BOOST_PYTHON_BINARY_OPERATOR(<=)
BOOST_PYTHON_BINARY_OPERATOR(==)
BOOST_PYTHON_BINARY_OPERATOR(!=)
BOOST_PYTHON_BINARY_OPERATOR(+)
BOOST_PYTHON_BINARY_OPERATOR(-)
BOOST_PYTHON_BINARY_OPERATOR(*)
BOOST_PYTHON_BINARY_OPERATOR(/)
BOOST_PYTHON_BINARY_OPERATOR(%)
BOOST_PYTHON_BINARY_OPERATOR(<<)
BOOST_PYTHON_BINARY_OPERATOR(>>)
BOOST_PYTHON_BINARY_OPERATOR(&)
BOOST_PYTHON_BINARY_OPERATOR(^)
BOOST_PYTHON_BINARY_OPERATOR(|)
# undef BOOST_PYTHON_BINARY_OPERATOR
# define BOOST_PYTHON_INPLACE_OPERATOR(op) \
BOOST_PYTHON_DECL object& operator op(object& l, object const& r); \
template <class R> \
object& operator op(object& l, R const& r) \
{ \
return l op object(r); \
}
BOOST_PYTHON_INPLACE_OPERATOR(+=)
BOOST_PYTHON_INPLACE_OPERATOR(-=)
BOOST_PYTHON_INPLACE_OPERATOR(*=)
BOOST_PYTHON_INPLACE_OPERATOR(/=)
BOOST_PYTHON_INPLACE_OPERATOR(%=)
BOOST_PYTHON_INPLACE_OPERATOR(<<=)
BOOST_PYTHON_INPLACE_OPERATOR(>>=)
BOOST_PYTHON_INPLACE_OPERATOR(&=)
BOOST_PYTHON_INPLACE_OPERATOR(^=)
BOOST_PYTHON_INPLACE_OPERATOR(|=)
# undef BOOST_PYTHON_INPLACE_OPERATOR
}}} // namespace boost::python
#include <boost/iterator/detail/config_undef.hpp>
#endif // OBJECT_OPERATORS_DWA2002617_HPP
@@ -0,0 +1,42 @@
// Copyright (C) 2014 Vicente J. Botet Escriba
//
// 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)
//
// 2014/10 Vicente J. Botet Escriba
// Creation.
#ifndef BOOST_CSBL_MEMORY_SHARED_PTR_HPP
#define BOOST_CSBL_MEMORY_SHARED_PTR_HPP
#include <boost/thread/csbl/memory/config.hpp>
#if defined BOOST_NO_CXX11_SMART_PTR
#include <boost/smart_ptr/shared_ptr.hpp>
#include <boost/smart_ptr/make_shared.hpp>
namespace boost
{
namespace csbl
{
using ::boost::shared_ptr;
using ::boost::make_shared;
}
}
#else
#include <boost/shared_ptr.hpp>
namespace boost
{
namespace csbl
{
using std::shared_ptr;
using std::make_shared;
}
}
#endif
#endif // header
@@ -0,0 +1,105 @@
//---------------------------------------------------------------------------//
// Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
//
// Distributed under the Boost Software License, Version 1.0
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
// See http://boostorg.github.com/compute for more information.
//---------------------------------------------------------------------------//
#ifndef BOOST_COMPUTE_ALGORITHM_MERGE_HPP
#define BOOST_COMPUTE_ALGORITHM_MERGE_HPP
#include <boost/compute/system.hpp>
#include <boost/compute/command_queue.hpp>
#include <boost/compute/algorithm/copy.hpp>
#include <boost/compute/algorithm/detail/merge_with_merge_path.hpp>
#include <boost/compute/algorithm/detail/serial_merge.hpp>
#include <boost/compute/detail/iterator_range_size.hpp>
#include <boost/compute/detail/parameter_cache.hpp>
namespace boost {
namespace compute {
/// Merges the sorted values in the range [\p first1, \p last1) with the sorted
/// values in the range [\p first2, last2) and stores the result in the range
/// beginning at \p result. Values are compared using the \p comp function. If
/// no comparision function is given, \c less is used.
///
/// \param first1 first element in the first range to merge
/// \param last1 last element in the first range to merge
/// \param first2 first element in the second range to merge
/// \param last2 last element in the second range to merge
/// \param result first element in the result range
/// \param comp comparison function (by default \c less)
/// \param queue command queue to perform the operation
///
/// \return \c OutputIterator to the end of the result range
///
/// \see inplace_merge()
template<class InputIterator1,
class InputIterator2,
class OutputIterator,
class Compare>
inline OutputIterator merge(InputIterator1 first1,
InputIterator1 last1,
InputIterator2 first2,
InputIterator2 last2,
OutputIterator result,
Compare comp,
command_queue &queue = system::default_queue())
{
typedef typename std::iterator_traits<InputIterator1>::value_type input1_type;
typedef typename std::iterator_traits<InputIterator2>::value_type input2_type;
typedef typename std::iterator_traits<OutputIterator>::value_type output_type;
const device &device = queue.get_device();
std::string cache_key =
std::string("__boost_merge_") + type_name<input1_type>() + "_"
+ type_name<input2_type>() + "_" + type_name<output_type>();
boost::shared_ptr<detail::parameter_cache> parameters =
detail::parameter_cache::get_global_cache(device);
// default serial merge threshold depends on device type
size_t default_serial_merge_threshold = 32768;
if(device.type() & device::gpu) {
default_serial_merge_threshold = 2048;
}
// loading serial merge threshold parameter
const size_t serial_merge_threshold =
parameters->get(cache_key, "serial_merge_threshold",
static_cast<uint_>(default_serial_merge_threshold));
// choosing merge algorithm
const size_t total_count =
detail::iterator_range_size(first1, last1)
+ detail::iterator_range_size(first2, last2);
// for small inputs serial merge turns out to outperform
// merge with merge path algorithm
if(total_count <= serial_merge_threshold){
return detail::serial_merge(first1, last1, first2, last2, result, comp, queue);
}
return detail::merge_with_merge_path(first1, last1, first2, last2, result, comp, queue);
}
/// \overload
template<class InputIterator1, class InputIterator2, class OutputIterator>
inline OutputIterator merge(InputIterator1 first1,
InputIterator1 last1,
InputIterator2 first2,
InputIterator2 last2,
OutputIterator result,
command_queue &queue = system::default_queue())
{
typedef typename std::iterator_traits<InputIterator1>::value_type value_type;
less<value_type> less_than;
return merge(first1, last1, first2, last2, result, less_than, queue);
}
} // end compute namespace
} // end boost namespace
#endif // BOOST_COMPUTE_ALGORITHM_MERGE_HPP