Initial Commit
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
// (C) Copyright 2009-2011 Frederic Bron.
|
||||
//
|
||||
// Use, modification and distribution are subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt).
|
||||
//
|
||||
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
|
||||
|
||||
#ifndef BOOST_TT_HAS_DEREFERENCE_HPP_INCLUDED
|
||||
#define BOOST_TT_HAS_DEREFERENCE_HPP_INCLUDED
|
||||
|
||||
#define BOOST_TT_TRAIT_NAME has_dereference
|
||||
#define BOOST_TT_TRAIT_OP *
|
||||
#define BOOST_TT_FORBIDDEN_IF\
|
||||
/* void* or fundamental */\
|
||||
(\
|
||||
(\
|
||||
::boost::is_pointer< Rhs_noref >::value && \
|
||||
::boost::is_void< Rhs_noptr >::value\
|
||||
) || \
|
||||
::boost::is_fundamental< Rhs_nocv >::value\
|
||||
)
|
||||
|
||||
|
||||
#include <boost/type_traits/detail/has_prefix_operator.hpp>
|
||||
|
||||
#undef BOOST_TT_TRAIT_NAME
|
||||
#undef BOOST_TT_TRAIT_OP
|
||||
#undef BOOST_TT_FORBIDDEN_IF
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,124 @@
|
||||
|
||||
#ifndef BOOST_MPL_SEQUENCE_TAG_HPP_INCLUDED
|
||||
#define BOOST_MPL_SEQUENCE_TAG_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id$
|
||||
// $Date$
|
||||
// $Revision$
|
||||
|
||||
#include <boost/mpl/sequence_tag_fwd.hpp>
|
||||
#include <boost/mpl/aux_/has_tag.hpp>
|
||||
#include <boost/mpl/aux_/has_begin.hpp>
|
||||
#include <boost/mpl/aux_/na_spec.hpp>
|
||||
#include <boost/mpl/aux_/is_msvc_eti_arg.hpp>
|
||||
#include <boost/mpl/aux_/config/eti.hpp>
|
||||
#include <boost/mpl/aux_/yes_no.hpp>
|
||||
#include <boost/mpl/aux_/config/workaround.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
// agurt, 27/nov/02: have to use a simplistic 'sequence_tag' implementation
|
||||
// on MSVC to avoid dreadful "internal structure overflow" error
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) \
|
||||
|| defined(BOOST_MPL_CFG_NO_HAS_XXX)
|
||||
|
||||
template<
|
||||
typename BOOST_MPL_AUX_NA_PARAM(Sequence)
|
||||
>
|
||||
struct sequence_tag
|
||||
{
|
||||
typedef typename Sequence::tag type;
|
||||
};
|
||||
|
||||
#elif BOOST_WORKAROUND(BOOST_MSVC, == 1300)
|
||||
|
||||
// agurt, 07/feb/03: workaround for what seems to be MSVC 7.0-specific ETI issue
|
||||
|
||||
namespace aux {
|
||||
|
||||
template< bool >
|
||||
struct sequence_tag_impl
|
||||
{
|
||||
template< typename Sequence > struct result_
|
||||
{
|
||||
typedef typename Sequence::tag type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct sequence_tag_impl<false>
|
||||
{
|
||||
template< typename Sequence > struct result_
|
||||
{
|
||||
typedef int type;
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
template<
|
||||
typename BOOST_MPL_AUX_NA_PARAM(Sequence)
|
||||
>
|
||||
struct sequence_tag
|
||||
: aux::sequence_tag_impl< !aux::is_msvc_eti_arg<Sequence>::value >
|
||||
::template result_<Sequence>
|
||||
{
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
namespace aux {
|
||||
|
||||
template< bool has_tag_, bool has_begin_ >
|
||||
struct sequence_tag_impl
|
||||
{
|
||||
// agurt 24/nov/02: MSVC 6.5 gets confused in 'sequence_tag_impl<true>'
|
||||
// specialization below, if we name it 'result_' here
|
||||
template< typename Sequence > struct result2_;
|
||||
};
|
||||
|
||||
# define AUX_CLASS_SEQUENCE_TAG_SPEC(has_tag, has_begin, result_type) \
|
||||
template<> struct sequence_tag_impl<has_tag,has_begin> \
|
||||
{ \
|
||||
template< typename Sequence > struct result2_ \
|
||||
{ \
|
||||
typedef result_type type; \
|
||||
}; \
|
||||
}; \
|
||||
/**/
|
||||
|
||||
AUX_CLASS_SEQUENCE_TAG_SPEC(true, true, typename Sequence::tag)
|
||||
AUX_CLASS_SEQUENCE_TAG_SPEC(true, false, typename Sequence::tag)
|
||||
AUX_CLASS_SEQUENCE_TAG_SPEC(false, true, nested_begin_end_tag)
|
||||
AUX_CLASS_SEQUENCE_TAG_SPEC(false, false, non_sequence_tag)
|
||||
|
||||
# undef AUX_CLASS_SEQUENCE_TAG_SPEC
|
||||
|
||||
} // namespace aux
|
||||
|
||||
template<
|
||||
typename BOOST_MPL_AUX_NA_PARAM(Sequence)
|
||||
>
|
||||
struct sequence_tag
|
||||
: aux::sequence_tag_impl<
|
||||
::boost::mpl::aux::has_tag<Sequence>::value
|
||||
, ::boost::mpl::aux::has_begin<Sequence>::value
|
||||
>::template result2_<Sequence>
|
||||
{
|
||||
};
|
||||
|
||||
#endif // BOOST_MSVC
|
||||
|
||||
BOOST_MPL_AUX_NA_SPEC(1, sequence_tag)
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_SEQUENCE_TAG_HPP_INCLUDED
|
||||
@@ -0,0 +1,121 @@
|
||||
/* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* 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/multi_index for library home page.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_MULTI_INDEX_FWD_HPP
|
||||
#define BOOST_MULTI_INDEX_FWD_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/multi_index/identity.hpp>
|
||||
#include <boost/multi_index/indexed_by.hpp>
|
||||
#include <boost/multi_index/ordered_index_fwd.hpp>
|
||||
#include <memory>
|
||||
|
||||
namespace boost{
|
||||
|
||||
namespace multi_index{
|
||||
|
||||
/* Default value for IndexSpecifierList specifies a container
|
||||
* equivalent to std::set<Value>.
|
||||
*/
|
||||
|
||||
template<
|
||||
typename Value,
|
||||
typename IndexSpecifierList=indexed_by<ordered_unique<identity<Value> > >,
|
||||
typename Allocator=std::allocator<Value> >
|
||||
class multi_index_container;
|
||||
|
||||
template<typename MultiIndexContainer,int N>
|
||||
struct nth_index;
|
||||
|
||||
template<typename MultiIndexContainer,typename Tag>
|
||||
struct index;
|
||||
|
||||
template<typename MultiIndexContainer,int N>
|
||||
struct nth_index_iterator;
|
||||
|
||||
template<typename MultiIndexContainer,int N>
|
||||
struct nth_index_const_iterator;
|
||||
|
||||
template<typename MultiIndexContainer,typename Tag>
|
||||
struct index_iterator;
|
||||
|
||||
template<typename MultiIndexContainer,typename Tag>
|
||||
struct index_const_iterator;
|
||||
|
||||
/* get and project functions not fwd declared due to problems
|
||||
* with dependent typenames
|
||||
*/
|
||||
|
||||
template<
|
||||
typename Value1,typename IndexSpecifierList1,typename Allocator1,
|
||||
typename Value2,typename IndexSpecifierList2,typename Allocator2
|
||||
>
|
||||
bool operator==(
|
||||
const multi_index_container<Value1,IndexSpecifierList1,Allocator1>& x,
|
||||
const multi_index_container<Value2,IndexSpecifierList2,Allocator2>& y);
|
||||
|
||||
template<
|
||||
typename Value1,typename IndexSpecifierList1,typename Allocator1,
|
||||
typename Value2,typename IndexSpecifierList2,typename Allocator2
|
||||
>
|
||||
bool operator<(
|
||||
const multi_index_container<Value1,IndexSpecifierList1,Allocator1>& x,
|
||||
const multi_index_container<Value2,IndexSpecifierList2,Allocator2>& y);
|
||||
|
||||
template<
|
||||
typename Value1,typename IndexSpecifierList1,typename Allocator1,
|
||||
typename Value2,typename IndexSpecifierList2,typename Allocator2
|
||||
>
|
||||
bool operator!=(
|
||||
const multi_index_container<Value1,IndexSpecifierList1,Allocator1>& x,
|
||||
const multi_index_container<Value2,IndexSpecifierList2,Allocator2>& y);
|
||||
|
||||
template<
|
||||
typename Value1,typename IndexSpecifierList1,typename Allocator1,
|
||||
typename Value2,typename IndexSpecifierList2,typename Allocator2
|
||||
>
|
||||
bool operator>(
|
||||
const multi_index_container<Value1,IndexSpecifierList1,Allocator1>& x,
|
||||
const multi_index_container<Value2,IndexSpecifierList2,Allocator2>& y);
|
||||
|
||||
template<
|
||||
typename Value1,typename IndexSpecifierList1,typename Allocator1,
|
||||
typename Value2,typename IndexSpecifierList2,typename Allocator2
|
||||
>
|
||||
bool operator>=(
|
||||
const multi_index_container<Value1,IndexSpecifierList1,Allocator1>& x,
|
||||
const multi_index_container<Value2,IndexSpecifierList2,Allocator2>& y);
|
||||
|
||||
template<
|
||||
typename Value1,typename IndexSpecifierList1,typename Allocator1,
|
||||
typename Value2,typename IndexSpecifierList2,typename Allocator2
|
||||
>
|
||||
bool operator<=(
|
||||
const multi_index_container<Value1,IndexSpecifierList1,Allocator1>& x,
|
||||
const multi_index_container<Value2,IndexSpecifierList2,Allocator2>& y);
|
||||
|
||||
template<typename Value,typename IndexSpecifierList,typename Allocator>
|
||||
void swap(
|
||||
multi_index_container<Value,IndexSpecifierList,Allocator>& x,
|
||||
multi_index_container<Value,IndexSpecifierList,Allocator>& y);
|
||||
|
||||
} /* namespace multi_index */
|
||||
|
||||
/* multi_index_container, being the main type of this library, is promoted to
|
||||
* namespace boost.
|
||||
*/
|
||||
|
||||
using multi_index::multi_index_container;
|
||||
|
||||
} /* namespace boost */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,28 @@
|
||||
// Copyright David Abrahams 2003.
|
||||
// Copyright Stefan Seefeld 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)
|
||||
|
||||
#ifndef boost_python_detail_value_is_shared_ptr_hpp_
|
||||
#define boost_python_detail_value_is_shared_ptr_hpp_
|
||||
|
||||
#include <boost/python/detail/value_is_xxx.hpp>
|
||||
#include <boost/python/detail/is_shared_ptr.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
template <class X_>
|
||||
struct value_is_shared_ptr
|
||||
{
|
||||
static bool const value = is_shared_ptr<typename remove_cv<
|
||||
typename remove_reference<X_>
|
||||
::type>
|
||||
::type>
|
||||
::value;
|
||||
typedef mpl::bool_<value> type;
|
||||
};
|
||||
|
||||
}}} // namespace boost::python::detail
|
||||
|
||||
#endif // VALUE_IS_SHARED_PTR_DWA2003224_HPP
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
#ifndef BOOST_MPL_SIZE_T_FWD_HPP_INCLUDED
|
||||
#define BOOST_MPL_SIZE_T_FWD_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id$
|
||||
// $Date$
|
||||
// $Revision$
|
||||
|
||||
#include <boost/mpl/aux_/adl_barrier.hpp>
|
||||
#include <boost/config.hpp> // make sure 'size_t' is placed into 'std'
|
||||
#include <cstddef>
|
||||
|
||||
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN
|
||||
|
||||
template< std::size_t N > struct size_t;
|
||||
|
||||
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
|
||||
BOOST_MPL_AUX_ADL_BARRIER_DECL(size_t)
|
||||
|
||||
#endif // BOOST_MPL_SIZE_T_FWD_HPP_INCLUDED
|
||||
@@ -0,0 +1,53 @@
|
||||
|
||||
// (C) Copyright Tobias Schwinger
|
||||
//
|
||||
// Use modification and distribution are subject to the boost Software License,
|
||||
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// no include guards, this file is intended for multiple inclusion
|
||||
|
||||
// input: BOOST_FT_syntax type macro to use
|
||||
// input: BOOST_FT_cc empty or cc specifier
|
||||
// input: BOOST_FT_ell empty or "..."
|
||||
// input: BOOST_FT_cv empty or cv qualifiers
|
||||
// input: BOOST_FT_flags single decimal integer encoding the flags
|
||||
// output: BOOST_FT_n number of component types (arity+1)
|
||||
// output: BOOST_FT_arity current arity
|
||||
// output: BOOST_FT_type macro that expands to the type
|
||||
// output: BOOST_FT_tplargs(p) template arguments with given prefix
|
||||
// output: BOOST_FT_params(p) parameters with given prefix
|
||||
|
||||
# include <boost/function_types/detail/classifier_impl/arity10_1.hpp>
|
||||
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 >
|
||||
typename encode_charr<BOOST_FT_flags,BOOST_FT_cc_id,11> ::type
|
||||
classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 BOOST_FT_ell) BOOST_FT_cv);
|
||||
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 >
|
||||
typename encode_charr<BOOST_FT_flags,BOOST_FT_cc_id,12> ::type
|
||||
classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 BOOST_FT_ell) BOOST_FT_cv);
|
||||
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 >
|
||||
typename encode_charr<BOOST_FT_flags,BOOST_FT_cc_id,13> ::type
|
||||
classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 BOOST_FT_ell) BOOST_FT_cv);
|
||||
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 >
|
||||
typename encode_charr<BOOST_FT_flags,BOOST_FT_cc_id,14> ::type
|
||||
classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 BOOST_FT_ell) BOOST_FT_cv);
|
||||
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 >
|
||||
typename encode_charr<BOOST_FT_flags,BOOST_FT_cc_id,15> ::type
|
||||
classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 BOOST_FT_ell) BOOST_FT_cv);
|
||||
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 >
|
||||
typename encode_charr<BOOST_FT_flags,BOOST_FT_cc_id,16> ::type
|
||||
classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 BOOST_FT_ell) BOOST_FT_cv);
|
||||
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 >
|
||||
typename encode_charr<BOOST_FT_flags,BOOST_FT_cc_id,17> ::type
|
||||
classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 BOOST_FT_ell) BOOST_FT_cv);
|
||||
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 >
|
||||
typename encode_charr<BOOST_FT_flags,BOOST_FT_cc_id,18> ::type
|
||||
classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 BOOST_FT_ell) BOOST_FT_cv);
|
||||
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 >
|
||||
typename encode_charr<BOOST_FT_flags,BOOST_FT_cc_id,19> ::type
|
||||
classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 BOOST_FT_ell) BOOST_FT_cv);
|
||||
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 >
|
||||
typename encode_charr<BOOST_FT_flags,BOOST_FT_cc_id,20> ::type
|
||||
classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 BOOST_FT_ell) BOOST_FT_cv);
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2009 Christopher Schmidt
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_FUSION_CONTAINER_SET_DETAIL_BEGIN_IMPL_HPP
|
||||
#define BOOST_FUSION_CONTAINER_SET_DETAIL_BEGIN_IMPL_HPP
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/iterator/basic_iterator.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
template <typename>
|
||||
struct begin_impl;
|
||||
|
||||
template <>
|
||||
struct begin_impl<set_tag>
|
||||
{
|
||||
template <typename Seq>
|
||||
struct apply
|
||||
{
|
||||
typedef
|
||||
basic_iterator<
|
||||
set_iterator_tag
|
||||
, typename Seq::category
|
||||
, Seq
|
||||
, 0
|
||||
>
|
||||
type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type
|
||||
call(Seq& seq)
|
||||
{
|
||||
return type(seq,0);
|
||||
}
|
||||
};
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,33 @@
|
||||
// get_last_error.hpp --------------------------------------------------------------//
|
||||
|
||||
// Copyright 2010 Vicente J. Botet Escriba
|
||||
// Copyright 2015 Andrey Semashev
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
|
||||
#ifndef BOOST_DETAIL_WINAPI_GET_LAST_ERROR_HPP
|
||||
#define BOOST_DETAIL_WINAPI_GET_LAST_ERROR_HPP
|
||||
|
||||
#include <boost/detail/winapi/basic_types.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if !defined( BOOST_USE_WINDOWS_H )
|
||||
extern "C" {
|
||||
BOOST_SYMBOL_IMPORT boost::detail::winapi::DWORD_ WINAPI GetLastError(BOOST_DETAIL_WINAPI_VOID);
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
namespace winapi {
|
||||
using ::GetLastError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BOOST_DETAIL_WINAPI_GET_LAST_ERROR_HPP
|
||||
@@ -0,0 +1,55 @@
|
||||
|
||||
#ifndef BOOST_MPL_VECTOR_AUX_CLEAR_HPP_INCLUDED
|
||||
#define BOOST_MPL_VECTOR_AUX_CLEAR_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id$
|
||||
// $Date$
|
||||
// $Revision$
|
||||
|
||||
#include <boost/mpl/clear_fwd.hpp>
|
||||
#include <boost/mpl/vector/aux_/vector0.hpp>
|
||||
#include <boost/mpl/vector/aux_/tag.hpp>
|
||||
#include <boost/mpl/aux_/config/typeof.hpp>
|
||||
#include <boost/mpl/aux_/config/ctps.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
#if defined(BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES)
|
||||
|
||||
template<>
|
||||
struct clear_impl< aux::vector_tag >
|
||||
{
|
||||
template< typename Vector > struct apply
|
||||
{
|
||||
typedef vector0<> type;
|
||||
};
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
|
||||
template< long N >
|
||||
struct clear_impl< aux::vector_tag<N> >
|
||||
{
|
||||
template< typename Vector > struct apply
|
||||
{
|
||||
typedef vector0<> type;
|
||||
};
|
||||
};
|
||||
|
||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
#endif // BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_VECTOR_AUX_CLEAR_HPP_INCLUDED
|
||||
@@ -0,0 +1,44 @@
|
||||
|
||||
#ifndef BOOST_MPL_MAP_MAP30_HPP_INCLUDED
|
||||
#define BOOST_MPL_MAP_MAP30_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
// Copyright David Abrahams 2003-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$
|
||||
|
||||
#if !defined(BOOST_MPL_PREPROCESSING_MODE)
|
||||
# include <boost/mpl/map/map20.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/mpl/aux_/config/use_preprocessed.hpp>
|
||||
|
||||
#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
|
||||
&& !defined(BOOST_MPL_PREPROCESSING_MODE)
|
||||
|
||||
# define BOOST_MPL_PREPROCESSED_HEADER map30.hpp
|
||||
# include <boost/mpl/map/aux_/include_preprocessed.hpp>
|
||||
|
||||
#else
|
||||
|
||||
# include <boost/preprocessor/iterate.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
# define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3,(21, 30, <boost/mpl/map/aux_/numbered.hpp>))
|
||||
# include BOOST_PP_ITERATE()
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
|
||||
|
||||
#endif // BOOST_MPL_MAP_MAP30_HPP_INCLUDED
|
||||
@@ -0,0 +1,43 @@
|
||||
// Copyright Neil Groves 2009. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range/
|
||||
//
|
||||
#ifndef BOOST_RANGE_ALGORITHM_COPY_BACKWARD_HPP_INCLUDED
|
||||
#define BOOST_RANGE_ALGORITHM_COPY_BACKWARD_HPP_INCLUDED
|
||||
|
||||
#include <boost/concept_check.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/concepts.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range
|
||||
{
|
||||
|
||||
/// \brief template function copy_backward
|
||||
///
|
||||
/// range-based version of the copy_backwards std algorithm
|
||||
///
|
||||
/// \pre BidirectionalRange is a model of the BidirectionalRangeConcept
|
||||
/// \pre BidirectionalTraversalWriteableIterator is a model of the BidirectionalIteratorConcept
|
||||
/// \pre BidirectionalTraversalWriteableIterator is a model of the WriteableIteratorConcept
|
||||
template< class BidirectionalRange, class BidirectionalTraversalWriteableIterator >
|
||||
inline BidirectionalTraversalWriteableIterator
|
||||
copy_backward(const BidirectionalRange& rng,
|
||||
BidirectionalTraversalWriteableIterator out)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<const BidirectionalRange> ));
|
||||
return std::copy_backward(boost::begin(rng), boost::end(rng), out);
|
||||
}
|
||||
|
||||
} // namespace range
|
||||
using range::copy_backward;
|
||||
} // namespace boost
|
||||
|
||||
#endif // include guard
|
||||
@@ -0,0 +1,45 @@
|
||||
subroutine inter_wspr(id,ndir)
|
||||
|
||||
! Interleave (ndir=1) or de-interleave (ndir=-1) the array id.
|
||||
|
||||
integer*1 id(0:161),itmp(0:161)
|
||||
integer j0(0:161)
|
||||
logical first
|
||||
data first/.true./
|
||||
save
|
||||
|
||||
if(first) then
|
||||
! Compute the interleave table using bit reversal.
|
||||
k=-1
|
||||
do i=0,255
|
||||
n=0
|
||||
ii=i
|
||||
do j=0,7
|
||||
n=n+n
|
||||
if(iand(ii,1).ne.0) n=n+1
|
||||
ii=ii/2
|
||||
enddo
|
||||
if(n.le.161) then
|
||||
k=k+1
|
||||
j0(k)=n
|
||||
endif
|
||||
enddo
|
||||
first=.false.
|
||||
endif
|
||||
|
||||
if(ndir.eq.1) then
|
||||
do i=0,161
|
||||
itmp(j0(i))=id(i)
|
||||
enddo
|
||||
else
|
||||
do i=0,161
|
||||
itmp(i)=id(j0(i))
|
||||
enddo
|
||||
endif
|
||||
|
||||
do i=0,161
|
||||
id(i)=itmp(i)
|
||||
enddo
|
||||
|
||||
return
|
||||
end subroutine inter_wspr
|
||||
@@ -0,0 +1,9 @@
|
||||
0; 0; 0
|
||||
107; 67; 0
|
||||
223;143; 0
|
||||
255;123; 27
|
||||
255; 91; 71
|
||||
255;195; 95
|
||||
195;255;111
|
||||
151;255;151
|
||||
255;255;255
|
||||
@@ -0,0 +1,60 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2010 Christopher Schmidt
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2015 Kohei Takahashi
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_FUSION_ALGORITHM_ITERATION_REVERSE_FOLD_HPP
|
||||
#define BOOST_FUSION_ALGORITHM_ITERATION_REVERSE_FOLD_HPP
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/algorithm/iteration/reverse_fold_fwd.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/size.hpp>
|
||||
#include <boost/fusion/support/is_segmented.hpp>
|
||||
#include <boost/fusion/support/is_sequence.hpp>
|
||||
#include <boost/fusion/iterator/deref.hpp>
|
||||
#include <boost/fusion/iterator/value_of.hpp>
|
||||
#include <boost/fusion/iterator/prior.hpp>
|
||||
#include <boost/utility/result_of.hpp>
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
|
||||
#define BOOST_FUSION_REVERSE_FOLD
|
||||
|
||||
#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
|
||||
#include <boost/fusion/algorithm/iteration/detail/preprocessed/reverse_fold.hpp>
|
||||
#else
|
||||
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "detail/preprocessed/reverse_fold.hpp")
|
||||
#endif
|
||||
|
||||
/*=============================================================================
|
||||
Copyright (c) 2009-2010 Christopher Schmidt
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
This is an auto-generated file. Do not edit!
|
||||
==============================================================================*/
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
#include <boost/fusion/algorithm/iteration/detail/fold.hpp>
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
|
||||
|
||||
#undef BOOST_FUSION_REVERSE_FOLD
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,223 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_SEQUENCE_INTRINSIC_FWD_HPP_INCLUDED)
|
||||
#define BOOST_FUSION_SEQUENCE_INTRINSIC_FWD_HPP_INCLUDED
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/fusion/support/is_sequence.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct at_impl;
|
||||
|
||||
template <typename Tag>
|
||||
struct begin_impl;
|
||||
|
||||
template <typename Tag>
|
||||
struct empty_impl;
|
||||
|
||||
template <typename Tag>
|
||||
struct end_impl;
|
||||
|
||||
template <typename Tag>
|
||||
struct has_key_impl;
|
||||
|
||||
template <typename Tag>
|
||||
struct segments_impl;
|
||||
|
||||
template <typename Tag>
|
||||
struct size_impl;
|
||||
|
||||
template <typename Tag>
|
||||
struct value_at_impl;
|
||||
|
||||
template <typename Tag>
|
||||
struct at_key_impl;
|
||||
|
||||
template <typename Tag>
|
||||
struct value_at_key_impl;
|
||||
}
|
||||
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence, typename N>
|
||||
struct at;
|
||||
|
||||
template <typename Sequence, int N>
|
||||
struct at_c;
|
||||
|
||||
template <typename Sequence>
|
||||
struct back;
|
||||
|
||||
template <typename Sequence>
|
||||
struct begin;
|
||||
|
||||
template <typename Sequence>
|
||||
struct empty;
|
||||
|
||||
template <typename Sequence>
|
||||
struct end;
|
||||
|
||||
template <typename Sequence>
|
||||
struct front;
|
||||
|
||||
template <typename Sequence, typename Key>
|
||||
struct has_key;
|
||||
|
||||
template <typename Sequence>
|
||||
struct segments;
|
||||
|
||||
template <typename Sequence>
|
||||
struct size;
|
||||
|
||||
template <typename Sequence, typename N>
|
||||
struct value_at;
|
||||
|
||||
template <typename Sequence, int N>
|
||||
struct value_at_c;
|
||||
|
||||
template <typename Sequence, typename Key>
|
||||
struct at_key;
|
||||
|
||||
template <typename Sequence, typename N>
|
||||
struct value_at_key;
|
||||
}
|
||||
|
||||
template <typename N, typename Sequence>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
typename
|
||||
lazy_disable_if<
|
||||
is_const<Sequence>
|
||||
, result_of::at<Sequence, N>
|
||||
>::type
|
||||
at(Sequence& seq);
|
||||
|
||||
template <typename N, typename Sequence>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
typename result_of::at<Sequence const, N>::type
|
||||
at(Sequence const& seq);
|
||||
|
||||
template <int N, typename Sequence>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
typename
|
||||
lazy_disable_if<
|
||||
is_const<Sequence>
|
||||
, result_of::at_c<Sequence, N>
|
||||
>::type
|
||||
at_c(Sequence& seq);
|
||||
|
||||
template <int N, typename Sequence>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
typename result_of::at_c<Sequence const, N>::type
|
||||
at_c(Sequence const& seq);
|
||||
|
||||
template <typename Sequence>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
typename result_of::back<Sequence>::type
|
||||
back(Sequence& seq);
|
||||
|
||||
template <typename Sequence>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
typename result_of::back<Sequence const>::type
|
||||
back(Sequence const& seq);
|
||||
|
||||
template <typename Sequence>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
typename
|
||||
lazy_enable_if<
|
||||
traits::is_sequence<Sequence>
|
||||
, result_of::begin<Sequence>
|
||||
>::type const
|
||||
begin(Sequence& seq);
|
||||
|
||||
template <typename Sequence>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
typename
|
||||
lazy_enable_if<
|
||||
traits::is_sequence<Sequence>
|
||||
, result_of::begin<Sequence const>
|
||||
>::type const
|
||||
begin(Sequence const& seq);
|
||||
|
||||
template <typename Sequence>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
typename result_of::empty<Sequence>::type
|
||||
empty(Sequence const&);
|
||||
|
||||
template <typename Sequence>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
typename
|
||||
lazy_enable_if<
|
||||
traits::is_sequence<Sequence>
|
||||
, result_of::end<Sequence>
|
||||
>::type const
|
||||
end(Sequence& seq);
|
||||
|
||||
template <typename Sequence>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
typename
|
||||
lazy_enable_if<
|
||||
traits::is_sequence<Sequence>
|
||||
, result_of::end<Sequence const>
|
||||
>::type const
|
||||
end(Sequence const& seq);
|
||||
|
||||
template <typename Sequence>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
typename result_of::front<Sequence>::type
|
||||
front(Sequence& seq);
|
||||
|
||||
template <typename Sequence>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
typename result_of::front<Sequence const>::type
|
||||
front(Sequence const& seq);
|
||||
|
||||
template <typename Key, typename Sequence>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
typename result_of::has_key<Sequence, Key>::type
|
||||
has_key(Sequence const& seq);
|
||||
|
||||
template <typename Sequence>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
typename
|
||||
lazy_disable_if<
|
||||
is_const<Sequence>
|
||||
, result_of::segments<Sequence>
|
||||
>::type
|
||||
segments(Sequence& seq);
|
||||
|
||||
template <typename Sequence>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
typename result_of::segments<Sequence const>::type
|
||||
segments(Sequence const& seq);
|
||||
|
||||
template <typename Sequence>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
typename result_of::size<Sequence>::type
|
||||
size(Sequence const&);
|
||||
|
||||
template <typename Key, typename Sequence>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
typename
|
||||
lazy_disable_if<
|
||||
is_const<Sequence>
|
||||
, result_of::at_key<Sequence, Key>
|
||||
>::type
|
||||
at_key(Sequence& seq);
|
||||
|
||||
template <typename Key, typename Sequence>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
typename result_of::at_key<Sequence const, Key>::type
|
||||
at_key(Sequence const& seq);
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,38 @@
|
||||
|
||||
// (C) Copyright Tobias Schwinger
|
||||
//
|
||||
// Use modification and distribution are subject to the boost Software License,
|
||||
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// no include guards, this file is intended for multiple inclusion
|
||||
|
||||
#undef BOOST_FT_type_mask
|
||||
#undef BOOST_FT_kind_mask
|
||||
#undef BOOST_FT_callable_builtin
|
||||
#undef BOOST_FT_non_member
|
||||
#undef BOOST_FT_function
|
||||
#undef BOOST_FT_pointer
|
||||
#undef BOOST_FT_reference
|
||||
#undef BOOST_FT_non_member_callable_builtin
|
||||
#undef BOOST_FT_member_pointer
|
||||
#undef BOOST_FT_member_function_pointer
|
||||
#undef BOOST_FT_member_object_pointer
|
||||
#undef BOOST_FT_member_object_pointer_flags
|
||||
|
||||
#undef BOOST_FT_variadic
|
||||
#undef BOOST_FT_non_variadic
|
||||
#undef BOOST_FT_variadic_mask
|
||||
|
||||
#undef BOOST_FT_const
|
||||
#undef BOOST_FT_volatile
|
||||
|
||||
#undef BOOST_FT_default_cc
|
||||
#undef BOOST_FT_cc_mask
|
||||
|
||||
#undef BOOST_FT_flags_mask
|
||||
#undef BOOST_FT_full_mask
|
||||
|
||||
#undef BOOST_FT_arity_mask
|
||||
|
||||
@@ -0,0 +1,832 @@
|
||||
/*
|
||||
[auto_generated]
|
||||
boost/numeric/odeint/stepper/bulirsch_stoer_dense_out.hpp
|
||||
|
||||
[begin_description]
|
||||
Implementaiton of the Burlish-Stoer method with dense output
|
||||
[end_description]
|
||||
|
||||
Copyright 2011-2015 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_BULIRSCH_STOER_DENSE_OUT_HPP_INCLUDED
|
||||
#define BOOST_NUMERIC_ODEINT_STEPPER_BULIRSCH_STOER_DENSE_OUT_HPP_INCLUDED
|
||||
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <boost/config.hpp> // for min/max guidelines
|
||||
|
||||
#include <boost/numeric/odeint/util/bind.hpp>
|
||||
|
||||
#include <boost/math/special_functions/binomial.hpp>
|
||||
|
||||
#include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp>
|
||||
#include <boost/numeric/odeint/stepper/modified_midpoint.hpp>
|
||||
#include <boost/numeric/odeint/stepper/controlled_step_result.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/util/state_wrapper.hpp>
|
||||
#include <boost/numeric/odeint/util/is_resizeable.hpp>
|
||||
#include <boost/numeric/odeint/util/resizer.hpp>
|
||||
#include <boost/numeric/odeint/util/unit_helper.hpp>
|
||||
|
||||
#include <boost/numeric/odeint/integrate/max_step_checker.hpp>
|
||||
|
||||
#include <boost/type_traits.hpp>
|
||||
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace odeint {
|
||||
|
||||
template<
|
||||
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 bulirsch_stoer_dense_out {
|
||||
|
||||
|
||||
public:
|
||||
|
||||
typedef State state_type;
|
||||
typedef Value value_type;
|
||||
typedef Deriv deriv_type;
|
||||
typedef Time time_type;
|
||||
typedef Algebra algebra_type;
|
||||
typedef Operations operations_type;
|
||||
typedef Resizer resizer_type;
|
||||
typedef dense_output_stepper_tag stepper_category;
|
||||
#ifndef DOXYGEN_SKIP
|
||||
typedef state_wrapper< state_type > wrapped_state_type;
|
||||
typedef state_wrapper< deriv_type > wrapped_deriv_type;
|
||||
|
||||
typedef bulirsch_stoer_dense_out< State , Value , Deriv , Time , Algebra , Operations , Resizer > controlled_error_bs_type;
|
||||
|
||||
typedef typename inverse_time< time_type >::type inv_time_type;
|
||||
|
||||
typedef std::vector< value_type > value_vector;
|
||||
typedef std::vector< time_type > time_vector;
|
||||
typedef std::vector< inv_time_type > inv_time_vector; //should be 1/time_type for boost.units
|
||||
typedef std::vector< value_vector > value_matrix;
|
||||
typedef std::vector< size_t > int_vector;
|
||||
typedef std::vector< wrapped_state_type > state_vector_type;
|
||||
typedef std::vector< wrapped_deriv_type > deriv_vector_type;
|
||||
typedef std::vector< deriv_vector_type > deriv_table_type;
|
||||
#endif //DOXYGEN_SKIP
|
||||
|
||||
const static size_t m_k_max = 8;
|
||||
|
||||
|
||||
|
||||
bulirsch_stoer_dense_out(
|
||||
value_type eps_abs = 1E-6 , value_type eps_rel = 1E-6 ,
|
||||
value_type factor_x = 1.0 , value_type factor_dxdt = 1.0 ,
|
||||
time_type max_dt = static_cast<time_type>(0) ,
|
||||
bool control_interpolation = false )
|
||||
: m_error_checker( eps_abs , eps_rel , factor_x, factor_dxdt ) ,
|
||||
m_max_dt(max_dt) ,
|
||||
m_control_interpolation( control_interpolation) ,
|
||||
m_last_step_rejected( false ) , m_first( true ) ,
|
||||
m_current_state_x1( true ) ,
|
||||
m_error( m_k_max ) ,
|
||||
m_interval_sequence( m_k_max+1 ) ,
|
||||
m_coeff( m_k_max+1 ) ,
|
||||
m_cost( m_k_max+1 ) ,
|
||||
m_table( m_k_max ) ,
|
||||
m_mp_states( m_k_max+1 ) ,
|
||||
m_derivs( m_k_max+1 ) ,
|
||||
m_diffs( 2*m_k_max+2 ) ,
|
||||
STEPFAC1( 0.65 ) , STEPFAC2( 0.94 ) , STEPFAC3( 0.02 ) , STEPFAC4( 4.0 ) , KFAC1( 0.8 ) , KFAC2( 0.9 )
|
||||
{
|
||||
BOOST_USING_STD_MIN();
|
||||
BOOST_USING_STD_MAX();
|
||||
|
||||
for( unsigned short i = 0; i < m_k_max+1; i++ )
|
||||
{
|
||||
/* only this specific sequence allows for dense output */
|
||||
m_interval_sequence[i] = 2 + 4*i; // 2 6 10 14 ...
|
||||
m_derivs[i].resize( m_interval_sequence[i] );
|
||||
if( i == 0 )
|
||||
m_cost[i] = m_interval_sequence[i];
|
||||
else
|
||||
m_cost[i] = m_cost[i-1] + m_interval_sequence[i];
|
||||
m_coeff[i].resize(i);
|
||||
for( size_t k = 0 ; k < i ; ++k )
|
||||
{
|
||||
const value_type r = static_cast< value_type >( m_interval_sequence[i] ) / static_cast< value_type >( m_interval_sequence[k] );
|
||||
m_coeff[i][k] = 1.0 / ( r*r - static_cast< value_type >( 1.0 ) ); // coefficients for extrapolation
|
||||
}
|
||||
// crude estimate of optimal order
|
||||
|
||||
m_current_k_opt = 4;
|
||||
/* no calculation because log10 might not exist for value_type!
|
||||
const value_type logfact( -log10( max BOOST_PREVENT_MACRO_SUBSTITUTION( eps_rel , static_cast< value_type >( 1.0E-12 ) ) ) * 0.6 + 0.5 );
|
||||
m_current_k_opt = max BOOST_PREVENT_MACRO_SUBSTITUTION( 1 , min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<int>( m_k_max-1 ) , static_cast<int>( logfact ) ));
|
||||
*/
|
||||
}
|
||||
int num = 1;
|
||||
for( int i = 2*(m_k_max)+1 ; i >=0 ; i-- )
|
||||
{
|
||||
m_diffs[i].resize( num );
|
||||
num += (i+1)%2;
|
||||
}
|
||||
}
|
||||
|
||||
template< class System , class StateIn , class DerivIn , class StateOut , class DerivOut >
|
||||
controlled_step_result try_step( System system , const StateIn &in , const DerivIn &dxdt , time_type &t , StateOut &out , DerivOut &dxdt_new , time_type &dt )
|
||||
{
|
||||
if( m_max_dt != static_cast<time_type>(0) && detail::less_with_sign(m_max_dt, dt, dt) )
|
||||
{
|
||||
// given step size is bigger then max_dt
|
||||
// set limit and return fail
|
||||
dt = m_max_dt;
|
||||
return fail;
|
||||
}
|
||||
|
||||
BOOST_USING_STD_MIN();
|
||||
BOOST_USING_STD_MAX();
|
||||
using std::pow;
|
||||
|
||||
static const value_type val1( 1.0 );
|
||||
|
||||
bool reject( true );
|
||||
|
||||
time_vector h_opt( m_k_max+1 );
|
||||
inv_time_vector work( m_k_max+1 );
|
||||
|
||||
m_k_final = 0;
|
||||
time_type new_h = dt;
|
||||
|
||||
//std::cout << "t=" << t <<", dt=" << dt << ", k_opt=" << m_current_k_opt << ", first: " << m_first << std::endl;
|
||||
|
||||
for( size_t k = 0 ; k <= m_current_k_opt+1 ; k++ )
|
||||
{
|
||||
m_midpoint.set_steps( m_interval_sequence[k] );
|
||||
if( k == 0 )
|
||||
{
|
||||
m_midpoint.do_step( system , in , dxdt , t , out , dt , m_mp_states[k].m_v , m_derivs[k]);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_midpoint.do_step( system , in , dxdt , t , m_table[k-1].m_v , dt , m_mp_states[k].m_v , m_derivs[k] );
|
||||
extrapolate( k , m_table , m_coeff , out );
|
||||
// get error estimate
|
||||
m_algebra.for_each3( m_err.m_v , out , m_table[0].m_v ,
|
||||
typename operations_type::template scale_sum2< value_type , value_type >( val1 , -val1 ) );
|
||||
const value_type error = m_error_checker.error( m_algebra , in , dxdt , m_err.m_v , dt );
|
||||
h_opt[k] = calc_h_opt( dt , error , k );
|
||||
work[k] = static_cast<value_type>( m_cost[k] ) / h_opt[k];
|
||||
|
||||
m_k_final = k;
|
||||
|
||||
if( (k == m_current_k_opt-1) || m_first )
|
||||
{ // convergence before k_opt ?
|
||||
if( error < 1.0 )
|
||||
{
|
||||
//convergence
|
||||
reject = false;
|
||||
if( (work[k] < KFAC2*work[k-1]) || (m_current_k_opt <= 2) )
|
||||
{
|
||||
// leave order as is (except we were in first round)
|
||||
m_current_k_opt = min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<int>(m_k_max)-1 , max BOOST_PREVENT_MACRO_SUBSTITUTION( 2 , static_cast<int>(k)+1 ) );
|
||||
new_h = h_opt[k] * static_cast<value_type>( m_cost[k+1] ) / static_cast<value_type>( m_cost[k] );
|
||||
} else {
|
||||
m_current_k_opt = min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<int>(m_k_max)-1 , max BOOST_PREVENT_MACRO_SUBSTITUTION( 2 , static_cast<int>(k) ) );
|
||||
new_h = h_opt[k];
|
||||
}
|
||||
break;
|
||||
}
|
||||
else if( should_reject( error , k ) && !m_first )
|
||||
{
|
||||
reject = true;
|
||||
new_h = h_opt[k];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( k == m_current_k_opt )
|
||||
{ // convergence at k_opt ?
|
||||
if( error < 1.0 )
|
||||
{
|
||||
//convergence
|
||||
reject = false;
|
||||
if( (work[k-1] < KFAC2*work[k]) )
|
||||
{
|
||||
m_current_k_opt = max BOOST_PREVENT_MACRO_SUBSTITUTION( 2 , static_cast<int>(m_current_k_opt)-1 );
|
||||
new_h = h_opt[m_current_k_opt];
|
||||
}
|
||||
else if( (work[k] < KFAC2*work[k-1]) && !m_last_step_rejected )
|
||||
{
|
||||
m_current_k_opt = min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<int>(m_k_max)-1 , static_cast<int>(m_current_k_opt)+1 );
|
||||
new_h = h_opt[k]*static_cast<value_type>( m_cost[m_current_k_opt] ) / static_cast<value_type>( m_cost[k] );
|
||||
} else
|
||||
new_h = h_opt[m_current_k_opt];
|
||||
break;
|
||||
}
|
||||
else if( should_reject( error , k ) )
|
||||
{
|
||||
reject = true;
|
||||
new_h = h_opt[m_current_k_opt];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( k == m_current_k_opt+1 )
|
||||
{ // convergence at k_opt+1 ?
|
||||
if( error < 1.0 )
|
||||
{ //convergence
|
||||
reject = false;
|
||||
if( work[k-2] < KFAC2*work[k-1] )
|
||||
m_current_k_opt = max BOOST_PREVENT_MACRO_SUBSTITUTION( 2 , static_cast<int>(m_current_k_opt)-1 );
|
||||
if( (work[k] < KFAC2*work[m_current_k_opt]) && !m_last_step_rejected )
|
||||
m_current_k_opt = min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<int>(m_k_max)-1 , static_cast<int>(k) );
|
||||
new_h = h_opt[m_current_k_opt];
|
||||
} else
|
||||
{
|
||||
reject = true;
|
||||
new_h = h_opt[m_current_k_opt];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( !reject )
|
||||
{
|
||||
|
||||
//calculate dxdt for next step and dense output
|
||||
typename odeint::unwrap_reference< System >::type &sys = system;
|
||||
sys( out , dxdt_new , t+dt );
|
||||
|
||||
//prepare dense output
|
||||
value_type error = prepare_dense_output( m_k_final , in , dxdt , out , dxdt_new , dt );
|
||||
|
||||
if( error > static_cast<value_type>(10) ) // we are not as accurate for interpolation as for the steps
|
||||
{
|
||||
reject = true;
|
||||
new_h = dt * pow BOOST_PREVENT_MACRO_SUBSTITUTION( error , static_cast<value_type>(-1)/(2*m_k_final+2) );
|
||||
} else {
|
||||
t += dt;
|
||||
}
|
||||
}
|
||||
//set next stepsize
|
||||
if( !m_last_step_rejected || (new_h < dt) )
|
||||
{
|
||||
// limit step size
|
||||
if( m_max_dt != static_cast<time_type>(0) )
|
||||
{
|
||||
new_h = detail::min_abs(m_max_dt, new_h);
|
||||
}
|
||||
dt = new_h;
|
||||
}
|
||||
|
||||
m_last_step_rejected = reject;
|
||||
if( reject )
|
||||
return fail;
|
||||
else
|
||||
return success;
|
||||
}
|
||||
|
||||
template< class StateType >
|
||||
void initialize( const StateType &x0 , const time_type &t0 , const time_type &dt0 )
|
||||
{
|
||||
m_resizer.adjust_size( x0 , detail::bind( &controlled_error_bs_type::template resize_impl< StateType > , detail::ref( *this ) , detail::_1 ) );
|
||||
boost::numeric::odeint::copy( x0 , get_current_state() );
|
||||
m_t = t0;
|
||||
m_dt = dt0;
|
||||
reset();
|
||||
}
|
||||
|
||||
|
||||
/* =======================================================
|
||||
* the actual step method that should be called from outside (maybe make try_step private?)
|
||||
*/
|
||||
template< class System >
|
||||
std::pair< time_type , time_type > do_step( System system )
|
||||
{
|
||||
if( m_first )
|
||||
{
|
||||
typename odeint::unwrap_reference< System >::type &sys = system;
|
||||
sys( get_current_state() , get_current_deriv() , m_t );
|
||||
}
|
||||
|
||||
failed_step_checker fail_checker; // to throw a runtime_error if step size adjustment fails
|
||||
controlled_step_result res = fail;
|
||||
m_t_last = m_t;
|
||||
while( res == fail )
|
||||
{
|
||||
res = try_step( system , get_current_state() , get_current_deriv() , m_t , get_old_state() , get_old_deriv() , m_dt );
|
||||
m_first = false;
|
||||
fail_checker(); // check for overflow of failed steps
|
||||
}
|
||||
toggle_current_state();
|
||||
return std::make_pair( m_t_last , m_t );
|
||||
}
|
||||
|
||||
/* performs the interpolation from a calculated step */
|
||||
template< class StateOut >
|
||||
void calc_state( time_type t , StateOut &x ) const
|
||||
{
|
||||
do_interpolation( t , x );
|
||||
}
|
||||
|
||||
const state_type& current_state( void ) const
|
||||
{
|
||||
return get_current_state();
|
||||
}
|
||||
|
||||
time_type current_time( void ) const
|
||||
{
|
||||
return m_t;
|
||||
}
|
||||
|
||||
const state_type& previous_state( void ) const
|
||||
{
|
||||
return get_old_state();
|
||||
}
|
||||
|
||||
time_type previous_time( void ) const
|
||||
{
|
||||
return m_t_last;
|
||||
}
|
||||
|
||||
time_type current_time_step( void ) const
|
||||
{
|
||||
return m_dt;
|
||||
}
|
||||
|
||||
/** \brief Resets the internal state of the stepper. */
|
||||
void reset()
|
||||
{
|
||||
m_first = true;
|
||||
m_last_step_rejected = false;
|
||||
}
|
||||
|
||||
template< class StateIn >
|
||||
void adjust_size( const StateIn &x )
|
||||
{
|
||||
resize_impl( x );
|
||||
m_midpoint.adjust_size( x );
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
template< class StateInOut , class StateVector >
|
||||
void extrapolate( size_t k , StateVector &table , const value_matrix &coeff , StateInOut &xest , size_t order_start_index = 0 )
|
||||
//polynomial extrapolation, see http://www.nr.com/webnotes/nr3web21.pdf
|
||||
{
|
||||
static const value_type val1( 1.0 );
|
||||
for( int j=k-1 ; j>0 ; --j )
|
||||
{
|
||||
m_algebra.for_each3( table[j-1].m_v , table[j].m_v , table[j-1].m_v ,
|
||||
typename operations_type::template scale_sum2< value_type , value_type >( val1 + coeff[k + order_start_index][j + order_start_index] ,
|
||||
-coeff[k + order_start_index][j + order_start_index] ) );
|
||||
}
|
||||
m_algebra.for_each3( xest , table[0].m_v , xest ,
|
||||
typename operations_type::template scale_sum2< value_type , value_type >( val1 + coeff[k + order_start_index][0 + order_start_index] ,
|
||||
-coeff[k + order_start_index][0 + order_start_index]) );
|
||||
}
|
||||
|
||||
|
||||
template< class StateVector >
|
||||
void extrapolate_dense_out( size_t k , StateVector &table , const value_matrix &coeff , size_t order_start_index = 0 )
|
||||
//polynomial extrapolation, see http://www.nr.com/webnotes/nr3web21.pdf
|
||||
{
|
||||
// result is written into table[0]
|
||||
static const value_type val1( 1.0 );
|
||||
for( int j=k ; j>1 ; --j )
|
||||
{
|
||||
m_algebra.for_each3( table[j-1].m_v , table[j].m_v , table[j-1].m_v ,
|
||||
typename operations_type::template scale_sum2< value_type , value_type >( val1 + coeff[k + order_start_index][j + order_start_index - 1] ,
|
||||
-coeff[k + order_start_index][j + order_start_index - 1] ) );
|
||||
}
|
||||
m_algebra.for_each3( table[0].m_v , table[1].m_v , table[0].m_v ,
|
||||
typename operations_type::template scale_sum2< value_type , value_type >( val1 + coeff[k + order_start_index][order_start_index] ,
|
||||
-coeff[k + order_start_index][order_start_index]) );
|
||||
}
|
||||
|
||||
time_type calc_h_opt( time_type h , value_type error , size_t k ) const
|
||||
{
|
||||
BOOST_USING_STD_MIN();
|
||||
BOOST_USING_STD_MAX();
|
||||
using std::pow;
|
||||
|
||||
value_type expo = static_cast<value_type>(1)/(m_interval_sequence[k-1]);
|
||||
value_type facmin = pow BOOST_PREVENT_MACRO_SUBSTITUTION( STEPFAC3 , expo );
|
||||
value_type fac;
|
||||
if (error == 0.0)
|
||||
fac = static_cast<value_type>(1)/facmin;
|
||||
else
|
||||
{
|
||||
fac = STEPFAC2 / pow BOOST_PREVENT_MACRO_SUBSTITUTION( error / STEPFAC1 , expo );
|
||||
fac = max BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<value_type>( facmin/STEPFAC4 ) , min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<value_type>(static_cast<value_type>(1)/facmin) , fac ) );
|
||||
}
|
||||
return h*fac;
|
||||
}
|
||||
|
||||
bool in_convergence_window( size_t k ) const
|
||||
{
|
||||
if( (k == m_current_k_opt-1) && !m_last_step_rejected )
|
||||
return true; // decrease order only if last step was not rejected
|
||||
return ( (k == m_current_k_opt) || (k == m_current_k_opt+1) );
|
||||
}
|
||||
|
||||
bool should_reject( value_type error , size_t k ) const
|
||||
{
|
||||
if( k == m_current_k_opt-1 )
|
||||
{
|
||||
const value_type d = m_interval_sequence[m_current_k_opt] * m_interval_sequence[m_current_k_opt+1] /
|
||||
(m_interval_sequence[0]*m_interval_sequence[0]);
|
||||
//step will fail, criterion 17.3.17 in NR
|
||||
return ( error > d*d );
|
||||
}
|
||||
else if( k == m_current_k_opt )
|
||||
{
|
||||
const value_type d = m_interval_sequence[m_current_k_opt+1] / m_interval_sequence[0];
|
||||
return ( error > d*d );
|
||||
} else
|
||||
return error > 1.0;
|
||||
}
|
||||
|
||||
template< class StateIn1 , class DerivIn1 , class StateIn2 , class DerivIn2 >
|
||||
value_type prepare_dense_output( int k , const StateIn1 &x_start , const DerivIn1 &dxdt_start ,
|
||||
const StateIn2 & /* x_end */ , const DerivIn2 & /*dxdt_end */ , time_type dt )
|
||||
/* k is the order to which the result was approximated */
|
||||
{
|
||||
|
||||
/* compute the coefficients of the interpolation polynomial
|
||||
* we parametrize the interval t .. t+dt by theta = -1 .. 1
|
||||
* we use 2k+3 values at the interval center theta=0 to obtain the interpolation coefficients
|
||||
* the values are x(t+dt/2) and the derivatives dx/dt , ... d^(2k+2) x / dt^(2k+2) at the midpoints
|
||||
* the derivatives are approximated via finite differences
|
||||
* all values are obtained from interpolation of the results from the increasing orders of the midpoint calls
|
||||
*/
|
||||
|
||||
// calculate finite difference approximations to derivatives at the midpoint
|
||||
for( int j = 0 ; j<=k ; j++ )
|
||||
{
|
||||
/* not working with boost units... */
|
||||
const value_type d = m_interval_sequence[j] / ( static_cast<value_type>(2) * dt );
|
||||
value_type f = 1.0; //factor 1/2 here because our interpolation interval has length 2 !!!
|
||||
for( int kappa = 0 ; kappa <= 2*j+1 ; ++kappa )
|
||||
{
|
||||
calculate_finite_difference( j , kappa , f , dxdt_start );
|
||||
f *= d;
|
||||
}
|
||||
|
||||
if( j > 0 )
|
||||
extrapolate_dense_out( j , m_mp_states , m_coeff );
|
||||
}
|
||||
|
||||
time_type d = dt/2;
|
||||
|
||||
// extrapolate finite differences
|
||||
for( int kappa = 0 ; kappa<=2*k+1 ; kappa++ )
|
||||
{
|
||||
for( int j=1 ; j<=(k-kappa/2) ; ++j )
|
||||
extrapolate_dense_out( j , m_diffs[kappa] , m_coeff , kappa/2 );
|
||||
|
||||
// extrapolation results are now stored in m_diffs[kappa][0]
|
||||
|
||||
// divide kappa-th derivative by kappa because we need these terms for dense output interpolation
|
||||
m_algebra.for_each1( m_diffs[kappa][0].m_v , typename operations_type::template scale< time_type >( static_cast<time_type>(d) ) );
|
||||
|
||||
d *= dt/(2*(kappa+2));
|
||||
}
|
||||
|
||||
// dense output coefficients a_0 is stored in m_mp_states[0], a_i for i = 1...2k are stored in m_diffs[i-1][0]
|
||||
|
||||
// the error is just the highest order coefficient of the interpolation polynomial
|
||||
// this is because we use only the midpoint theta=0 as support for the interpolation (remember that theta = -1 .. 1)
|
||||
|
||||
value_type error = 0.0;
|
||||
if( m_control_interpolation )
|
||||
{
|
||||
boost::numeric::odeint::copy( m_diffs[2*k+1][0].m_v , m_err.m_v );
|
||||
error = m_error_checker.error( m_algebra , x_start , dxdt_start , m_err.m_v , dt );
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
template< class DerivIn >
|
||||
void calculate_finite_difference( size_t j , size_t kappa , value_type fac , const DerivIn &dxdt )
|
||||
{
|
||||
const int m = m_interval_sequence[j]/2-1;
|
||||
if( kappa == 0) // no calculation required for 0th derivative of f
|
||||
{
|
||||
m_algebra.for_each2( m_diffs[0][j].m_v , m_derivs[j][m].m_v ,
|
||||
typename operations_type::template scale_sum1< value_type >( fac ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
// calculate the index of m_diffs for this kappa-j-combination
|
||||
const int j_diffs = j - kappa/2;
|
||||
|
||||
m_algebra.for_each2( m_diffs[kappa][j_diffs].m_v , m_derivs[j][m+kappa].m_v ,
|
||||
typename operations_type::template scale_sum1< value_type >( fac ) );
|
||||
value_type sign = -1.0;
|
||||
int c = 1;
|
||||
//computes the j-th order finite difference for the kappa-th derivative of f at t+dt/2 using function evaluations stored in m_derivs
|
||||
for( int i = m+static_cast<int>(kappa)-2 ; i >= m-static_cast<int>(kappa) ; i -= 2 )
|
||||
{
|
||||
if( i >= 0 )
|
||||
{
|
||||
m_algebra.for_each3( m_diffs[kappa][j_diffs].m_v , m_diffs[kappa][j_diffs].m_v , m_derivs[j][i].m_v ,
|
||||
typename operations_type::template scale_sum2< value_type , value_type >( 1.0 ,
|
||||
sign * fac * boost::math::binomial_coefficient< value_type >( kappa , c ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_algebra.for_each3( m_diffs[kappa][j_diffs].m_v , m_diffs[kappa][j_diffs].m_v , dxdt ,
|
||||
typename operations_type::template scale_sum2< value_type , value_type >( 1.0 , sign * fac ) );
|
||||
}
|
||||
sign *= -1;
|
||||
++c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template< class StateOut >
|
||||
void do_interpolation( time_type t , StateOut &out ) const
|
||||
{
|
||||
// interpolation polynomial is defined for theta = -1 ... 1
|
||||
// m_k_final is the number of order-iterations done for the last step - it governs the order of the interpolation polynomial
|
||||
const value_type theta = 2 * get_unit_value( (t - m_t_last) / (m_t - m_t_last) ) - 1;
|
||||
// we use only values at interval center, that is theta=0, for interpolation
|
||||
// our interpolation polynomial is thus of order 2k+2, hence we have 2k+3 terms
|
||||
|
||||
boost::numeric::odeint::copy( m_mp_states[0].m_v , out );
|
||||
// add remaining terms: x += a_1 theta + a2 theta^2 + ... + a_{2k} theta^{2k}
|
||||
value_type theta_pow( theta );
|
||||
for( size_t i=0 ; i<=2*m_k_final+1 ; ++i )
|
||||
{
|
||||
m_algebra.for_each3( out , out , m_diffs[i][0].m_v ,
|
||||
typename operations_type::template scale_sum2< value_type >( static_cast<value_type>(1) , theta_pow ) );
|
||||
theta_pow *= theta;
|
||||
}
|
||||
}
|
||||
|
||||
/* Resizer methods */
|
||||
template< class StateIn >
|
||||
bool resize_impl( const StateIn &x )
|
||||
{
|
||||
bool resized( false );
|
||||
|
||||
resized |= adjust_size_by_resizeability( m_x1 , x , typename is_resizeable<state_type>::type() );
|
||||
resized |= adjust_size_by_resizeability( m_x2 , x , typename is_resizeable<state_type>::type() );
|
||||
resized |= adjust_size_by_resizeability( m_dxdt1 , x , typename is_resizeable<state_type>::type() );
|
||||
resized |= adjust_size_by_resizeability( m_dxdt2 , x , typename is_resizeable<state_type>::type() );
|
||||
resized |= adjust_size_by_resizeability( m_err , x , typename is_resizeable<state_type>::type() );
|
||||
|
||||
for( size_t i = 0 ; i < m_k_max ; ++i )
|
||||
resized |= adjust_size_by_resizeability( m_table[i] , x , typename is_resizeable<state_type>::type() );
|
||||
for( size_t i = 0 ; i < m_k_max+1 ; ++i )
|
||||
resized |= adjust_size_by_resizeability( m_mp_states[i] , x , typename is_resizeable<state_type>::type() );
|
||||
for( size_t i = 0 ; i < m_k_max+1 ; ++i )
|
||||
for( size_t j = 0 ; j < m_derivs[i].size() ; ++j )
|
||||
resized |= adjust_size_by_resizeability( m_derivs[i][j] , x , typename is_resizeable<deriv_type>::type() );
|
||||
for( size_t i = 0 ; i < 2*m_k_max+2 ; ++i )
|
||||
for( size_t j = 0 ; j < m_diffs[i].size() ; ++j )
|
||||
resized |= adjust_size_by_resizeability( m_diffs[i][j] , x , typename is_resizeable<deriv_type>::type() );
|
||||
|
||||
return resized;
|
||||
}
|
||||
|
||||
|
||||
state_type& get_current_state( void )
|
||||
{
|
||||
return m_current_state_x1 ? m_x1.m_v : m_x2.m_v ;
|
||||
}
|
||||
|
||||
const state_type& get_current_state( void ) const
|
||||
{
|
||||
return m_current_state_x1 ? m_x1.m_v : m_x2.m_v ;
|
||||
}
|
||||
|
||||
state_type& get_old_state( void )
|
||||
{
|
||||
return m_current_state_x1 ? m_x2.m_v : m_x1.m_v ;
|
||||
}
|
||||
|
||||
const state_type& get_old_state( void ) const
|
||||
{
|
||||
return m_current_state_x1 ? m_x2.m_v : m_x1.m_v ;
|
||||
}
|
||||
|
||||
deriv_type& get_current_deriv( void )
|
||||
{
|
||||
return m_current_state_x1 ? m_dxdt1.m_v : m_dxdt2.m_v ;
|
||||
}
|
||||
|
||||
const deriv_type& get_current_deriv( void ) const
|
||||
{
|
||||
return m_current_state_x1 ? m_dxdt1.m_v : m_dxdt2.m_v ;
|
||||
}
|
||||
|
||||
deriv_type& get_old_deriv( void )
|
||||
{
|
||||
return m_current_state_x1 ? m_dxdt2.m_v : m_dxdt1.m_v ;
|
||||
}
|
||||
|
||||
const deriv_type& get_old_deriv( void ) const
|
||||
{
|
||||
return m_current_state_x1 ? m_dxdt2.m_v : m_dxdt1.m_v ;
|
||||
}
|
||||
|
||||
|
||||
void toggle_current_state( void )
|
||||
{
|
||||
m_current_state_x1 = ! m_current_state_x1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
default_error_checker< value_type, algebra_type , operations_type > m_error_checker;
|
||||
modified_midpoint_dense_out< state_type , value_type , deriv_type , time_type , algebra_type , operations_type , resizer_type > m_midpoint;
|
||||
|
||||
time_type m_max_dt;
|
||||
|
||||
bool m_control_interpolation;
|
||||
|
||||
bool m_last_step_rejected;
|
||||
bool m_first;
|
||||
|
||||
time_type m_t;
|
||||
time_type m_dt;
|
||||
time_type m_dt_last;
|
||||
time_type m_t_last;
|
||||
|
||||
size_t m_current_k_opt;
|
||||
size_t m_k_final;
|
||||
|
||||
algebra_type m_algebra;
|
||||
|
||||
resizer_type m_resizer;
|
||||
|
||||
wrapped_state_type m_x1 , m_x2;
|
||||
wrapped_deriv_type m_dxdt1 , m_dxdt2;
|
||||
wrapped_state_type m_err;
|
||||
bool m_current_state_x1;
|
||||
|
||||
|
||||
|
||||
value_vector m_error; // errors of repeated midpoint steps and extrapolations
|
||||
int_vector m_interval_sequence; // stores the successive interval counts
|
||||
value_matrix m_coeff;
|
||||
int_vector m_cost; // costs for interval count
|
||||
|
||||
state_vector_type m_table; // sequence of states for extrapolation
|
||||
|
||||
//for dense output:
|
||||
state_vector_type m_mp_states; // sequence of approximations of x at distance center
|
||||
deriv_table_type m_derivs; // table of function values
|
||||
deriv_table_type m_diffs; // table of function values
|
||||
|
||||
//wrapped_state_type m_a1 , m_a2 , m_a3 , m_a4;
|
||||
|
||||
value_type STEPFAC1 , STEPFAC2 , STEPFAC3 , STEPFAC4 , KFAC1 , KFAC2;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/********** DOXYGEN **********/
|
||||
|
||||
/**
|
||||
* \class bulirsch_stoer_dense_out
|
||||
* \brief The Bulirsch-Stoer algorithm.
|
||||
*
|
||||
* The Bulirsch-Stoer is a controlled stepper that adjusts both step size
|
||||
* and order of the method. The algorithm uses the modified midpoint and
|
||||
* a polynomial extrapolation compute the solution. This class also provides
|
||||
* dense output facility.
|
||||
*
|
||||
* \tparam State The state type.
|
||||
* \tparam Value The value type.
|
||||
* \tparam Deriv The type representing the time derivative of the state.
|
||||
* \tparam Time The time representing the independent variable - the time.
|
||||
* \tparam Algebra The algebra type.
|
||||
* \tparam Operations The operations type.
|
||||
* \tparam Resizer The resizer policy type.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn bulirsch_stoer_dense_out::bulirsch_stoer_dense_out( value_type eps_abs , value_type eps_rel , value_type factor_x , value_type factor_dxdt , bool control_interpolation )
|
||||
* \brief Constructs the bulirsch_stoer class, including initialization of
|
||||
* the error bounds.
|
||||
*
|
||||
* \param eps_abs Absolute tolerance level.
|
||||
* \param eps_rel Relative tolerance level.
|
||||
* \param factor_x Factor for the weight of the state.
|
||||
* \param factor_dxdt Factor for the weight of the derivative.
|
||||
* \param control_interpolation Set true to additionally control the error of
|
||||
* the interpolation.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn bulirsch_stoer_dense_out::try_step( System system , const StateIn &in , const DerivIn &dxdt , time_type &t , StateOut &out , DerivOut &dxdt_new , time_type &dt )
|
||||
* \brief Tries to perform one step.
|
||||
*
|
||||
* This method tries to do one step with step size dt. If the error estimate
|
||||
* is to large, the step is rejected and the method returns fail and the
|
||||
* step size dt is reduced. If the error estimate is acceptably small, the
|
||||
* step is performed, success is returned and dt might be increased to make
|
||||
* the steps as large as possible. This method also updates t if a step is
|
||||
* performed. Also, the internal order of the stepper is adjusted if required.
|
||||
*
|
||||
* \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.
|
||||
* \param dxdt The derivative of state.
|
||||
* \param t The value of the time. Updated if the step is successful.
|
||||
* \param out Used to store the result of the step.
|
||||
* \param dt The step size. Updated.
|
||||
* \return success if the step was accepted, fail otherwise.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn bulirsch_stoer_dense_out::initialize( const StateType &x0 , const time_type &t0 , const time_type &dt0 )
|
||||
* \brief Initializes the dense output stepper.
|
||||
*
|
||||
* \param x0 The initial state.
|
||||
* \param t0 The initial time.
|
||||
* \param dt0 The initial time step.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn bulirsch_stoer_dense_out::do_step( System system )
|
||||
* \brief Does one time step. This is the main method that should be used to
|
||||
* integrate an ODE with this stepper.
|
||||
* \note initialize has to be called before using this method to set the
|
||||
* initial conditions x,t and the stepsize.
|
||||
* \param system The system function to solve, hence the r.h.s. of the
|
||||
* ordinary differential equation. It must fulfill the Simple System concept.
|
||||
* \return Pair with start and end time of the integration step.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn bulirsch_stoer_dense_out::calc_state( time_type t , StateOut &x ) const
|
||||
* \brief Calculates the solution at an intermediate point within the last step
|
||||
* \param t The time at which the solution should be calculated, has to be
|
||||
* in the current time interval.
|
||||
* \param x The output variable where the result is written into.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn bulirsch_stoer_dense_out::current_state( void ) const
|
||||
* \brief Returns the current state of the solution.
|
||||
* \return The current state of the solution x(t).
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn bulirsch_stoer_dense_out::current_time( void ) const
|
||||
* \brief Returns the current time of the solution.
|
||||
* \return The current time of the solution t.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn bulirsch_stoer_dense_out::previous_state( void ) const
|
||||
* \brief Returns the last state of the solution.
|
||||
* \return The last state of the solution x(t-dt).
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn bulirsch_stoer_dense_out::previous_time( void ) const
|
||||
* \brief Returns the last time of the solution.
|
||||
* \return The last time of the solution t-dt.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn bulirsch_stoer_dense_out::current_time_step( void ) const
|
||||
* \brief Returns the current step size.
|
||||
* \return The current step size.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn bulirsch_stoer_dense_out::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_BULIRSCH_STOER_HPP_INCLUDED
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
Copyright Rene Rivera 2008-2015
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef BOOST_PREDEF_COMPILER_EKOPATH_H
|
||||
#define BOOST_PREDEF_COMPILER_EKOPATH_H
|
||||
|
||||
#include <boost/predef/version_number.h>
|
||||
#include <boost/predef/make.h>
|
||||
|
||||
/*`
|
||||
[heading `BOOST_COMP_PATH`]
|
||||
|
||||
[@http://en.wikipedia.org/wiki/PathScale EKOpath] compiler.
|
||||
Version number available as major, minor, and patch.
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`__PATHCC__`] [__predef_detection__]]
|
||||
|
||||
[[`__PATHCC__`, `__PATHCC_MINOR__`, `__PATHCC_PATCHLEVEL__`] [V.R.P]]
|
||||
]
|
||||
*/
|
||||
|
||||
#define BOOST_COMP_PATH BOOST_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if defined(__PATHCC__)
|
||||
# define BOOST_COMP_PATH_DETECTION \
|
||||
BOOST_VERSION_NUMBER(__PATHCC__,__PATHCC_MINOR__,__PATHCC_PATCHLEVEL__)
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_COMP_PATH_DETECTION
|
||||
# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED)
|
||||
# define BOOST_COMP_PATH_EMULATED BOOST_COMP_PATH_DETECTION
|
||||
# else
|
||||
# undef BOOST_COMP_PATH
|
||||
# define BOOST_COMP_PATH BOOST_COMP_PATH_DETECTION
|
||||
# endif
|
||||
# define BOOST_COMP_PATH_AVAILABLE
|
||||
# include <boost/predef/detail/comp_detected.h>
|
||||
#endif
|
||||
|
||||
#define BOOST_COMP_PATH_NAME "EKOpath"
|
||||
|
||||
#endif
|
||||
|
||||
#include <boost/predef/detail/test.h>
|
||||
BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_PATH,BOOST_COMP_PATH_NAME)
|
||||
|
||||
#ifdef BOOST_COMP_PATH_EMULATED
|
||||
#include <boost/predef/detail/test.h>
|
||||
BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_PATH_EMULATED,BOOST_COMP_PATH_NAME)
|
||||
#endif
|
||||
@@ -0,0 +1,19 @@
|
||||
// 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 CLASS_DETAIL_DWA200295_HPP
|
||||
# define CLASS_DETAIL_DWA200295_HPP
|
||||
|
||||
# include <boost/python/handle.hpp>
|
||||
# include <boost/python/type_id.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace objects {
|
||||
|
||||
BOOST_PYTHON_DECL type_handle registered_class_object(type_info id);
|
||||
BOOST_PYTHON_DECL type_handle class_metatype();
|
||||
BOOST_PYTHON_DECL type_handle class_type();
|
||||
|
||||
}}} // namespace boost::python::object
|
||||
|
||||
#endif // CLASS_DETAIL_DWA200295_HPP
|
||||
@@ -0,0 +1,9 @@
|
||||
0; 0; 0
|
||||
0; 0;167
|
||||
0; 79;255
|
||||
0;239;255
|
||||
0;255; 75
|
||||
95;255; 0
|
||||
255;255; 0
|
||||
255;127; 0
|
||||
255; 0; 0
|
||||
@@ -0,0 +1,30 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// 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_DETAIL_IS_BUFFER_ITERATOR_HPP
|
||||
#define BOOST_COMPUTE_DETAIL_IS_BUFFER_ITERATOR_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
namespace detail {
|
||||
|
||||
// default = false
|
||||
template<class Iterator, class Enable = void>
|
||||
struct is_buffer_iterator : public boost::false_type {};
|
||||
|
||||
} // end detail namespace
|
||||
} // end compute namespace
|
||||
} // end boost namespace
|
||||
|
||||
#endif // BOOST_COMPUTE_DETAIL_IS_BUFFER_ITERATOR_HPP
|
||||
@@ -0,0 +1,43 @@
|
||||
// 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 COPY_CONST_REFERENCE_DWA2002131_HPP
|
||||
# define COPY_CONST_REFERENCE_DWA2002131_HPP
|
||||
|
||||
# include <boost/python/detail/prefix.hpp>
|
||||
# include <boost/python/detail/indirect_traits.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/python/to_python_value.hpp>
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <class R>
|
||||
struct copy_const_reference_expects_a_const_reference_return_type
|
||||
# if defined(__GNUC__) || defined(__EDG__)
|
||||
{}
|
||||
# endif
|
||||
;
|
||||
}
|
||||
|
||||
template <class T> struct to_python_value;
|
||||
|
||||
struct copy_const_reference
|
||||
{
|
||||
template <class T>
|
||||
struct apply
|
||||
{
|
||||
typedef typename mpl::if_c<
|
||||
indirect_traits::is_reference_to_const<T>::value
|
||||
, to_python_value<T>
|
||||
, detail::copy_const_reference_expects_a_const_reference_return_type<T>
|
||||
>::type type;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
}} // namespace boost::python
|
||||
|
||||
#endif // COPY_CONST_REFERENCE_DWA2002131_HPP
|
||||
@@ -0,0 +1,32 @@
|
||||
# ifndef BOOST_PYTHON_SYNOPSIS
|
||||
# // 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)
|
||||
|
||||
# if !defined(BOOST_PP_IS_ITERATING)
|
||||
# error Boost.Python - do not include this file!
|
||||
# endif
|
||||
|
||||
# define N BOOST_PP_ITERATION()
|
||||
|
||||
# define BOOST_PYTHON_MAKE_TUPLE_ARG(z, N, ignored) \
|
||||
PyTuple_SET_ITEM( \
|
||||
result.ptr() \
|
||||
, N \
|
||||
, python::incref(python::object(a##N).ptr()) \
|
||||
);
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS_Z(1, N, class A)>
|
||||
tuple
|
||||
make_tuple(BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, A, const& a))
|
||||
{
|
||||
tuple result((detail::new_reference)::PyTuple_New(N));
|
||||
BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_MAKE_TUPLE_ARG, _)
|
||||
return result;
|
||||
}
|
||||
|
||||
# undef BOOST_PYTHON_MAKE_TUPLE_ARG
|
||||
|
||||
# undef N
|
||||
# endif // BOOST_PYTHON_SYNOPSIS
|
||||
@@ -0,0 +1,132 @@
|
||||
module ft8_decode
|
||||
|
||||
type :: ft8_decoder
|
||||
procedure(ft8_decode_callback), pointer :: callback
|
||||
contains
|
||||
procedure :: decode
|
||||
end type ft8_decoder
|
||||
|
||||
abstract interface
|
||||
subroutine ft8_decode_callback (this,sync,snr,dt,freq,decoded,nap,qual)
|
||||
import ft8_decoder
|
||||
implicit none
|
||||
class(ft8_decoder), intent(inout) :: this
|
||||
real, intent(in) :: sync
|
||||
integer, intent(in) :: snr
|
||||
real, intent(in) :: dt
|
||||
real, intent(in) :: freq
|
||||
character(len=22), intent(in) :: decoded
|
||||
integer, intent(in) :: nap
|
||||
real, intent(in) :: qual
|
||||
end subroutine ft8_decode_callback
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
subroutine decode(this,callback,iwave,nQSOProgress,nfqso,nftx,newdat, &
|
||||
nutc,nfa,nfb,nexp_decode,ndepth,nagain,lapon,napwid,mycall12, &
|
||||
mygrid6,hiscall12,hisgrid6)
|
||||
! use wavhdr
|
||||
use timer_module, only: timer
|
||||
include 'fsk4hf/ft8_params.f90'
|
||||
! type(hdr) h
|
||||
|
||||
class(ft8_decoder), intent(inout) :: this
|
||||
procedure(ft8_decode_callback) :: callback
|
||||
real s(NH1,NHSYM)
|
||||
real candidate(3,200)
|
||||
real dd(15*12000)
|
||||
logical, intent(in) :: lapon,nagain
|
||||
logical newdat,lsubtract,ldupe,bcontest
|
||||
character*12 mycall12, hiscall12
|
||||
character*6 mygrid6,hisgrid6
|
||||
integer*2 iwave(15*12000)
|
||||
integer apsym(KK)
|
||||
character datetime*13,message*22
|
||||
character*22 allmessages(100)
|
||||
integer allsnrs(100)
|
||||
save s,dd
|
||||
|
||||
bcontest=iand(nexp_decode,128).ne.0
|
||||
this%callback => callback
|
||||
write(datetime,1001) nutc !### TEMPORARY ###
|
||||
1001 format("000000_",i6.6)
|
||||
|
||||
call ft8apset(mycall12,mygrid6,hiscall12,hisgrid6,bcontest,apsym,iaptype)
|
||||
dd=iwave
|
||||
ndecodes=0
|
||||
allmessages=' '
|
||||
allsnrs=0
|
||||
ifa=nfa
|
||||
ifb=nfb
|
||||
if(nagain) then
|
||||
ifa=nfqso-10
|
||||
ifb=nfqso+10
|
||||
endif
|
||||
|
||||
! For now:
|
||||
! ndepth=1: no subtraction, 1 pass, belief propagation only
|
||||
! ndepth=2: subtraction, 2 passes, belief propagation only
|
||||
! ndepth=3: subtraction, 2 passes, bp+osd2 at and near nfqso
|
||||
if(ndepth.eq.1) npass=1
|
||||
if(ndepth.ge.2) npass=2
|
||||
do ipass=1,npass
|
||||
newdat=.true. ! Is this a problem? I hijacked newdat.
|
||||
if(ipass.eq.1) then
|
||||
lsubtract=.true.
|
||||
if(ndepth.eq.1) lsubtract=.false.
|
||||
syncmin=1.5
|
||||
else
|
||||
lsubtract=.false.
|
||||
syncmin=1.5
|
||||
endif
|
||||
call timer('sync8 ',0)
|
||||
call sync8(dd,ifa,ifb,syncmin,nfqso,s,candidate,ncand)
|
||||
call timer('sync8 ',1)
|
||||
do icand=1,ncand
|
||||
sync=candidate(3,icand)
|
||||
f1=candidate(1,icand)
|
||||
xdt=candidate(2,icand)
|
||||
nsnr0=min(99,nint(10.0*log10(sync) - 25.5)) !### empirical ###
|
||||
call timer('ft8b ',0)
|
||||
call ft8b(dd,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,napwid, &
|
||||
lsubtract,nagain,iaptype,mygrid6,bcontest,sync,f1,xdt,apsym, &
|
||||
nharderrors,dmin,nbadcrc,iappass,iera,message,xsnr)
|
||||
nsnr=nint(xsnr)
|
||||
xdt=xdt-0.5
|
||||
hd=nharderrors+dmin
|
||||
call timer('ft8b ',1)
|
||||
if(nbadcrc.eq.0) then
|
||||
! call jtmsg(message,iflag)
|
||||
if(bcontest) call fix_contest_msg(mygrid6,message)
|
||||
! if(iand(iflag,31).ne.0) message(22:22)='?'
|
||||
ldupe=.false.
|
||||
do id=1,ndecodes
|
||||
if(message.eq.allmessages(id).and.nsnr.le.allsnrs(id)) ldupe=.true.
|
||||
enddo
|
||||
if(.not.ldupe) then
|
||||
ndecodes=ndecodes+1
|
||||
allmessages(ndecodes)=message
|
||||
allsnrs(ndecodes)=nsnr
|
||||
endif
|
||||
! write(81,1004) nutc,ncand,icand,ipass,iaptype,iappass, &
|
||||
! nharderrors,dmin,hd,min(sync,999.0),nint(xsnr), &
|
||||
! xdt,nint(f1),message
|
||||
!1004 format(i6.6,2i4,3i2,i3,3f6.1,i4,f6.2,i5,2x,a22)
|
||||
! flush(81)
|
||||
if(.not.ldupe .and. associated(this%callback)) then
|
||||
qual=1.0-(nharderrors+dmin)/60.0 ! scale qual to [0.0,1.0]
|
||||
call this%callback(sync,nsnr,xdt,f1,message,iaptype,qual)
|
||||
endif
|
||||
endif
|
||||
enddo
|
||||
! h=default_header(12000,NMAX)
|
||||
! open(10,file='subtract.wav',status='unknown',access='stream')
|
||||
! iwave=nint(dd)
|
||||
! write(10) h,iwave
|
||||
! close(10)
|
||||
enddo
|
||||
return
|
||||
end subroutine decode
|
||||
|
||||
end module ft8_decode
|
||||
@@ -0,0 +1,82 @@
|
||||
#include "MetaDataRegistry.hpp"
|
||||
|
||||
#include <QMetaType>
|
||||
#include <QItemEditorFactory>
|
||||
#include <QStandardItemEditorCreator>
|
||||
|
||||
#include "Radio.hpp"
|
||||
#include "FrequencyList.hpp"
|
||||
#include "AudioDevice.hpp"
|
||||
#include "Configuration.hpp"
|
||||
#include "StationList.hpp"
|
||||
#include "Transceiver.hpp"
|
||||
#include "TransceiverFactory.hpp"
|
||||
#include "WFPalette.hpp"
|
||||
|
||||
#include "FrequencyLineEdit.hpp"
|
||||
|
||||
QItemEditorFactory * item_editor_factory ()
|
||||
{
|
||||
static QItemEditorFactory * our_item_editor_factory = new QItemEditorFactory;
|
||||
return our_item_editor_factory;
|
||||
}
|
||||
|
||||
void register_types ()
|
||||
{
|
||||
// types in Radio.hpp are registered in their own translation unit
|
||||
// as they are needed in the wsjtx_udp shared library too
|
||||
|
||||
// we still have to register the fully qualified names of enum types
|
||||
// used as signal/slot connection arguments since the new Qt 5.5
|
||||
// Q_ENUM macro only seems to register the unqualified name
|
||||
|
||||
item_editor_factory ()->registerEditor (qMetaTypeId<Radio::Frequency> (), new QStandardItemEditorCreator<FrequencyLineEdit> ());
|
||||
//auto frequency_delta_type_id = qRegisterMetaType<Radio::FrequencyDelta> ("FrequencyDelta");
|
||||
item_editor_factory ()->registerEditor (qMetaTypeId<Radio::FrequencyDelta> (), new QStandardItemEditorCreator<FrequencyDeltaLineEdit> ());
|
||||
|
||||
// Frequency list model
|
||||
qRegisterMetaType<FrequencyList::Item> ("Item");
|
||||
qRegisterMetaTypeStreamOperators<FrequencyList::Item> ("Item");
|
||||
qRegisterMetaType<FrequencyList::FrequencyItems> ("FrequencyItems");
|
||||
qRegisterMetaTypeStreamOperators<FrequencyList::FrequencyItems> ("FrequencyItems");
|
||||
|
||||
// Audio device
|
||||
qRegisterMetaType<AudioDevice::Channel> ("AudioDevice::Channel");
|
||||
|
||||
// Configuration
|
||||
#if QT_VERSION < 0x050500
|
||||
qRegisterMetaType<Configuration::DataMode> ("Configuration::DataMode");
|
||||
qRegisterMetaType<Configuration::Type2MsgGen> ("Configuration::Type2MsgGen");
|
||||
#endif
|
||||
qRegisterMetaTypeStreamOperators<Configuration::DataMode> ("Configuration::DataMode");
|
||||
qRegisterMetaTypeStreamOperators<Configuration::Type2MsgGen> ("Configuration::Type2MsgGen");
|
||||
|
||||
// Station details
|
||||
qRegisterMetaType<StationList::Station> ("Station");
|
||||
qRegisterMetaType<StationList::Stations> ("Stations");
|
||||
qRegisterMetaTypeStreamOperators<StationList::Station> ("Station");
|
||||
qRegisterMetaTypeStreamOperators<StationList::Stations> ("Stations");
|
||||
|
||||
// Transceiver
|
||||
qRegisterMetaType<Transceiver::TransceiverState> ("Transceiver::TransceiverState");
|
||||
qRegisterMetaType<Transceiver::MODE> ("Transceiver::MODE");
|
||||
|
||||
// Transceiver factory
|
||||
#if QT_VERSION < 0x050500
|
||||
qRegisterMetaType<TransceiverFactory::DataBits> ("TransceiverFactory::DataBits");
|
||||
qRegisterMetaType<TransceiverFactory::StopBits> ("TransceiverFactory::StopBits");
|
||||
qRegisterMetaType<TransceiverFactory::Handshake> ("TransceiverFactory::Handshake");
|
||||
qRegisterMetaType<TransceiverFactory::PTTMethod> ("TransceiverFactory::PTTMethod");
|
||||
qRegisterMetaType<TransceiverFactory::TXAudioSource> ("TransceiverFactory::TXAudioSource");
|
||||
qRegisterMetaType<TransceiverFactory::SplitMode> ("TransceiverFactory::SplitMode");
|
||||
#endif
|
||||
qRegisterMetaTypeStreamOperators<TransceiverFactory::DataBits> ("TransceiverFactory::DataBits");
|
||||
qRegisterMetaTypeStreamOperators<TransceiverFactory::StopBits> ("TransceiverFactory::StopBits");
|
||||
qRegisterMetaTypeStreamOperators<TransceiverFactory::Handshake> ("TransceiverFactory::Handshake");
|
||||
qRegisterMetaTypeStreamOperators<TransceiverFactory::PTTMethod> ("TransceiverFactory::PTTMethod");
|
||||
qRegisterMetaTypeStreamOperators<TransceiverFactory::TXAudioSource> ("TransceiverFactory::TXAudioSource");
|
||||
qRegisterMetaTypeStreamOperators<TransceiverFactory::SplitMode> ("TransceiverFactory::SplitMode");
|
||||
|
||||
// Waterfall palette
|
||||
qRegisterMetaTypeStreamOperators<WFPalette::Colours> ("Colours");
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
[auto_generated]
|
||||
boost/numeric/odeint/external/vexcl/vexcl_norm_inf.hpp
|
||||
|
||||
[begin_description]
|
||||
vector_space_norm_inf specialization for vexcl
|
||||
[end_description]
|
||||
|
||||
Copyright 2009-2013 Karsten Ahnert
|
||||
Copyright 2009-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_EXTERNAL_VEXCL_VEXCL_NORM_INF_HPP_DEFINED
|
||||
#define BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_NORM_INF_HPP_DEFINED
|
||||
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
|
||||
#include <vexcl/vector.hpp>
|
||||
#include <vexcl/multivector.hpp>
|
||||
#include <vexcl/reductor.hpp>
|
||||
|
||||
#include <boost/numeric/odeint/algebra/vector_space_algebra.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace odeint {
|
||||
|
||||
// specialization for vexcl vector
|
||||
template <typename T>
|
||||
struct vector_space_norm_inf< vex::vector<T> > {
|
||||
typedef T result_type;
|
||||
|
||||
T operator()( const vex::vector<T> &x ) const {
|
||||
const auto &max = vex::get_reductor<T, vex::MAX>(x.queue_list());
|
||||
|
||||
return max( fabs(x) );
|
||||
}
|
||||
};
|
||||
|
||||
// specialization for vexcl multivector
|
||||
template <typename T, size_t N>
|
||||
struct vector_space_norm_inf< vex::multivector<T, N> > {
|
||||
typedef T result_type;
|
||||
|
||||
T operator()( const vex::multivector<T, N> &x ) const {
|
||||
const auto &max = vex::get_reductor<T, vex::MAX>(x.queue_list());
|
||||
|
||||
// Reducing a multivector results in std::array<T, N>:
|
||||
auto m = max( fabs(x) );
|
||||
|
||||
// We will need to reduce it even further:
|
||||
return *std::max_element(m.begin(), m.end());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
} // namespace odeint
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
|
||||
#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_NORM_INF_HPP_DEFINED
|
||||
@@ -0,0 +1,211 @@
|
||||
// Copyright John Maddock 2007.
|
||||
// Copyright Paul A. Bristow 2007.
|
||||
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_STATS_FIND_SCALE_HPP
|
||||
#define BOOST_STATS_FIND_SCALE_HPP
|
||||
|
||||
#include <boost/math/distributions/fwd.hpp> // for all distribution signatures.
|
||||
#include <boost/math/distributions/complement.hpp>
|
||||
#include <boost/math/policies/policy.hpp>
|
||||
// using boost::math::policies::policy;
|
||||
#include <boost/math/tools/traits.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/math/special_functions/fpclassify.hpp>
|
||||
#include <boost/math/policies/error_handling.hpp>
|
||||
// using boost::math::complement; // will be needed by users who want complement,
|
||||
// but NOT placed here to avoid putting it in global scope.
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace math
|
||||
{
|
||||
// Function to find location of random variable z
|
||||
// to give probability p (given scale)
|
||||
// Applies to normal, lognormal, extreme value, Cauchy, (and symmetrical triangular),
|
||||
// distributions that have scale.
|
||||
// BOOST_STATIC_ASSERTs, see below, are used to enforce this.
|
||||
|
||||
template <class Dist, class Policy>
|
||||
inline
|
||||
typename Dist::value_type find_scale( // For example, normal mean.
|
||||
typename Dist::value_type z, // location of random variable z to give probability, P(X > z) == p.
|
||||
// For example, a nominal minimum acceptable weight z, so that p * 100 % are > z
|
||||
typename Dist::value_type p, // probability value desired at x, say 0.95 for 95% > z.
|
||||
typename Dist::value_type location, // location parameter, for example, normal distribution mean.
|
||||
const Policy& pol
|
||||
)
|
||||
{
|
||||
#if !defined(BOOST_NO_SFINAE) && !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
|
||||
BOOST_STATIC_ASSERT(::boost::math::tools::is_distribution<Dist>::value);
|
||||
BOOST_STATIC_ASSERT(::boost::math::tools::is_scaled_distribution<Dist>::value);
|
||||
#endif
|
||||
static const char* function = "boost::math::find_scale<Dist, Policy>(%1%, %1%, %1%, Policy)";
|
||||
|
||||
if(!(boost::math::isfinite)(p) || (p < 0) || (p > 1))
|
||||
{
|
||||
return policies::raise_domain_error<typename Dist::value_type>(
|
||||
function, "Probability parameter was %1%, but must be >= 0 and <= 1!", p, pol);
|
||||
}
|
||||
if(!(boost::math::isfinite)(z))
|
||||
{
|
||||
return policies::raise_domain_error<typename Dist::value_type>(
|
||||
function, "find_scale z parameter was %1%, but must be finite!", z, pol);
|
||||
}
|
||||
if(!(boost::math::isfinite)(location))
|
||||
{
|
||||
return policies::raise_domain_error<typename Dist::value_type>(
|
||||
function, "find_scale location parameter was %1%, but must be finite!", location, pol);
|
||||
}
|
||||
|
||||
//cout << "z " << z << ", p " << p << ", quantile(Dist(), p) "
|
||||
//<< quantile(Dist(), p) << ", z - mean " << z - location
|
||||
//<<", sd " << (z - location) / quantile(Dist(), p) << endl;
|
||||
|
||||
//quantile(N01, 0.001) -3.09023
|
||||
//quantile(N01, 0.01) -2.32635
|
||||
//quantile(N01, 0.05) -1.64485
|
||||
//quantile(N01, 0.333333) -0.430728
|
||||
//quantile(N01, 0.5) 0
|
||||
//quantile(N01, 0.666667) 0.430728
|
||||
//quantile(N01, 0.9) 1.28155
|
||||
//quantile(N01, 0.95) 1.64485
|
||||
//quantile(N01, 0.99) 2.32635
|
||||
//quantile(N01, 0.999) 3.09023
|
||||
|
||||
typename Dist::value_type result =
|
||||
(z - location) // difference between desired x and current location.
|
||||
/ quantile(Dist(), p); // standard distribution.
|
||||
|
||||
if (result <= 0)
|
||||
{ // If policy isn't to throw, return the scale <= 0.
|
||||
policies::raise_evaluation_error<typename Dist::value_type>(function,
|
||||
"Computed scale (%1%) is <= 0!" " Was the complement intended?",
|
||||
result, Policy());
|
||||
}
|
||||
return result;
|
||||
} // template <class Dist, class Policy> find_scale
|
||||
|
||||
template <class Dist>
|
||||
inline // with default policy.
|
||||
typename Dist::value_type find_scale( // For example, normal mean.
|
||||
typename Dist::value_type z, // location of random variable z to give probability, P(X > z) == p.
|
||||
// For example, a nominal minimum acceptable z, so that p * 100 % are > z
|
||||
typename Dist::value_type p, // probability value desired at x, say 0.95 for 95% > z.
|
||||
typename Dist::value_type location) // location parameter, for example, mean.
|
||||
{ // Forward to find_scale using the default policy.
|
||||
return (find_scale<Dist>(z, p, location, policies::policy<>()));
|
||||
} // find_scale
|
||||
|
||||
template <class Dist, class Real1, class Real2, class Real3, class Policy>
|
||||
inline typename Dist::value_type find_scale(
|
||||
complemented4_type<Real1, Real2, Real3, Policy> const& c)
|
||||
{
|
||||
//cout << "cparam1 q " << c.param1 // q
|
||||
// << ", c.dist z " << c.dist // z
|
||||
// << ", c.param2 l " << c.param2 // l
|
||||
// << ", quantile (Dist(), c.param1 = q) "
|
||||
// << quantile(Dist(), c.param1) //q
|
||||
// << endl;
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE) && !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
|
||||
BOOST_STATIC_ASSERT(::boost::math::tools::is_distribution<Dist>::value);
|
||||
BOOST_STATIC_ASSERT(::boost::math::tools::is_scaled_distribution<Dist>::value);
|
||||
#endif
|
||||
static const char* function = "boost::math::find_scale<Dist, Policy>(complement(%1%, %1%, %1%, Policy))";
|
||||
|
||||
// Checks on arguments, as not complemented version,
|
||||
// Explicit policy.
|
||||
typename Dist::value_type q = c.param1;
|
||||
if(!(boost::math::isfinite)(q) || (q < 0) || (q > 1))
|
||||
{
|
||||
return policies::raise_domain_error<typename Dist::value_type>(
|
||||
function, "Probability parameter was %1%, but must be >= 0 and <= 1!", q, c.param3);
|
||||
}
|
||||
typename Dist::value_type z = c.dist;
|
||||
if(!(boost::math::isfinite)(z))
|
||||
{
|
||||
return policies::raise_domain_error<typename Dist::value_type>(
|
||||
function, "find_scale z parameter was %1%, but must be finite!", z, c.param3);
|
||||
}
|
||||
typename Dist::value_type location = c.param2;
|
||||
if(!(boost::math::isfinite)(location))
|
||||
{
|
||||
return policies::raise_domain_error<typename Dist::value_type>(
|
||||
function, "find_scale location parameter was %1%, but must be finite!", location, c.param3);
|
||||
}
|
||||
|
||||
typename Dist::value_type result =
|
||||
(c.dist - c.param2) // difference between desired x and current location.
|
||||
/ quantile(complement(Dist(), c.param1));
|
||||
// ( z - location) / (quantile(complement(Dist(), q))
|
||||
if (result <= 0)
|
||||
{ // If policy isn't to throw, return the scale <= 0.
|
||||
policies::raise_evaluation_error<typename Dist::value_type>(function,
|
||||
"Computed scale (%1%) is <= 0!" " Was the complement intended?",
|
||||
result, Policy());
|
||||
}
|
||||
return result;
|
||||
} // template <class Dist, class Policy, class Real1, class Real2, class Real3> typename Dist::value_type find_scale
|
||||
|
||||
// So the user can start from the complement q = (1 - p) of the probability p,
|
||||
// for example, s = find_scale<normal>(complement(z, q, l));
|
||||
|
||||
template <class Dist, class Real1, class Real2, class Real3>
|
||||
inline typename Dist::value_type find_scale(
|
||||
complemented3_type<Real1, Real2, Real3> const& c)
|
||||
{
|
||||
//cout << "cparam1 q " << c.param1 // q
|
||||
// << ", c.dist z " << c.dist // z
|
||||
// << ", c.param2 l " << c.param2 // l
|
||||
// << ", quantile (Dist(), c.param1 = q) "
|
||||
// << quantile(Dist(), c.param1) //q
|
||||
// << endl;
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE) && !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
|
||||
BOOST_STATIC_ASSERT(::boost::math::tools::is_distribution<Dist>::value);
|
||||
BOOST_STATIC_ASSERT(::boost::math::tools::is_scaled_distribution<Dist>::value);
|
||||
#endif
|
||||
static const char* function = "boost::math::find_scale<Dist, Policy>(complement(%1%, %1%, %1%, Policy))";
|
||||
|
||||
// Checks on arguments, as not complemented version,
|
||||
// default policy policies::policy<>().
|
||||
typename Dist::value_type q = c.param1;
|
||||
if(!(boost::math::isfinite)(q) || (q < 0) || (q > 1))
|
||||
{
|
||||
return policies::raise_domain_error<typename Dist::value_type>(
|
||||
function, "Probability parameter was %1%, but must be >= 0 and <= 1!", q, policies::policy<>());
|
||||
}
|
||||
typename Dist::value_type z = c.dist;
|
||||
if(!(boost::math::isfinite)(z))
|
||||
{
|
||||
return policies::raise_domain_error<typename Dist::value_type>(
|
||||
function, "find_scale z parameter was %1%, but must be finite!", z, policies::policy<>());
|
||||
}
|
||||
typename Dist::value_type location = c.param2;
|
||||
if(!(boost::math::isfinite)(location))
|
||||
{
|
||||
return policies::raise_domain_error<typename Dist::value_type>(
|
||||
function, "find_scale location parameter was %1%, but must be finite!", location, policies::policy<>());
|
||||
}
|
||||
|
||||
typename Dist::value_type result =
|
||||
(z - location) // difference between desired x and current location.
|
||||
/ quantile(complement(Dist(), q));
|
||||
// ( z - location) / (quantile(complement(Dist(), q))
|
||||
if (result <= 0)
|
||||
{ // If policy isn't to throw, return the scale <= 0.
|
||||
policies::raise_evaluation_error<typename Dist::value_type>(function,
|
||||
"Computed scale (%1%) is <= 0!" " Was the complement intended?",
|
||||
result, policies::policy<>()); // This is only the default policy - also Want a version with Policy here.
|
||||
}
|
||||
return result;
|
||||
} // template <class Dist, class Real1, class Real2, class Real3> typename Dist::value_type find_scale
|
||||
|
||||
} // namespace boost
|
||||
} // namespace math
|
||||
|
||||
#endif // BOOST_STATS_FIND_SCALE_HPP
|
||||
@@ -0,0 +1,62 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2013 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_MAP_DETAIL_AT_KEY_IMPL_02042013_0821)
|
||||
#define BOOST_FUSION_MAP_DETAIL_AT_KEY_IMPL_02042013_0821
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/support/detail/access.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/mpl/at.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/utility/declval.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct map_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct at_key_impl;
|
||||
|
||||
template <>
|
||||
struct at_key_impl<map_tag>
|
||||
{
|
||||
template <typename Sequence, typename Key>
|
||||
struct apply
|
||||
{
|
||||
typedef
|
||||
decltype(boost::declval<Sequence>().get(mpl::identity<Key>()))
|
||||
type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type
|
||||
call(Sequence& m)
|
||||
{
|
||||
return m.get(mpl::identity<Key>());
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Sequence, typename Key>
|
||||
struct apply<Sequence const, Key>
|
||||
{
|
||||
typedef
|
||||
decltype(boost::declval<Sequence const>().get(mpl::identity<Key>()))
|
||||
type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type
|
||||
call(Sequence const& m)
|
||||
{
|
||||
return m.get(mpl::identity<Key>());
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,81 @@
|
||||
#ifndef IARU_REGIONS_HPP__
|
||||
#define IARU_REGIONS_HPP__
|
||||
|
||||
#include <QAbstractListModel>
|
||||
|
||||
#include "qt_helpers.hpp"
|
||||
|
||||
class QString;
|
||||
class QVariant;
|
||||
class QModelIndex;
|
||||
|
||||
//
|
||||
// Class IARURegions - Qt model that implements the list of IARU regions
|
||||
//
|
||||
//
|
||||
// Responsibilities
|
||||
//
|
||||
// Provides a single column list model that contains the human
|
||||
// readable string version of the data region in the display
|
||||
// role. Also provided is a translatable column header string and
|
||||
// tool tip string.
|
||||
//
|
||||
//
|
||||
// Collaborations
|
||||
//
|
||||
// Implements a concrete sub-class of the QAbstractListModel class.
|
||||
//
|
||||
class IARURegions final
|
||||
: public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_ENUMS (Region)
|
||||
|
||||
public:
|
||||
//
|
||||
// This enumeration contains the supported regions, to complement
|
||||
// this an array of human readable strings in the implementation
|
||||
// (IARURegions.cpp) must be maintained in parallel.
|
||||
//
|
||||
enum Region
|
||||
{
|
||||
ALL, // matches with all regions
|
||||
R1,
|
||||
R2,
|
||||
R3,
|
||||
REGIONS_END_SENTINAL_AND_COUNT // this must be last
|
||||
};
|
||||
Q_ENUM (Region)
|
||||
|
||||
explicit IARURegions (QObject * parent = nullptr);
|
||||
|
||||
// translate between enumeration and human readable strings
|
||||
static char const * name (Region);
|
||||
static Region value (QString const&);
|
||||
|
||||
// Implement the QAbstractListModel interface
|
||||
int rowCount (QModelIndex const& parent = QModelIndex {}) const override
|
||||
{
|
||||
return parent.isValid () ? 0 : REGIONS_END_SENTINAL_AND_COUNT; // Number of regionss in Region enumeration class
|
||||
}
|
||||
QVariant data (QModelIndex const&, int role = Qt::DisplayRole) const override;
|
||||
QVariant headerData (int section, Qt::Orientation, int = Qt::DisplayRole) const override;
|
||||
};
|
||||
|
||||
// Qt boilerplate to make the IARURegions::region enumeration a type
|
||||
// that can be streamed and queued as a signal argument as well as
|
||||
// showing the human readable string when output to debug streams.
|
||||
#if QT_VERSION < 0x050500
|
||||
// Qt 5.6 introduces the Q_ENUM macro which automatically registers
|
||||
// the meta-type
|
||||
Q_DECLARE_METATYPE (IARURegions::Region);
|
||||
#endif
|
||||
|
||||
#if !defined (QT_NO_DEBUG_STREAM)
|
||||
ENUM_QDEBUG_OPS_DECL (IARURegions, Region);
|
||||
#endif
|
||||
|
||||
ENUM_QDATASTREAM_OPS_DECL (IARURegions, Region);
|
||||
ENUM_CONVERSION_OPS_DECL (IARURegions, Region);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user