Initial Commit
This commit is contained in:
@@ -0,0 +1,406 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
// See http://boostorg.github.com/compute for more information.
|
||||
//---------------------------------------------------------------------------//
|
||||
|
||||
#ifndef BOOST_COMPUTE_CONTAINER_FLAT_MAP_HPP
|
||||
#define BOOST_COMPUTE_CONTAINER_FLAT_MAP_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <utility>
|
||||
#include <exception>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
#include <boost/compute/exception.hpp>
|
||||
#include <boost/compute/algorithm/find.hpp>
|
||||
#include <boost/compute/algorithm/lower_bound.hpp>
|
||||
#include <boost/compute/algorithm/upper_bound.hpp>
|
||||
#include <boost/compute/container/vector.hpp>
|
||||
#include <boost/compute/functional/get.hpp>
|
||||
#include <boost/compute/iterator/transform_iterator.hpp>
|
||||
#include <boost/compute/types/pair.hpp>
|
||||
#include <boost/compute/detail/buffer_value.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
|
||||
template<class Key, class T>
|
||||
class flat_map
|
||||
{
|
||||
public:
|
||||
typedef Key key_type;
|
||||
typedef T mapped_type;
|
||||
typedef typename ::boost::compute::vector<std::pair<Key, T> > vector_type;
|
||||
typedef typename vector_type::value_type value_type;
|
||||
typedef typename vector_type::size_type size_type;
|
||||
typedef typename vector_type::difference_type difference_type;
|
||||
typedef typename vector_type::reference reference;
|
||||
typedef typename vector_type::const_reference const_reference;
|
||||
typedef typename vector_type::pointer pointer;
|
||||
typedef typename vector_type::const_pointer const_pointer;
|
||||
typedef typename vector_type::iterator iterator;
|
||||
typedef typename vector_type::const_iterator const_iterator;
|
||||
typedef typename vector_type::reverse_iterator reverse_iterator;
|
||||
typedef typename vector_type::const_reverse_iterator const_reverse_iterator;
|
||||
|
||||
explicit flat_map(const context &context = system::default_context())
|
||||
: m_vector(context)
|
||||
{
|
||||
}
|
||||
|
||||
flat_map(const flat_map<Key, T> &other)
|
||||
: m_vector(other.m_vector)
|
||||
{
|
||||
}
|
||||
|
||||
flat_map<Key, T>& operator=(const flat_map<Key, T> &other)
|
||||
{
|
||||
if(this != &other){
|
||||
m_vector = other.m_vector;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
~flat_map()
|
||||
{
|
||||
}
|
||||
|
||||
iterator begin()
|
||||
{
|
||||
return m_vector.begin();
|
||||
}
|
||||
|
||||
const_iterator begin() const
|
||||
{
|
||||
return m_vector.begin();
|
||||
}
|
||||
|
||||
const_iterator cbegin() const
|
||||
{
|
||||
return m_vector.cbegin();
|
||||
}
|
||||
|
||||
iterator end()
|
||||
{
|
||||
return m_vector.end();
|
||||
}
|
||||
|
||||
const_iterator end() const
|
||||
{
|
||||
return m_vector.end();
|
||||
}
|
||||
|
||||
const_iterator cend() const
|
||||
{
|
||||
return m_vector.cend();
|
||||
}
|
||||
|
||||
reverse_iterator rbegin()
|
||||
{
|
||||
return m_vector.rbegin();
|
||||
}
|
||||
|
||||
const_reverse_iterator rbegin() const
|
||||
{
|
||||
return m_vector.rbegin();
|
||||
}
|
||||
|
||||
const_reverse_iterator crbegin() const
|
||||
{
|
||||
return m_vector.crbegin();
|
||||
}
|
||||
|
||||
reverse_iterator rend()
|
||||
{
|
||||
return m_vector.rend();
|
||||
}
|
||||
|
||||
const_reverse_iterator rend() const
|
||||
{
|
||||
return m_vector.rend();
|
||||
}
|
||||
|
||||
const_reverse_iterator crend() const
|
||||
{
|
||||
return m_vector.crend();
|
||||
}
|
||||
|
||||
size_type size() const
|
||||
{
|
||||
return m_vector.size();
|
||||
}
|
||||
|
||||
size_type max_size() const
|
||||
{
|
||||
return m_vector.max_size();
|
||||
}
|
||||
|
||||
bool empty() const
|
||||
{
|
||||
return m_vector.empty();
|
||||
}
|
||||
|
||||
size_type capacity() const
|
||||
{
|
||||
return m_vector.capacity();
|
||||
}
|
||||
|
||||
void reserve(size_type size, command_queue &queue)
|
||||
{
|
||||
m_vector.reserve(size, queue);
|
||||
}
|
||||
|
||||
void reserve(size_type size)
|
||||
{
|
||||
command_queue queue = m_vector.default_queue();
|
||||
reserve(size, queue);
|
||||
queue.finish();
|
||||
}
|
||||
|
||||
void shrink_to_fit()
|
||||
{
|
||||
m_vector.shrink_to_fit();
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
m_vector.clear();
|
||||
}
|
||||
|
||||
std::pair<iterator, bool>
|
||||
insert(const value_type &value, command_queue &queue)
|
||||
{
|
||||
iterator location = upper_bound(value.first, queue);
|
||||
|
||||
if(location != begin()){
|
||||
value_type current_value;
|
||||
::boost::compute::copy_n(location - 1, 1, ¤t_value, queue);
|
||||
if(value.first == current_value.first){
|
||||
return std::make_pair(location - 1, false);
|
||||
}
|
||||
}
|
||||
|
||||
m_vector.insert(location, value);
|
||||
return std::make_pair(location, true);
|
||||
}
|
||||
|
||||
std::pair<iterator, bool> insert(const value_type &value)
|
||||
{
|
||||
command_queue queue = m_vector.default_queue();
|
||||
std::pair<iterator, bool> result = insert(value, queue);
|
||||
queue.finish();
|
||||
return result;
|
||||
}
|
||||
|
||||
iterator erase(const const_iterator &position, command_queue &queue)
|
||||
{
|
||||
return erase(position, position + 1, queue);
|
||||
}
|
||||
|
||||
iterator erase(const const_iterator &position)
|
||||
{
|
||||
command_queue queue = m_vector.default_queue();
|
||||
iterator iter = erase(position, queue);
|
||||
queue.finish();
|
||||
return iter;
|
||||
}
|
||||
|
||||
iterator erase(const const_iterator &first,
|
||||
const const_iterator &last,
|
||||
command_queue &queue)
|
||||
{
|
||||
return m_vector.erase(first, last, queue);
|
||||
}
|
||||
|
||||
iterator erase(const const_iterator &first, const const_iterator &last)
|
||||
{
|
||||
command_queue queue = m_vector.default_queue();
|
||||
iterator iter = erase(first, last, queue);
|
||||
queue.finish();
|
||||
return iter;
|
||||
}
|
||||
|
||||
size_type erase(const key_type &value, command_queue &queue)
|
||||
{
|
||||
iterator position = find(value, queue);
|
||||
|
||||
if(position == end()){
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
erase(position, queue);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
iterator find(const key_type &value, command_queue &queue)
|
||||
{
|
||||
::boost::compute::get<0> get_key;
|
||||
|
||||
return ::boost::compute::find(
|
||||
::boost::compute::make_transform_iterator(begin(), get_key),
|
||||
::boost::compute::make_transform_iterator(end(), get_key),
|
||||
value,
|
||||
queue
|
||||
).base();
|
||||
}
|
||||
|
||||
iterator find(const key_type &value)
|
||||
{
|
||||
command_queue queue = m_vector.default_queue();
|
||||
iterator iter = find(value, queue);
|
||||
queue.finish();
|
||||
return iter;
|
||||
}
|
||||
|
||||
const_iterator find(const key_type &value, command_queue &queue) const
|
||||
{
|
||||
::boost::compute::get<0> get_key;
|
||||
|
||||
return ::boost::compute::find(
|
||||
::boost::compute::make_transform_iterator(begin(), get_key),
|
||||
::boost::compute::make_transform_iterator(end(), get_key),
|
||||
value,
|
||||
queue
|
||||
).base();
|
||||
}
|
||||
|
||||
const_iterator find(const key_type &value) const
|
||||
{
|
||||
command_queue queue = m_vector.default_queue();
|
||||
const_iterator iter = find(value, queue);
|
||||
queue.finish();
|
||||
return iter;
|
||||
}
|
||||
|
||||
size_type count(const key_type &value, command_queue &queue) const
|
||||
{
|
||||
return find(value, queue) != end() ? 1 : 0;
|
||||
}
|
||||
|
||||
size_type count(const key_type &value) const
|
||||
{
|
||||
command_queue queue = m_vector.default_queue();
|
||||
size_type result = count(value, queue);
|
||||
queue.finish();
|
||||
return result;
|
||||
}
|
||||
|
||||
iterator lower_bound(const key_type &value, command_queue &queue)
|
||||
{
|
||||
::boost::compute::get<0> get_key;
|
||||
|
||||
return ::boost::compute::lower_bound(
|
||||
::boost::compute::make_transform_iterator(begin(), get_key),
|
||||
::boost::compute::make_transform_iterator(end(), get_key),
|
||||
value,
|
||||
queue
|
||||
).base();
|
||||
}
|
||||
|
||||
iterator lower_bound(const key_type &value)
|
||||
{
|
||||
command_queue queue = m_vector.default_queue();
|
||||
iterator iter = lower_bound(value, queue);
|
||||
queue.finish();
|
||||
return iter;
|
||||
}
|
||||
|
||||
const_iterator lower_bound(const key_type &value, command_queue &queue) const
|
||||
{
|
||||
::boost::compute::get<0> get_key;
|
||||
|
||||
return ::boost::compute::lower_bound(
|
||||
::boost::compute::make_transform_iterator(begin(), get_key),
|
||||
::boost::compute::make_transform_iterator(end(), get_key),
|
||||
value,
|
||||
queue
|
||||
).base();
|
||||
}
|
||||
|
||||
const_iterator lower_bound(const key_type &value) const
|
||||
{
|
||||
command_queue queue = m_vector.default_queue();
|
||||
const_iterator iter = lower_bound(value, queue);
|
||||
queue.finish();
|
||||
return iter;
|
||||
}
|
||||
|
||||
iterator upper_bound(const key_type &value, command_queue &queue)
|
||||
{
|
||||
::boost::compute::get<0> get_key;
|
||||
|
||||
return ::boost::compute::upper_bound(
|
||||
::boost::compute::make_transform_iterator(begin(), get_key),
|
||||
::boost::compute::make_transform_iterator(end(), get_key),
|
||||
value,
|
||||
queue
|
||||
).base();
|
||||
}
|
||||
|
||||
iterator upper_bound(const key_type &value)
|
||||
{
|
||||
command_queue queue = m_vector.default_queue();
|
||||
iterator iter = upper_bound(value, queue);
|
||||
queue.finish();
|
||||
return iter;
|
||||
}
|
||||
|
||||
const_iterator upper_bound(const key_type &value, command_queue &queue) const
|
||||
{
|
||||
::boost::compute::get<0> get_key;
|
||||
|
||||
return ::boost::compute::upper_bound(
|
||||
::boost::compute::make_transform_iterator(begin(), get_key),
|
||||
::boost::compute::make_transform_iterator(end(), get_key),
|
||||
value,
|
||||
queue
|
||||
).base();
|
||||
}
|
||||
|
||||
const_iterator upper_bound(const key_type &value) const
|
||||
{
|
||||
command_queue queue = m_vector.default_queue();
|
||||
const_iterator iter = upper_bound(value, queue);
|
||||
queue.finish();
|
||||
return iter;
|
||||
}
|
||||
|
||||
const mapped_type at(const key_type &key) const
|
||||
{
|
||||
const_iterator iter = find(key);
|
||||
if(iter == end()){
|
||||
BOOST_THROW_EXCEPTION(std::out_of_range("key not found"));
|
||||
}
|
||||
|
||||
return value_type(*iter).second;
|
||||
}
|
||||
|
||||
detail::buffer_value<mapped_type> operator[](const key_type &key)
|
||||
{
|
||||
iterator iter = find(key);
|
||||
if(iter == end()){
|
||||
iter = insert(std::make_pair(key, mapped_type())).first;
|
||||
}
|
||||
|
||||
size_t index = iter.get_index() * sizeof(value_type) + sizeof(key_type);
|
||||
|
||||
return detail::buffer_value<mapped_type>(m_vector.get_buffer(), index);
|
||||
}
|
||||
|
||||
private:
|
||||
::boost::compute::vector<std::pair<Key, T> > m_vector;
|
||||
};
|
||||
|
||||
} // end compute namespace
|
||||
} // end boost namespace
|
||||
|
||||
#endif // BOOST_COMPUTE_CONTAINER_FLAT_MAP_HPP
|
||||
@@ -0,0 +1,169 @@
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// xml_woarchive_impl.ipp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#ifndef BOOST_NO_STD_WSTREAMBUF
|
||||
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <algorithm> // std::copy
|
||||
#include <locale>
|
||||
#include <exception>
|
||||
|
||||
#include <cstring> // strlen
|
||||
#include <cstdlib> // mbtowc
|
||||
#include <cwchar> // wcslen
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::strlen;
|
||||
#if ! defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
||||
using ::mbtowc;
|
||||
using ::wcslen;
|
||||
#endif
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/archive/xml_woarchive.hpp>
|
||||
#include <boost/archive/detail/utf8_codecvt_facet.hpp>
|
||||
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
|
||||
#include <boost/archive/iterators/xml_escape.hpp>
|
||||
#include <boost/archive/iterators/wchar_from_mb.hpp>
|
||||
#include <boost/archive/iterators/ostream_iterator.hpp>
|
||||
#include <boost/archive/iterators/dataflow_exception.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// implemenations of functions specific to wide char archives
|
||||
|
||||
// copy chars to output escaping to xml and widening characters as we go
|
||||
template<class InputIterator>
|
||||
void save_iterator(std::wostream &os, InputIterator begin, InputIterator end){
|
||||
typedef iterators::wchar_from_mb<
|
||||
iterators::xml_escape<InputIterator>
|
||||
> xmbtows;
|
||||
std::copy(
|
||||
xmbtows(begin),
|
||||
xmbtows(end),
|
||||
boost::archive::iterators::ostream_iterator<wchar_t>(os)
|
||||
);
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL void
|
||||
xml_woarchive_impl<Archive>::save(const std::string & s){
|
||||
// note: we don't use s.begin() and s.end() because dinkumware
|
||||
// doesn't have string::value_type defined. So use a wrapper
|
||||
// around these values to implement the definitions.
|
||||
const char * begin = s.data();
|
||||
const char * end = begin + s.size();
|
||||
save_iterator(os, begin, end);
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL void
|
||||
xml_woarchive_impl<Archive>::save(const std::wstring & ws){
|
||||
#if 0
|
||||
typedef iterators::xml_escape<std::wstring::const_iterator> xmbtows;
|
||||
std::copy(
|
||||
xmbtows(ws.begin()),
|
||||
xmbtows(ws.end()),
|
||||
boost::archive::iterators::ostream_iterator<wchar_t>(os)
|
||||
);
|
||||
#endif
|
||||
typedef iterators::xml_escape<const wchar_t *> xmbtows;
|
||||
std::copy(
|
||||
xmbtows(ws.data()),
|
||||
xmbtows(ws.data() + ws.size()),
|
||||
boost::archive::iterators::ostream_iterator<wchar_t>(os)
|
||||
);
|
||||
}
|
||||
#endif //BOOST_NO_STD_WSTRING
|
||||
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL void
|
||||
xml_woarchive_impl<Archive>::save(const char * s){
|
||||
save_iterator(os, s, s + std::strlen(s));
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL void
|
||||
xml_woarchive_impl<Archive>::save(const wchar_t * ws){
|
||||
os << ws;
|
||||
typedef iterators::xml_escape<const wchar_t *> xmbtows;
|
||||
std::copy(
|
||||
xmbtows(ws),
|
||||
xmbtows(ws + std::wcslen(ws)),
|
||||
boost::archive::iterators::ostream_iterator<wchar_t>(os)
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL
|
||||
xml_woarchive_impl<Archive>::xml_woarchive_impl(
|
||||
std::wostream & os_,
|
||||
unsigned int flags
|
||||
) :
|
||||
basic_text_oprimitive<std::wostream>(
|
||||
os_,
|
||||
true // don't change the codecvt - use the one below
|
||||
),
|
||||
basic_xml_oarchive<Archive>(flags)
|
||||
{
|
||||
if(0 == (flags & no_codecvt)){
|
||||
std::locale l = std::locale(
|
||||
os_.getloc(),
|
||||
new boost::archive::detail::utf8_codecvt_facet
|
||||
);
|
||||
os_.flush();
|
||||
os_.imbue(l);
|
||||
}
|
||||
if(0 == (flags & no_header))
|
||||
this->init();
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL
|
||||
xml_woarchive_impl<Archive>::~xml_woarchive_impl(){
|
||||
if(std::uncaught_exception())
|
||||
return;
|
||||
if(0 == (this->get_flags() & no_header)){
|
||||
save(L"</boost_serialization>\n");
|
||||
}
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL void
|
||||
xml_woarchive_impl<Archive>::save_binary(
|
||||
const void *address,
|
||||
std::size_t count
|
||||
){
|
||||
this->end_preamble();
|
||||
#if ! defined(__MWERKS__)
|
||||
this->basic_text_oprimitive<std::wostream>::save_binary(
|
||||
#else
|
||||
this->basic_text_oprimitive::save_binary(
|
||||
#endif
|
||||
address,
|
||||
count
|
||||
);
|
||||
this->indent_next = true;
|
||||
}
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#endif //BOOST_NO_STD_WSTREAMBUF
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,47 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_PUSH_BACK_07162005_0235)
|
||||
#define FUSION_PUSH_BACK_07162005_0235
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/support/detail/as_fusion_element.hpp>
|
||||
#include <boost/fusion/view/joint_view/joint_view.hpp>
|
||||
#include <boost/fusion/view/single_view/single_view.hpp>
|
||||
#include <boost/fusion/support/is_sequence.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence, typename T>
|
||||
struct push_back
|
||||
{
|
||||
typedef fusion::single_view<typename detail::as_fusion_element<T>::type> single_view;
|
||||
typedef joint_view<Sequence, single_view const> type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Sequence, typename T>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline typename
|
||||
lazy_enable_if<
|
||||
traits::is_sequence<Sequence>
|
||||
, result_of::push_back<Sequence const, T>
|
||||
>::type
|
||||
push_back(Sequence const& seq, T const& x)
|
||||
{
|
||||
typedef typename result_of::push_back<Sequence const, T> push_back;
|
||||
typedef typename push_back::single_view single_view;
|
||||
typedef typename push_back::type result;
|
||||
single_view x_(x);
|
||||
return result(seq, x_);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,82 @@
|
||||
//==============================================================================
|
||||
// Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II
|
||||
// Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI
|
||||
// Copyright 2011 Eric Niebler
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//==============================================================================
|
||||
#ifndef BOOST_PROTO_PREPROCESSOR_REMOVE_TYPENAME_HPP_INCLUDED
|
||||
#define BOOST_PROTO_PREPROCESSOR_REMOVE_TYPENAME_HPP_INCLUDED
|
||||
|
||||
/*!
|
||||
* \file
|
||||
* \brief Defines the BOOST_PROTO_REMOVE_TYPENAME macro
|
||||
*/
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/expand.hpp>
|
||||
#include <boost/preprocessor/tuple/eat.hpp>
|
||||
#include <boost/preprocessor/control/iif.hpp>
|
||||
#include <boost/preprocessor/detail/is_unary.hpp>
|
||||
|
||||
//==============================================================================
|
||||
// Boost.Preprocessor author P. Mensodines confirmed on an Boost email thread
|
||||
// (subject ``check if a token is a keyword (was "BOOST_PP_IS_UNARY()")'')
|
||||
// that it is OK to used `PP_IS_UNARY()` to check if tokens match predefined
|
||||
// "keyword" as it is done by the macros below (even if `PP_IS_UNARY()` is
|
||||
// technically only part of Boost.Preprocessor private API).
|
||||
//==============================================================================
|
||||
|
||||
//==============================================================================
|
||||
// `checking_prefix ## tokens` expand to unary (e.g., `(1)`) iff `tokens` start
|
||||
// with keyword to check.
|
||||
//==============================================================================
|
||||
#define BOOST_PROTO_DETAILS_KEYWORD_FACILITY_IS_FRONT(T, CHECKING_PREFIX) \
|
||||
BOOST_PP_IS_UNARY(BOOST_PP_CAT(CHECKING_PREFIX, T)) \
|
||||
/**/
|
||||
|
||||
//==============================================================================
|
||||
// `is_front_macro(tokens)` is 1 iff `tokens` start with keyword to remove.
|
||||
// `removing_prefix ## <keyword-to-remove>` must expand to nothing.
|
||||
//==============================================================================
|
||||
#define BOOST_PROTO_DETAILS_KEYWORD_FACILITY_REMOVE_FRONT(TOKENS, IS_FRONT_MACRO, REMOVING_PREFIX) \
|
||||
BOOST_PP_EXPAND( /* without EXPAND doesn't expand on MSVC */ \
|
||||
BOOST_PP_IIF( \
|
||||
IS_FRONT_MACRO(TOKENS) \
|
||||
, BOOST_PP_CAT \
|
||||
, TOKENS BOOST_PP_TUPLE_EAT(2) \
|
||||
)(REMOVING_PREFIX, TOKENS) \
|
||||
) \
|
||||
/**/
|
||||
|
||||
#define BOOST_PROTO_DETAILS_KEYWORD_TYPENAME_IS_typename (1) /* unary */
|
||||
#define typename_BOOST_PROTO_DETAILS_KEYWORD_TYPENAME_IS (1) /* unary */
|
||||
#define BOOST_PROTO_DETAILS_KEYWORD_TYPENAME_REMOVE_typename /* nothing */
|
||||
#define typename_BOOST_PROTO_DETAILS_KEYWORD_TYPENAME_REMOVE /* nothing */
|
||||
|
||||
#define BOOST_PROTO_DETAILS_KEYWORD_IS_TYPENAME_FRONT(TOKENS) \
|
||||
BOOST_PROTO_DETAILS_KEYWORD_FACILITY_IS_FRONT(TOKENS, BOOST_PROTO_DETAILS_KEYWORD_TYPENAME_IS_) \
|
||||
/**/
|
||||
|
||||
//==============================================================================
|
||||
/*!
|
||||
* \ingroup preprocessor
|
||||
* For any symbol \c X, this macro returns the same symbol from which a potential
|
||||
* leading \c typename keyword has been removed. If no typename keyword is present,
|
||||
* this macros evaluates to \c X itself without error.
|
||||
*
|
||||
* The original implementation of this macro is from Lorenzo Caminiti.
|
||||
*
|
||||
* \param X Symbol to remove \c typename from
|
||||
*/
|
||||
//==============================================================================
|
||||
#define BOOST_PROTO_REMOVE_TYPENAME(X) \
|
||||
BOOST_PROTO_DETAILS_KEYWORD_FACILITY_REMOVE_FRONT( \
|
||||
X \
|
||||
, BOOST_PROTO_DETAILS_KEYWORD_IS_TYPENAME_FRONT \
|
||||
, BOOST_PROTO_DETAILS_KEYWORD_TYPENAME_REMOVE_ \
|
||||
) \
|
||||
/**/
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,440 @@
|
||||
|
||||
// Copyright Peter Dimov 2001
|
||||
// Copyright Aleksey Gurtovoy 2001-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
// Preprocessed version of "boost/mpl/aux_/basic_bind.hpp" header
|
||||
// -- DO NOT modify by hand!
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename T, typename U1, typename U2, typename U3, typename U4
|
||||
, typename U5
|
||||
>
|
||||
struct resolve_bind_arg
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<
|
||||
int N, typename U1, typename U2, typename U3, typename U4, typename U5
|
||||
>
|
||||
struct resolve_bind_arg< arg<N>, U1, U2, U3, U4, U5 >
|
||||
{
|
||||
typedef typename apply_wrap5<mpl::arg<N>, U1, U2, U3, U4, U5>::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename U1, typename U2, typename U3, typename U4
|
||||
, typename U5
|
||||
>
|
||||
struct resolve_bind_arg< bind< F,T1,T2,T3,T4,T5 >, U1, U2, U3, U4, U5 >
|
||||
{
|
||||
typedef bind< F,T1,T2,T3,T4,T5 > f_;
|
||||
typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
template<
|
||||
typename F
|
||||
>
|
||||
struct bind0
|
||||
{
|
||||
template<
|
||||
typename U1 = na, typename U2 = na, typename U3 = na
|
||||
, typename U4 = na, typename U5 = na
|
||||
>
|
||||
struct apply
|
||||
{
|
||||
private:
|
||||
typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
|
||||
|
||||
public:
|
||||
typedef typename apply_wrap0<
|
||||
f_
|
||||
>::type type;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename F, typename U1, typename U2, typename U3, typename U4
|
||||
, typename U5
|
||||
>
|
||||
struct resolve_bind_arg<
|
||||
bind0<F>, U1, U2, U3, U4, U5
|
||||
>
|
||||
{
|
||||
typedef bind0<F> f_;
|
||||
typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
BOOST_MPL_AUX_ARITY_SPEC(1, bind0)
|
||||
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(1, bind0)
|
||||
|
||||
template<
|
||||
typename F
|
||||
>
|
||||
struct bind< F,na,na,na,na,na >
|
||||
: bind0<F>
|
||||
{
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1
|
||||
>
|
||||
struct bind1
|
||||
{
|
||||
template<
|
||||
typename U1 = na, typename U2 = na, typename U3 = na
|
||||
, typename U4 = na, typename U5 = na
|
||||
>
|
||||
struct apply
|
||||
{
|
||||
private:
|
||||
typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
|
||||
typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
|
||||
|
||||
public:
|
||||
typedef typename apply_wrap1<
|
||||
f_
|
||||
, typename t1::type
|
||||
>::type type;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename U1, typename U2, typename U3
|
||||
, typename U4, typename U5
|
||||
>
|
||||
struct resolve_bind_arg<
|
||||
bind1< F,T1 >, U1, U2, U3, U4, U5
|
||||
>
|
||||
{
|
||||
typedef bind1< F,T1 > f_;
|
||||
typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
BOOST_MPL_AUX_ARITY_SPEC(2, bind1)
|
||||
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(2, bind1)
|
||||
|
||||
template<
|
||||
typename F, typename T1
|
||||
>
|
||||
struct bind< F,T1,na,na,na,na >
|
||||
: bind1< F,T1 >
|
||||
{
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2
|
||||
>
|
||||
struct bind2
|
||||
{
|
||||
template<
|
||||
typename U1 = na, typename U2 = na, typename U3 = na
|
||||
, typename U4 = na, typename U5 = na
|
||||
>
|
||||
struct apply
|
||||
{
|
||||
private:
|
||||
typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
|
||||
typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
|
||||
typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2;
|
||||
|
||||
public:
|
||||
typedef typename apply_wrap2<
|
||||
f_
|
||||
, typename t1::type, typename t2::type
|
||||
>::type type;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename U1, typename U2
|
||||
, typename U3, typename U4, typename U5
|
||||
>
|
||||
struct resolve_bind_arg<
|
||||
bind2< F,T1,T2 >, U1, U2, U3, U4, U5
|
||||
>
|
||||
{
|
||||
typedef bind2< F,T1,T2 > f_;
|
||||
typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
BOOST_MPL_AUX_ARITY_SPEC(3, bind2)
|
||||
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(3, bind2)
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2
|
||||
>
|
||||
struct bind< F,T1,T2,na,na,na >
|
||||
: bind2< F,T1,T2 >
|
||||
{
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3
|
||||
>
|
||||
struct bind3
|
||||
{
|
||||
template<
|
||||
typename U1 = na, typename U2 = na, typename U3 = na
|
||||
, typename U4 = na, typename U5 = na
|
||||
>
|
||||
struct apply
|
||||
{
|
||||
private:
|
||||
typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
|
||||
typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
|
||||
typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2;
|
||||
typedef aux::resolve_bind_arg< T3,U1,U2,U3,U4,U5 > t3;
|
||||
|
||||
public:
|
||||
typedef typename apply_wrap3<
|
||||
f_
|
||||
, typename t1::type, typename t2::type, typename t3::type
|
||||
>::type type;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename U1
|
||||
, typename U2, typename U3, typename U4, typename U5
|
||||
>
|
||||
struct resolve_bind_arg<
|
||||
bind3< F,T1,T2,T3 >, U1, U2, U3, U4, U5
|
||||
>
|
||||
{
|
||||
typedef bind3< F,T1,T2,T3 > f_;
|
||||
typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
BOOST_MPL_AUX_ARITY_SPEC(4, bind3)
|
||||
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(4, bind3)
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3
|
||||
>
|
||||
struct bind< F,T1,T2,T3,na,na >
|
||||
: bind3< F,T1,T2,T3 >
|
||||
{
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
>
|
||||
struct bind4
|
||||
{
|
||||
template<
|
||||
typename U1 = na, typename U2 = na, typename U3 = na
|
||||
, typename U4 = na, typename U5 = na
|
||||
>
|
||||
struct apply
|
||||
{
|
||||
private:
|
||||
typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
|
||||
typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
|
||||
typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2;
|
||||
typedef aux::resolve_bind_arg< T3,U1,U2,U3,U4,U5 > t3;
|
||||
typedef aux::resolve_bind_arg< T4,U1,U2,U3,U4,U5 > t4;
|
||||
|
||||
public:
|
||||
typedef typename apply_wrap4<
|
||||
f_
|
||||
, typename t1::type, typename t2::type, typename t3::type
|
||||
, typename t4::type
|
||||
>::type type;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, typename U1, typename U2, typename U3, typename U4, typename U5
|
||||
>
|
||||
struct resolve_bind_arg<
|
||||
bind4< F,T1,T2,T3,T4 >, U1, U2, U3, U4, U5
|
||||
>
|
||||
{
|
||||
typedef bind4< F,T1,T2,T3,T4 > f_;
|
||||
typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
BOOST_MPL_AUX_ARITY_SPEC(5, bind4)
|
||||
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(5, bind4)
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
>
|
||||
struct bind< F,T1,T2,T3,T4,na >
|
||||
: bind4< F,T1,T2,T3,T4 >
|
||||
{
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5
|
||||
>
|
||||
struct bind5
|
||||
{
|
||||
template<
|
||||
typename U1 = na, typename U2 = na, typename U3 = na
|
||||
, typename U4 = na, typename U5 = na
|
||||
>
|
||||
struct apply
|
||||
{
|
||||
private:
|
||||
typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
|
||||
typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
|
||||
typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2;
|
||||
typedef aux::resolve_bind_arg< T3,U1,U2,U3,U4,U5 > t3;
|
||||
typedef aux::resolve_bind_arg< T4,U1,U2,U3,U4,U5 > t4;
|
||||
typedef aux::resolve_bind_arg< T5,U1,U2,U3,U4,U5 > t5;
|
||||
|
||||
public:
|
||||
typedef typename apply_wrap5<
|
||||
f_
|
||||
, typename t1::type, typename t2::type, typename t3::type
|
||||
, typename t4::type, typename t5::type
|
||||
>::type type;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename U1, typename U2, typename U3, typename U4
|
||||
, typename U5
|
||||
>
|
||||
struct resolve_bind_arg<
|
||||
bind5< F,T1,T2,T3,T4,T5 >, U1, U2, U3, U4, U5
|
||||
>
|
||||
{
|
||||
typedef bind5< F,T1,T2,T3,T4,T5 > f_;
|
||||
typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
BOOST_MPL_AUX_ARITY_SPEC(6, bind5)
|
||||
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(6, bind5)
|
||||
|
||||
/// primary template (not a specialization!)
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5
|
||||
>
|
||||
struct bind
|
||||
: bind5< F,T1,T2,T3,T4,T5 >
|
||||
{
|
||||
};
|
||||
|
||||
/// if_/eval_if specializations
|
||||
template< template< typename T1, typename T2, typename T3 > class F, typename Tag >
|
||||
struct quote3;
|
||||
|
||||
template< typename T1, typename T2, typename T3 > struct if_;
|
||||
|
||||
template<
|
||||
typename Tag, typename T1, typename T2, typename T3
|
||||
>
|
||||
struct bind3<
|
||||
quote3< if_,Tag >
|
||||
, T1, T2, T3
|
||||
>
|
||||
{
|
||||
template<
|
||||
typename U1 = na, typename U2 = na, typename U3 = na
|
||||
, typename U4 = na, typename U5 = na
|
||||
>
|
||||
struct apply
|
||||
{
|
||||
private:
|
||||
typedef mpl::arg<1> n1;
|
||||
typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
|
||||
typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2;
|
||||
typedef aux::resolve_bind_arg< T3,U1,U2,U3,U4,U5 > t3;
|
||||
typedef typename if_<
|
||||
typename t1::type
|
||||
, t2, t3
|
||||
>::type f_;
|
||||
|
||||
public:
|
||||
typedef typename f_::type type;
|
||||
};
|
||||
};
|
||||
|
||||
template<
|
||||
template< typename T1, typename T2, typename T3 > class F, typename Tag
|
||||
>
|
||||
struct quote3;
|
||||
|
||||
template< typename T1, typename T2, typename T3 > struct eval_if;
|
||||
|
||||
template<
|
||||
typename Tag, typename T1, typename T2, typename T3
|
||||
>
|
||||
struct bind3<
|
||||
quote3< eval_if,Tag >
|
||||
, T1, T2, T3
|
||||
>
|
||||
{
|
||||
template<
|
||||
typename U1 = na, typename U2 = na, typename U3 = na
|
||||
, typename U4 = na, typename U5 = na
|
||||
>
|
||||
struct apply
|
||||
{
|
||||
private:
|
||||
typedef mpl::arg<1> n1;
|
||||
typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
|
||||
typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2;
|
||||
typedef aux::resolve_bind_arg< T3,U1,U2,U3,U4,U5 > t3;
|
||||
typedef typename eval_if<
|
||||
typename t1::type
|
||||
, t2, t3
|
||||
>::type f_;
|
||||
|
||||
public:
|
||||
typedef typename f_::type type;
|
||||
};
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
// (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_COMPLEMENT_HPP_INCLUDED
|
||||
#define BOOST_TT_HAS_COMPLEMENT_HPP_INCLUDED
|
||||
|
||||
#define BOOST_TT_TRAIT_NAME has_complement
|
||||
#define BOOST_TT_TRAIT_OP ~
|
||||
#define BOOST_TT_FORBIDDEN_IF\
|
||||
(\
|
||||
/* pointer */\
|
||||
::boost::is_pointer< Rhs_noref >::value || \
|
||||
/* fundamental non integral */\
|
||||
(\
|
||||
::boost::is_fundamental< Rhs_noref >::value && \
|
||||
(! ::boost::is_integral< Rhs_noref >::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,11 @@
|
||||
snr psuccess ntrials 10000 r6315, r6330
|
||||
-27.0 0.000 0.001
|
||||
-26.5 0.004 0.014
|
||||
-26.0 0.03 0.066
|
||||
-25.5 0.107 0.208 0.19
|
||||
-25.0 0.353 0.424 0.40 (2)
|
||||
-24.5 0.653 0.725
|
||||
-24.0 0.913 0.913
|
||||
-23.5 0.983 0.988
|
||||
-23.0 0.998 0.999
|
||||
-22.0 1.0 1.0
|
||||
@@ -0,0 +1,175 @@
|
||||
program ldpcsim
|
||||
|
||||
use, intrinsic :: iso_c_binding
|
||||
use iso_c_binding, only: c_loc,c_size_t
|
||||
use hashing
|
||||
use packjt
|
||||
parameter(NRECENT=10)
|
||||
character*12 recent_calls(NRECENT)
|
||||
character*22 msg,msgsent,msgreceived
|
||||
character*8 arg
|
||||
integer*1, allocatable :: codeword(:), decoded(:), message(:)
|
||||
integer*1, target:: i1Msg8BitBytes(10)
|
||||
integer*1 i1hash(4)
|
||||
integer*1 msgbits(80)
|
||||
integer*4 i4Msg6BitWords(13)
|
||||
integer ihash
|
||||
integer nerrtot(128),nerrdec(128)
|
||||
real*8, allocatable :: lratio(:), rxdata(:), rxavgd(:)
|
||||
real, allocatable :: yy(:), llr(:)
|
||||
equivalence(ihash,i1hash)
|
||||
|
||||
do i=1,NRECENT
|
||||
recent_calls(i)=' '
|
||||
enddo
|
||||
nerrtot=0
|
||||
nerrdec=0
|
||||
|
||||
nargs=iargc()
|
||||
if(nargs.ne.4) then
|
||||
print*,'Usage: ldpcsim niter navg #trials s '
|
||||
print*,'eg: ldpcsim 10 1 1000 0.75'
|
||||
return
|
||||
endif
|
||||
call getarg(1,arg)
|
||||
read(arg,*) max_iterations
|
||||
call getarg(2,arg)
|
||||
read(arg,*) navg
|
||||
call getarg(3,arg)
|
||||
read(arg,*) ntrials
|
||||
call getarg(4,arg)
|
||||
read(arg,*) s
|
||||
|
||||
! don't count hash bits as data bits
|
||||
N=128
|
||||
K=72
|
||||
rate=real(K)/real(N)
|
||||
|
||||
write(*,*) "rate: ",rate
|
||||
|
||||
write(*,*) "niter= ",max_iterations," navg= ",navg," s= ",s
|
||||
|
||||
allocate ( codeword(N), decoded(K), message(K) )
|
||||
allocate ( lratio(N), rxdata(N), rxavgd(N), yy(N), llr(N) )
|
||||
|
||||
msg="K9AN K1JT EN50"
|
||||
call packmsg(msg,i4Msg6BitWords,itype) !Pack into 12 6-bit bytes
|
||||
call unpackmsg(i4Msg6BitWords,msgsent) !Unpack to get msgsent
|
||||
write(*,*) "message sent ",msgsent
|
||||
|
||||
i4=0
|
||||
ik=0
|
||||
im=0
|
||||
do i=1,12
|
||||
nn=i4Msg6BitWords(i)
|
||||
do j=1, 6
|
||||
ik=ik+1
|
||||
i4=i4+i4+iand(1,ishft(nn,j-6))
|
||||
i4=iand(i4,255)
|
||||
if(ik.eq.8) then
|
||||
im=im+1
|
||||
! if(i4.gt.127) i4=i4-256
|
||||
i1Msg8BitBytes(im)=i4
|
||||
ik=0
|
||||
endif
|
||||
enddo
|
||||
enddo
|
||||
|
||||
ihash=nhash(c_loc(i1Msg8BitBytes),int(9,c_size_t),146)
|
||||
ihash=2*iand(ihash,32767) !Generate the 8-bit hash
|
||||
i1Msg8BitBytes(10)=i1hash(1) !CRC to byte 10
|
||||
mbit=0
|
||||
do i=1, 10
|
||||
i1=i1Msg8BitBytes(i)
|
||||
do ibit=1,8
|
||||
mbit=mbit+1
|
||||
msgbits(mbit)=iand(1,ishft(i1,ibit-8))
|
||||
enddo
|
||||
enddo
|
||||
call encode_msk144(msgbits,codeword)
|
||||
call init_random_seed()
|
||||
|
||||
write(*,*) "Eb/N0 SNR2500 ngood nundetected nbadhash sigma"
|
||||
do idb = -6, 14
|
||||
db=idb/2.0-1.0
|
||||
sigma=1/sqrt( 2*rate*(10**(db/10.0)) )
|
||||
ngood=0
|
||||
nue=0
|
||||
nbadhash=0
|
||||
|
||||
do itrial=1, ntrials
|
||||
rxavgd=0d0
|
||||
do iav=1,navg
|
||||
call sgran()
|
||||
! Create a realization of a noisy received word
|
||||
do i=1,N
|
||||
rxdata(i) = 2.0*codeword(i)-1.0 + sigma*gran()
|
||||
enddo
|
||||
rxavgd=rxavgd+rxdata
|
||||
enddo
|
||||
rxdata=rxavgd
|
||||
nerr=0
|
||||
do i=1,N
|
||||
if( rxdata(i)*(2*codeword(i)-1.0) .lt. 0 ) nerr=nerr+1
|
||||
enddo
|
||||
nerrtot(nerr)=nerrtot(nerr)+1
|
||||
|
||||
! Correct signal normalization is important for this decoder.
|
||||
rxav=sum(rxdata)/N
|
||||
rx2av=sum(rxdata*rxdata)/N
|
||||
rxsig=sqrt(rx2av-rxav*rxav)
|
||||
rxdata=rxdata/rxsig
|
||||
! To match the metric to the channel, s should be set to the noise standard deviation.
|
||||
! For now, set s to the value that optimizes decode probability near threshold.
|
||||
! The s parameter can be tuned to trade a few tenth's dB of threshold for an order of
|
||||
! magnitude in UER
|
||||
if( s .lt. 0 ) then
|
||||
ss=sigma
|
||||
else
|
||||
ss=s
|
||||
endif
|
||||
|
||||
llr=2.0*rxdata/(ss*ss)
|
||||
lratio=exp(llr)
|
||||
yy=rxdata
|
||||
|
||||
! max_iterations is max number of belief propagation iterations
|
||||
! call ldpc_decode(lratio, decoded, max_iterations, niterations, max_dither, ndither)
|
||||
! call amsdecode(yy, max_iterations, decoded, niterations)
|
||||
! call bitflipmsk144(rxdata, decoded, niterations)
|
||||
call bpdecode144(llr, max_iterations, decoded, niterations)
|
||||
|
||||
! If the decoder finds a valid codeword, niterations will be .ge. 0.
|
||||
if( niterations .ge. 0 ) then
|
||||
call extractmessage144(decoded,msgreceived,nhashflag,recent_calls,nrecent)
|
||||
if( nhashflag .ne. 1 ) then
|
||||
nbadhash=nbadhash+1
|
||||
endif
|
||||
nueflag=0
|
||||
|
||||
! Check the message plus hash against what was sent.
|
||||
do i=1,K
|
||||
if( msgbits(i) .ne. decoded(i) ) then
|
||||
nueflag=1
|
||||
endif
|
||||
enddo
|
||||
if( nhashflag .eq. 1 .and. nueflag .eq. 0 ) then
|
||||
ngood=ngood+1
|
||||
nerrdec(nerr)=nerrdec(nerr)+1
|
||||
else if( nhashflag .eq. 1 .and. nueflag .eq. 1 ) then
|
||||
nue=nue+1;
|
||||
endif
|
||||
endif
|
||||
enddo
|
||||
snr2500=db-3.5
|
||||
write(*,"(f4.1,4x,f5.1,1x,i8,1x,i8,1x,i8,8x,f5.2)") db,snr2500,ngood,nue,nbadhash,ss
|
||||
|
||||
enddo
|
||||
|
||||
open(unit=23,file='nerrhisto.dat',status='unknown')
|
||||
do i=1,128
|
||||
write(23,'(i4,2x,i10,i10,f10.2)') i,nerrdec(i),nerrtot(i),real(nerrdec(i))/real(nerrtot(i)+1e-10)
|
||||
enddo
|
||||
close(23)
|
||||
|
||||
end program ldpcsim
|
||||
@@ -0,0 +1,237 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com>
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
// See http://boostorg.github.com/compute for more information.
|
||||
//---------------------------------------------------------------------------//
|
||||
|
||||
#ifndef BOOST_COMPUTE_CONTAINER_DYNAMIC_BITSET_HPP
|
||||
#define BOOST_COMPUTE_CONTAINER_DYNAMIC_BITSET_HPP
|
||||
|
||||
#include <boost/compute/lambda.hpp>
|
||||
#include <boost/compute/algorithm/any_of.hpp>
|
||||
#include <boost/compute/algorithm/fill.hpp>
|
||||
#include <boost/compute/algorithm/transform_reduce.hpp>
|
||||
#include <boost/compute/container/vector.hpp>
|
||||
#include <boost/compute/functional/integer.hpp>
|
||||
#include <boost/compute/types/fundamental.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
|
||||
/// \class dynamic_bitset
|
||||
/// \brief The dynamic_bitset class contains a resizable bit array.
|
||||
///
|
||||
/// For example, to create a dynamic-bitset with space for 1000 bits on the
|
||||
/// device:
|
||||
/// \code
|
||||
/// boost::compute::dynamic_bitset<> bits(1000, queue);
|
||||
/// \endcode
|
||||
///
|
||||
/// The Boost.Compute \c dynamic_bitset class provides a STL-like API and is
|
||||
/// modeled after the \c boost::dynamic_bitset class from Boost.
|
||||
///
|
||||
/// \see \ref vector "vector<T>"
|
||||
template<class Block = ulong_, class Alloc = buffer_allocator<Block> >
|
||||
class dynamic_bitset
|
||||
{
|
||||
public:
|
||||
typedef Block block_type;
|
||||
typedef Alloc allocator_type;
|
||||
typedef vector<Block, Alloc> container_type;
|
||||
typedef typename container_type::size_type size_type;
|
||||
|
||||
BOOST_STATIC_CONSTANT(size_type, bits_per_block = sizeof(block_type) * CHAR_BIT);
|
||||
BOOST_STATIC_CONSTANT(size_type, npos = static_cast<size_type>(-1));
|
||||
|
||||
/// Creates a new dynamic bitset with storage for \p size bits. Initializes
|
||||
/// all bits to zero.
|
||||
dynamic_bitset(size_type size, command_queue &queue)
|
||||
: m_bits(size / sizeof(block_type), queue.get_context()),
|
||||
m_size(size)
|
||||
{
|
||||
// initialize all bits to zero
|
||||
reset(queue);
|
||||
}
|
||||
|
||||
/// Creates a new dynamic bitset as a copy of \p other.
|
||||
dynamic_bitset(const dynamic_bitset &other)
|
||||
: m_bits(other.m_bits),
|
||||
m_size(other.m_size)
|
||||
{
|
||||
}
|
||||
|
||||
/// Copies the data from \p other to \c *this.
|
||||
dynamic_bitset& operator=(const dynamic_bitset &other)
|
||||
{
|
||||
if(this != &other){
|
||||
m_bits = other.m_bits;
|
||||
m_size = other.m_size;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// Destroys the dynamic bitset.
|
||||
~dynamic_bitset()
|
||||
{
|
||||
}
|
||||
|
||||
/// Returns the size of the dynamic bitset.
|
||||
size_type size() const
|
||||
{
|
||||
return m_size;
|
||||
}
|
||||
|
||||
/// Returns the number of blocks to store the bits in the dynamic bitset.
|
||||
size_type num_blocks() const
|
||||
{
|
||||
return m_bits.size();
|
||||
}
|
||||
|
||||
/// Returns the maximum possible size for the dynamic bitset.
|
||||
size_type max_size() const
|
||||
{
|
||||
return m_bits.max_size() * bits_per_block;
|
||||
}
|
||||
|
||||
/// Returns \c true if the dynamic bitset is empty (i.e. \c size() == \c 0).
|
||||
bool empty() const
|
||||
{
|
||||
return size() == 0;
|
||||
}
|
||||
|
||||
/// Returns the number of set bits (i.e. '1') in the bitset.
|
||||
size_type count(command_queue &queue) const
|
||||
{
|
||||
ulong_ count = 0;
|
||||
transform_reduce(
|
||||
m_bits.begin(),
|
||||
m_bits.end(),
|
||||
&count,
|
||||
popcount<block_type>(),
|
||||
plus<ulong_>(),
|
||||
queue
|
||||
);
|
||||
return static_cast<size_type>(count);
|
||||
}
|
||||
|
||||
/// Resizes the bitset to contain \p num_bits. If the new size is greater
|
||||
/// than the current size the new bits are set to zero.
|
||||
void resize(size_type num_bits, command_queue &queue)
|
||||
{
|
||||
// resize bits
|
||||
const size_type current_block_count = m_bits.size();
|
||||
m_bits.resize(num_bits * bits_per_block, queue);
|
||||
|
||||
// fill new block with zeros (if new blocks were added)
|
||||
const size_type new_block_count = m_bits.size();
|
||||
if(new_block_count > current_block_count){
|
||||
fill_n(
|
||||
m_bits.begin() + current_block_count,
|
||||
new_block_count - current_block_count,
|
||||
block_type(0),
|
||||
queue
|
||||
);
|
||||
}
|
||||
|
||||
// store new size
|
||||
m_size = num_bits;
|
||||
}
|
||||
|
||||
/// Sets the bit at position \p n to \c true.
|
||||
void set(size_type n, command_queue &queue)
|
||||
{
|
||||
set(n, true, queue);
|
||||
}
|
||||
|
||||
/// Sets the bit at position \p n to \p value.
|
||||
void set(size_type n, bool value, command_queue &queue)
|
||||
{
|
||||
const size_type bit = n % bits_per_block;
|
||||
const size_type block = n / bits_per_block;
|
||||
|
||||
// load current block
|
||||
block_type block_value;
|
||||
copy_n(m_bits.begin() + block, 1, &block_value, queue);
|
||||
|
||||
// update block value
|
||||
if(value){
|
||||
block_value |= (size_type(1) << bit);
|
||||
}
|
||||
else {
|
||||
block_value &= ~(size_type(1) << bit);
|
||||
}
|
||||
|
||||
// store new block
|
||||
copy_n(&block_value, 1, m_bits.begin() + block, queue);
|
||||
}
|
||||
|
||||
/// Returns \c true if the bit at position \p n is set (i.e. '1').
|
||||
bool test(size_type n, command_queue &queue)
|
||||
{
|
||||
const size_type bit = n % (sizeof(block_type) * CHAR_BIT);
|
||||
const size_type block = n / (sizeof(block_type) * CHAR_BIT);
|
||||
|
||||
block_type block_value;
|
||||
copy_n(m_bits.begin() + block, 1, &block_value, queue);
|
||||
|
||||
return block_value & (size_type(1) << bit);
|
||||
}
|
||||
|
||||
/// Flips the value of the bit at position \p n.
|
||||
void flip(size_type n, command_queue &queue)
|
||||
{
|
||||
set(n, !test(n, queue), queue);
|
||||
}
|
||||
|
||||
/// Returns \c true if any bit in the bitset is set (i.e. '1').
|
||||
bool any(command_queue &queue) const
|
||||
{
|
||||
return any_of(
|
||||
m_bits.begin(), m_bits.end(), lambda::_1 != block_type(0), queue
|
||||
);
|
||||
}
|
||||
|
||||
/// Returns \c true if all of the bits in the bitset are set to zero.
|
||||
bool none(command_queue &queue) const
|
||||
{
|
||||
return !any(queue);
|
||||
}
|
||||
|
||||
/// Sets all of the bits in the bitset to zero.
|
||||
void reset(command_queue &queue)
|
||||
{
|
||||
fill(m_bits.begin(), m_bits.end(), block_type(0), queue);
|
||||
}
|
||||
|
||||
/// Sets the bit at position \p n to zero.
|
||||
void reset(size_type n, command_queue &queue)
|
||||
{
|
||||
set(n, false, queue);
|
||||
}
|
||||
|
||||
/// Empties the bitset (e.g. \c resize(0)).
|
||||
void clear()
|
||||
{
|
||||
m_bits.clear();
|
||||
}
|
||||
|
||||
/// Returns the allocator used to allocate storage for the bitset.
|
||||
allocator_type get_allocator() const
|
||||
{
|
||||
return m_bits.get_allocator();
|
||||
}
|
||||
|
||||
private:
|
||||
container_type m_bits;
|
||||
size_type m_size;
|
||||
};
|
||||
|
||||
} // end compute namespace
|
||||
} // end boost namespace
|
||||
|
||||
#endif // BOOST_COMPUTE_CONTAINER_DYNAMIC_BITSET_HPP
|
||||
@@ -0,0 +1,57 @@
|
||||
|
||||
#ifndef BOOST_MPL_VECTOR_HPP_INCLUDED
|
||||
#define BOOST_MPL_VECTOR_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$
|
||||
|
||||
#if !defined(BOOST_MPL_PREPROCESSING_MODE)
|
||||
# include <boost/mpl/limits/vector.hpp>
|
||||
# include <boost/mpl/aux_/na.hpp>
|
||||
# include <boost/mpl/aux_/config/preprocessor.hpp>
|
||||
|
||||
# include <boost/preprocessor/inc.hpp>
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
# include <boost/preprocessor/stringize.hpp>
|
||||
|
||||
#if !defined(BOOST_NEEDS_TOKEN_PASTING_OP_FOR_TOKENS_JUXTAPOSING)
|
||||
# define AUX778076_VECTOR_HEADER \
|
||||
BOOST_PP_CAT(vector, BOOST_MPL_LIMIT_VECTOR_SIZE).hpp \
|
||||
/**/
|
||||
#else
|
||||
# define AUX778076_VECTOR_HEADER \
|
||||
BOOST_PP_CAT(vector, BOOST_MPL_LIMIT_VECTOR_SIZE)##.hpp \
|
||||
/**/
|
||||
#endif
|
||||
|
||||
# include BOOST_PP_STRINGIZE(boost/mpl/vector/AUX778076_VECTOR_HEADER)
|
||||
# undef AUX778076_VECTOR_HEADER
|
||||
#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 vector.hpp
|
||||
# include <boost/mpl/aux_/include_preprocessed.hpp>
|
||||
|
||||
#else
|
||||
|
||||
# include <boost/mpl/limits/vector.hpp>
|
||||
|
||||
# define AUX778076_SEQUENCE_NAME vector
|
||||
# define AUX778076_SEQUENCE_LIMIT BOOST_MPL_LIMIT_VECTOR_SIZE
|
||||
# include <boost/mpl/aux_/sequence_wrapper.hpp>
|
||||
|
||||
#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
|
||||
#endif // BOOST_MPL_VECTOR_HPP_INCLUDED
|
||||
@@ -0,0 +1,230 @@
|
||||
// (C) Copyright Gennadiy Rozental 2001.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/libs/test for the library home page.
|
||||
//
|
||||
//!@file
|
||||
//!@brief Floating point comparison with enhanced reporting
|
||||
// ***************************************************************************
|
||||
|
||||
#ifndef BOOST_TEST_TOOLS_FPC_OP_HPP_050915GER
|
||||
#define BOOST_TEST_TOOLS_FPC_OP_HPP_050915GER
|
||||
|
||||
// Boost.Test
|
||||
#include <boost/test/tools/assertion.hpp>
|
||||
|
||||
#include <boost/test/tools/floating_point_comparison.hpp>
|
||||
#include <boost/test/tools/fpc_tolerance.hpp>
|
||||
|
||||
// Boost
|
||||
#include <boost/type_traits/common_type.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
|
||||
#include <boost/test/detail/suppress_warnings.hpp>
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
namespace boost {
|
||||
namespace test_tools {
|
||||
namespace assertion {
|
||||
namespace op {
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** fpctraits ************** //
|
||||
// ************************************************************************** //
|
||||
// set of floating point comparison traits per comparison OP
|
||||
|
||||
template<typename OP>
|
||||
struct fpctraits {
|
||||
static const bool cmp_direct = true;
|
||||
};
|
||||
|
||||
template <typename Lhs, typename Rhs>
|
||||
struct fpctraits<op::NE<Lhs,Rhs> > {
|
||||
static const bool cmp_direct = false;
|
||||
};
|
||||
|
||||
template <typename Lhs, typename Rhs>
|
||||
struct fpctraits<op::LT<Lhs,Rhs> > {
|
||||
static const bool cmp_direct = false;
|
||||
};
|
||||
|
||||
template <typename Lhs, typename Rhs>
|
||||
struct fpctraits<op::GT<Lhs,Rhs> > {
|
||||
static const bool cmp_direct = false;
|
||||
};
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** set of overloads to select correct fpc algo ************** //
|
||||
// ************************************************************************** //
|
||||
// we really only care about EQ vs NE. All other comparisons use direct first
|
||||
// and then need EQ. For example a < b (tolerance t) IFF a < b OR a == b (tolerance t)
|
||||
|
||||
template <typename FPT, typename Lhs, typename Rhs, typename OP>
|
||||
inline assertion_result
|
||||
compare_fpv( Lhs const& lhs, Rhs const& rhs, OP* )
|
||||
{
|
||||
fpc::close_at_tolerance<FPT> P( fpc_tolerance<FPT>(), fpc::FPC_STRONG );
|
||||
|
||||
assertion_result ar( P( lhs, rhs ) );
|
||||
if( !ar )
|
||||
ar.message() << "Relative difference exceeds tolerance ["
|
||||
<< P.tested_rel_diff() << " > " << P.fraction_tolerance() << ']';
|
||||
return ar;
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
template <typename FPT, typename OP>
|
||||
inline assertion_result
|
||||
compare_fpv_near_zero( FPT const& fpv, OP* )
|
||||
{
|
||||
fpc::small_with_tolerance<FPT> P( fpc_tolerance<FPT>() );
|
||||
|
||||
assertion_result ar( P( fpv ) );
|
||||
if( !ar )
|
||||
ar.message() << "Absolute value exceeds tolerance [|" << fpv << "| > "<< fpc_tolerance<FPT>() << ']';
|
||||
|
||||
return ar;
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
template <typename FPT, typename Lhs, typename Rhs>
|
||||
inline assertion_result
|
||||
compare_fpv( Lhs const& lhs, Rhs const& rhs, op::NE<Lhs,Rhs>* )
|
||||
{
|
||||
fpc::close_at_tolerance<FPT> P( fpc_tolerance<FPT>(), fpc::FPC_WEAK );
|
||||
|
||||
assertion_result ar( !P( lhs, rhs ) );
|
||||
if( !ar )
|
||||
ar.message() << "Relative difference is within tolerance ["
|
||||
<< P.tested_rel_diff() << " < " << fpc_tolerance<FPT>() << ']';
|
||||
|
||||
return ar;
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
template <typename FPT, typename Lhs, typename Rhs>
|
||||
inline assertion_result
|
||||
compare_fpv_near_zero( FPT const& fpv, op::NE<Lhs,Rhs>* )
|
||||
{
|
||||
fpc::small_with_tolerance<FPT> P( fpc_tolerance<FPT>() );
|
||||
|
||||
assertion_result ar( !P( fpv ) );
|
||||
if( !ar )
|
||||
ar.message() << "Absolute value is within tolerance [|" << fpv << "| < "<< fpc_tolerance<FPT>() << ']';
|
||||
return ar;
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
template <typename FPT, typename Lhs, typename Rhs>
|
||||
inline assertion_result
|
||||
compare_fpv( Lhs const& lhs, Rhs const& rhs, op::LT<Lhs,Rhs>* )
|
||||
{
|
||||
return lhs >= rhs ? assertion_result( false ) : compare_fpv<FPT>( lhs, rhs, (op::NE<Lhs,Rhs>*)0 );
|
||||
}
|
||||
|
||||
template <typename FPT, typename Lhs, typename Rhs>
|
||||
inline assertion_result
|
||||
compare_fpv_near_zero( FPT const& fpv, op::LT<Lhs,Rhs>* )
|
||||
{
|
||||
return fpv >= 0 ? assertion_result( false ) : compare_fpv_near_zero( fpv, (op::NE<Lhs,Rhs>*)0 );
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
template <typename FPT, typename Lhs, typename Rhs>
|
||||
inline assertion_result
|
||||
compare_fpv( Lhs const& lhs, Rhs const& rhs, op::GT<Lhs,Rhs>* )
|
||||
{
|
||||
return lhs <= rhs ? assertion_result( false ) : compare_fpv<FPT>( lhs, rhs, (op::NE<Lhs,Rhs>*)0 );
|
||||
}
|
||||
|
||||
template <typename FPT, typename Lhs, typename Rhs>
|
||||
inline assertion_result
|
||||
compare_fpv_near_zero( FPT const& fpv, op::GT<Lhs,Rhs>* )
|
||||
{
|
||||
return fpv <= 0 ? assertion_result( false ) : compare_fpv_near_zero( fpv, (op::NE<Lhs,Rhs>*)0 );
|
||||
}
|
||||
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
#define DEFINE_FPV_COMPARISON( oper, name, rev ) \
|
||||
template<typename Lhs,typename Rhs> \
|
||||
struct name<Lhs,Rhs,typename boost::enable_if_c< \
|
||||
(fpc::tolerance_based<Lhs>::value && \
|
||||
fpc::tolerance_based<Rhs>::value)>::type> { \
|
||||
public: \
|
||||
typedef typename common_type<Lhs,Rhs>::type FPT; \
|
||||
typedef name<Lhs,Rhs> OP; \
|
||||
\
|
||||
typedef assertion_result result_type; \
|
||||
\
|
||||
static bool \
|
||||
eval_direct( Lhs const& lhs, Rhs const& rhs ) \
|
||||
{ \
|
||||
return lhs oper rhs; \
|
||||
} \
|
||||
\
|
||||
static assertion_result \
|
||||
eval( Lhs const& lhs, Rhs const& rhs ) \
|
||||
{ \
|
||||
if( lhs == 0 ) \
|
||||
{ \
|
||||
return compare_fpv_near_zero( rhs, (OP*)0 ); \
|
||||
} \
|
||||
\
|
||||
if( rhs == 0 ) \
|
||||
{ \
|
||||
return compare_fpv_near_zero( lhs, (OP*)0 ); \
|
||||
} \
|
||||
\
|
||||
bool direct_res = eval_direct( lhs, rhs ); \
|
||||
\
|
||||
if( (direct_res && fpctraits<OP>::cmp_direct) || \
|
||||
fpc_tolerance<FPT>() == FPT(0) ) \
|
||||
{ \
|
||||
return direct_res; \
|
||||
} \
|
||||
\
|
||||
return compare_fpv<FPT>( lhs, rhs, (OP*)0 ); \
|
||||
} \
|
||||
\
|
||||
template<typename PrevExprType> \
|
||||
static void \
|
||||
report( std::ostream& ostr, \
|
||||
PrevExprType const& lhs, \
|
||||
Rhs const& rhs ) \
|
||||
{ \
|
||||
lhs.report( ostr ); \
|
||||
ostr << revert() \
|
||||
<< tt_detail::print_helper( rhs ); \
|
||||
} \
|
||||
\
|
||||
static char const* revert() \
|
||||
{ return " " #rev " "; } \
|
||||
}; \
|
||||
/**/
|
||||
|
||||
BOOST_TEST_FOR_EACH_COMP_OP( DEFINE_FPV_COMPARISON )
|
||||
#undef DEFINE_FPV_COMPARISON
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
} // namespace op
|
||||
} // namespace assertion
|
||||
} // namespace test_tools
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/test/detail/enable_warnings.hpp>
|
||||
|
||||
#endif // BOOST_TEST_TOOLS_FPC_OP_HPP_050915GER
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
|
||||
#if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
|
||||
#ifndef BOOST_PHOENIX_OBJECT_DETAIL_CONSTRUCT_HPP
|
||||
#define BOOST_PHOENIX_OBJECT_DETAIL_CONSTRUCT_HPP
|
||||
|
||||
#include <boost/phoenix/object/detail/cpp03/preprocessed/construct.hpp>
|
||||
|
||||
#endif
|
||||
#else
|
||||
|
||||
#if !BOOST_PHOENIX_IS_ITERATING
|
||||
|
||||
#ifndef BOOST_PHOENIX_OBJECT_DETAIL_CONSTRUCT_HPP
|
||||
#define BOOST_PHOENIX_OBJECT_DETAIL_CONSTRUCT_HPP
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/construct_" BOOST_PHOENIX_LIMIT_STR ".hpp")
|
||||
#endif
|
||||
|
||||
/*==============================================================================
|
||||
Copyright (c) 2005-2010 Joel de Guzman
|
||||
Copyright (c) 2010 Thomas Heller
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
#define BOOST_PHOENIX_ITERATION_PARAMS \
|
||||
(3, (1, BOOST_PHOENIX_COMPOSITE_LIMIT, \
|
||||
<boost/phoenix/object/detail/cpp03/construct.hpp>))
|
||||
#include BOOST_PHOENIX_ITERATE()
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
template <typename T, BOOST_PHOENIX_typename_A>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, BOOST_PHOENIX_A>::type const
|
||||
construct(BOOST_PHOENIX_A_const_ref_a)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, BOOST_PHOENIX_A>::
|
||||
make(detail::target<T>(), BOOST_PHOENIX_a);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
|
||||
@@ -0,0 +1,52 @@
|
||||
/* 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_DETAIL_CONVERTER_HPP
|
||||
#define BOOST_MULTI_INDEX_DETAIL_CONVERTER_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
|
||||
namespace multi_index{
|
||||
|
||||
namespace detail{
|
||||
|
||||
/* converter offers means to access indices of a given multi_index_container
|
||||
* and for convertibilty between index iterators, so providing a
|
||||
* localized access point for get() and project() functions.
|
||||
*/
|
||||
|
||||
template<typename MultiIndexContainer,typename Index>
|
||||
struct converter
|
||||
{
|
||||
static const Index& index(const MultiIndexContainer& x){return x;}
|
||||
static Index& index(MultiIndexContainer& x){return x;}
|
||||
|
||||
static typename Index::const_iterator const_iterator(
|
||||
const MultiIndexContainer& x,typename MultiIndexContainer::node_type* node)
|
||||
{
|
||||
return x.Index::make_iterator(node);
|
||||
}
|
||||
|
||||
static typename Index::iterator iterator(
|
||||
MultiIndexContainer& x,typename MultiIndexContainer::node_type* node)
|
||||
{
|
||||
return x.Index::make_iterator(node);
|
||||
}
|
||||
};
|
||||
|
||||
} /* namespace multi_index::detail */
|
||||
|
||||
} /* namespace multi_index */
|
||||
|
||||
} /* namespace boost */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* Copyright (c) 2011 Helge Bahmann
|
||||
* Copyright (c) 2013 Tim Blechmann
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/atomic.hpp
|
||||
*
|
||||
* This header contains definition of \c atomic template and \c atomic_flag.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_ATOMIC_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_ATOMIC_HPP_INCLUDED_
|
||||
|
||||
#include <boost/atomic/capabilities.hpp>
|
||||
#include <boost/atomic/fences.hpp>
|
||||
#include <boost/atomic/atomic_flag.hpp>
|
||||
#include <boost/atomic/detail/atomic_template.hpp>
|
||||
#include <boost/atomic/detail/operations.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
using atomics::atomic;
|
||||
|
||||
using atomics::atomic_char;
|
||||
using atomics::atomic_uchar;
|
||||
using atomics::atomic_schar;
|
||||
using atomics::atomic_uint8_t;
|
||||
using atomics::atomic_int8_t;
|
||||
using atomics::atomic_ushort;
|
||||
using atomics::atomic_short;
|
||||
using atomics::atomic_uint16_t;
|
||||
using atomics::atomic_int16_t;
|
||||
using atomics::atomic_uint;
|
||||
using atomics::atomic_int;
|
||||
using atomics::atomic_uint32_t;
|
||||
using atomics::atomic_int32_t;
|
||||
using atomics::atomic_ulong;
|
||||
using atomics::atomic_long;
|
||||
using atomics::atomic_uint64_t;
|
||||
using atomics::atomic_int64_t;
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
using atomics::atomic_ullong;
|
||||
using atomics::atomic_llong;
|
||||
#endif
|
||||
using atomics::atomic_address;
|
||||
using atomics::atomic_bool;
|
||||
using atomics::atomic_wchar_t;
|
||||
#if !defined(BOOST_NO_CXX11_CHAR16_T)
|
||||
using atomics::atomic_char16_t;
|
||||
#endif
|
||||
#if !defined(BOOST_NO_CXX11_CHAR32_T)
|
||||
using atomics::atomic_char32_t;
|
||||
#endif
|
||||
|
||||
using atomics::atomic_int_least8_t;
|
||||
using atomics::atomic_uint_least8_t;
|
||||
using atomics::atomic_int_least16_t;
|
||||
using atomics::atomic_uint_least16_t;
|
||||
using atomics::atomic_int_least32_t;
|
||||
using atomics::atomic_uint_least32_t;
|
||||
using atomics::atomic_int_least64_t;
|
||||
using atomics::atomic_uint_least64_t;
|
||||
using atomics::atomic_int_fast8_t;
|
||||
using atomics::atomic_uint_fast8_t;
|
||||
using atomics::atomic_int_fast16_t;
|
||||
using atomics::atomic_uint_fast16_t;
|
||||
using atomics::atomic_int_fast32_t;
|
||||
using atomics::atomic_uint_fast32_t;
|
||||
using atomics::atomic_int_fast64_t;
|
||||
using atomics::atomic_uint_fast64_t;
|
||||
using atomics::atomic_intmax_t;
|
||||
using atomics::atomic_uintmax_t;
|
||||
|
||||
using atomics::atomic_size_t;
|
||||
using atomics::atomic_ptrdiff_t;
|
||||
|
||||
#if defined(BOOST_HAS_INTPTR_T)
|
||||
using atomics::atomic_intptr_t;
|
||||
using atomics::atomic_uintptr_t;
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ATOMIC_ATOMIC_HPP_INCLUDED_
|
||||
@@ -0,0 +1,259 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file make_expr_funop.hpp
|
||||
/// Contains definition of make_expr\<\>::operator() member functions.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
template<typename This , typename A0 , typename A1>
|
||||
struct result<This(A0 , A1)>
|
||||
{
|
||||
typedef
|
||||
typename result_of::make_expr<
|
||||
Tag
|
||||
, Domain
|
||||
, A0 , A1
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
|
||||
|
||||
template<typename A0 , typename A1>
|
||||
BOOST_FORCEINLINE
|
||||
typename result_of::make_expr<
|
||||
Tag
|
||||
, Domain
|
||||
, const A0 , const A1
|
||||
>::type const
|
||||
operator ()(const A0 &a0 , const A1 &a1) const
|
||||
{
|
||||
return proto::detail::make_expr_<
|
||||
Tag
|
||||
, Domain
|
||||
, const A0 , const A1
|
||||
>()(a0 , a1);
|
||||
}
|
||||
template<typename This , typename A0 , typename A1 , typename A2>
|
||||
struct result<This(A0 , A1 , A2)>
|
||||
{
|
||||
typedef
|
||||
typename result_of::make_expr<
|
||||
Tag
|
||||
, Domain
|
||||
, A0 , A1 , A2
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
|
||||
|
||||
template<typename A0 , typename A1 , typename A2>
|
||||
BOOST_FORCEINLINE
|
||||
typename result_of::make_expr<
|
||||
Tag
|
||||
, Domain
|
||||
, const A0 , const A1 , const A2
|
||||
>::type const
|
||||
operator ()(const A0 &a0 , const A1 &a1 , const A2 &a2) const
|
||||
{
|
||||
return proto::detail::make_expr_<
|
||||
Tag
|
||||
, Domain
|
||||
, const A0 , const A1 , const A2
|
||||
>()(a0 , a1 , a2);
|
||||
}
|
||||
template<typename This , typename A0 , typename A1 , typename A2 , typename A3>
|
||||
struct result<This(A0 , A1 , A2 , A3)>
|
||||
{
|
||||
typedef
|
||||
typename result_of::make_expr<
|
||||
Tag
|
||||
, Domain
|
||||
, A0 , A1 , A2 , A3
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
|
||||
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3>
|
||||
BOOST_FORCEINLINE
|
||||
typename result_of::make_expr<
|
||||
Tag
|
||||
, Domain
|
||||
, const A0 , const A1 , const A2 , const A3
|
||||
>::type const
|
||||
operator ()(const A0 &a0 , const A1 &a1 , const A2 &a2 , const A3 &a3) const
|
||||
{
|
||||
return proto::detail::make_expr_<
|
||||
Tag
|
||||
, Domain
|
||||
, const A0 , const A1 , const A2 , const A3
|
||||
>()(a0 , a1 , a2 , a3);
|
||||
}
|
||||
template<typename This , typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
|
||||
struct result<This(A0 , A1 , A2 , A3 , A4)>
|
||||
{
|
||||
typedef
|
||||
typename result_of::make_expr<
|
||||
Tag
|
||||
, Domain
|
||||
, A0 , A1 , A2 , A3 , A4
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
|
||||
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
|
||||
BOOST_FORCEINLINE
|
||||
typename result_of::make_expr<
|
||||
Tag
|
||||
, Domain
|
||||
, const A0 , const A1 , const A2 , const A3 , const A4
|
||||
>::type const
|
||||
operator ()(const A0 &a0 , const A1 &a1 , const A2 &a2 , const A3 &a3 , const A4 &a4) const
|
||||
{
|
||||
return proto::detail::make_expr_<
|
||||
Tag
|
||||
, Domain
|
||||
, const A0 , const A1 , const A2 , const A3 , const A4
|
||||
>()(a0 , a1 , a2 , a3 , a4);
|
||||
}
|
||||
template<typename This , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
|
||||
struct result<This(A0 , A1 , A2 , A3 , A4 , A5)>
|
||||
{
|
||||
typedef
|
||||
typename result_of::make_expr<
|
||||
Tag
|
||||
, Domain
|
||||
, A0 , A1 , A2 , A3 , A4 , A5
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
|
||||
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
|
||||
BOOST_FORCEINLINE
|
||||
typename result_of::make_expr<
|
||||
Tag
|
||||
, Domain
|
||||
, const A0 , const A1 , const A2 , const A3 , const A4 , const A5
|
||||
>::type const
|
||||
operator ()(const A0 &a0 , const A1 &a1 , const A2 &a2 , const A3 &a3 , const A4 &a4 , const A5 &a5) const
|
||||
{
|
||||
return proto::detail::make_expr_<
|
||||
Tag
|
||||
, Domain
|
||||
, const A0 , const A1 , const A2 , const A3 , const A4 , const A5
|
||||
>()(a0 , a1 , a2 , a3 , a4 , a5);
|
||||
}
|
||||
template<typename This , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
|
||||
struct result<This(A0 , A1 , A2 , A3 , A4 , A5 , A6)>
|
||||
{
|
||||
typedef
|
||||
typename result_of::make_expr<
|
||||
Tag
|
||||
, Domain
|
||||
, A0 , A1 , A2 , A3 , A4 , A5 , A6
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
|
||||
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
|
||||
BOOST_FORCEINLINE
|
||||
typename result_of::make_expr<
|
||||
Tag
|
||||
, Domain
|
||||
, const A0 , const A1 , const A2 , const A3 , const A4 , const A5 , const A6
|
||||
>::type const
|
||||
operator ()(const A0 &a0 , const A1 &a1 , const A2 &a2 , const A3 &a3 , const A4 &a4 , const A5 &a5 , const A6 &a6) const
|
||||
{
|
||||
return proto::detail::make_expr_<
|
||||
Tag
|
||||
, Domain
|
||||
, const A0 , const A1 , const A2 , const A3 , const A4 , const A5 , const A6
|
||||
>()(a0 , a1 , a2 , a3 , a4 , a5 , a6);
|
||||
}
|
||||
template<typename This , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
|
||||
struct result<This(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7)>
|
||||
{
|
||||
typedef
|
||||
typename result_of::make_expr<
|
||||
Tag
|
||||
, Domain
|
||||
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
|
||||
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
|
||||
BOOST_FORCEINLINE
|
||||
typename result_of::make_expr<
|
||||
Tag
|
||||
, Domain
|
||||
, const A0 , const A1 , const A2 , const A3 , const A4 , const A5 , const A6 , const A7
|
||||
>::type const
|
||||
operator ()(const A0 &a0 , const A1 &a1 , const A2 &a2 , const A3 &a3 , const A4 &a4 , const A5 &a5 , const A6 &a6 , const A7 &a7) const
|
||||
{
|
||||
return proto::detail::make_expr_<
|
||||
Tag
|
||||
, Domain
|
||||
, const A0 , const A1 , const A2 , const A3 , const A4 , const A5 , const A6 , const A7
|
||||
>()(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7);
|
||||
}
|
||||
template<typename This , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
|
||||
struct result<This(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8)>
|
||||
{
|
||||
typedef
|
||||
typename result_of::make_expr<
|
||||
Tag
|
||||
, Domain
|
||||
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
|
||||
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
|
||||
BOOST_FORCEINLINE
|
||||
typename result_of::make_expr<
|
||||
Tag
|
||||
, Domain
|
||||
, const A0 , const A1 , const A2 , const A3 , const A4 , const A5 , const A6 , const A7 , const A8
|
||||
>::type const
|
||||
operator ()(const A0 &a0 , const A1 &a1 , const A2 &a2 , const A3 &a3 , const A4 &a4 , const A5 &a5 , const A6 &a6 , const A7 &a7 , const A8 &a8) const
|
||||
{
|
||||
return proto::detail::make_expr_<
|
||||
Tag
|
||||
, Domain
|
||||
, const A0 , const A1 , const A2 , const A3 , const A4 , const A5 , const A6 , const A7 , const A8
|
||||
>()(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8);
|
||||
}
|
||||
template<typename This , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
|
||||
struct result<This(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9)>
|
||||
{
|
||||
typedef
|
||||
typename result_of::make_expr<
|
||||
Tag
|
||||
, Domain
|
||||
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
|
||||
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
|
||||
BOOST_FORCEINLINE
|
||||
typename result_of::make_expr<
|
||||
Tag
|
||||
, Domain
|
||||
, const A0 , const A1 , const A2 , const A3 , const A4 , const A5 , const A6 , const A7 , const A8 , const A9
|
||||
>::type const
|
||||
operator ()(const A0 &a0 , const A1 &a1 , const A2 &a2 , const A3 &a3 , const A4 &a4 , const A5 &a5 , const A6 &a6 , const A7 &a7 , const A8 &a8 , const A9 &a9) const
|
||||
{
|
||||
return proto::detail::make_expr_<
|
||||
Tag
|
||||
, Domain
|
||||
, const A0 , const A1 , const A2 , const A3 , const A4 , const A5 , const A6 , const A7 , const A8 , const A9
|
||||
>()(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*==============================================================================
|
||||
Copyright (c) 2011 Hartmut Kaiser
|
||||
|
||||
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_PHOENIX_PREPROCESSED_CONSTRUCT_EVAL)
|
||||
#define BOOST_PHOENIX_PREPROCESSED_CONSTRUCT_EVAL
|
||||
|
||||
#if BOOST_PHOENIX_LIMIT <= 10
|
||||
#include <boost/phoenix/object/detail/cpp03/preprocessed/construct_eval_10.hpp>
|
||||
#elif BOOST_PHOENIX_LIMIT <= 20
|
||||
#include <boost/phoenix/object/detail/cpp03/preprocessed/construct_eval_20.hpp>
|
||||
#elif BOOST_PHOENIX_LIMIT <= 30
|
||||
#include <boost/phoenix/object/detail/cpp03/preprocessed/construct_eval_30.hpp>
|
||||
#elif BOOST_PHOENIX_LIMIT <= 40
|
||||
#include <boost/phoenix/object/detail/cpp03/preprocessed/construct_eval_40.hpp>
|
||||
#elif BOOST_PHOENIX_LIMIT <= 50
|
||||
#include <boost/phoenix/object/detail/cpp03/preprocessed/construct_eval_50.hpp>
|
||||
#else
|
||||
#error "BOOST_PHOENIX_LIMIT out of bounds for preprocessed headers"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,97 @@
|
||||
// Copyright 2004 The Trustees of Indiana University.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Authors: Douglas Gregor
|
||||
// Andrew Lumsdaine
|
||||
#ifndef BOOST_PROPERTY_MAP_PARALLEL_PROCESS_GROUP_HPP
|
||||
#define BOOST_PROPERTY_MAP_PARALLEL_PROCESS_GROUP_HPP
|
||||
|
||||
#include <cstdlib>
|
||||
#include <utility>
|
||||
|
||||
namespace boost { namespace parallel {
|
||||
|
||||
/**
|
||||
* A special type used as a flag to a process group constructor that
|
||||
* indicates that the copy of a process group will represent a new
|
||||
* distributed data structure.
|
||||
*/
|
||||
struct attach_distributed_object { };
|
||||
|
||||
/**
|
||||
* Describes the context in which a trigger is being invoked to
|
||||
* receive a message.
|
||||
*/
|
||||
enum trigger_receive_context {
|
||||
/// No trigger is active at this time.
|
||||
trc_none,
|
||||
/// The trigger is being invoked during synchronization, at the end
|
||||
/// of a superstep.
|
||||
trc_in_synchronization,
|
||||
/// The trigger is being invoked as an "early" receive of a message
|
||||
/// that was sent through the normal "send" operations to be
|
||||
/// received by the end of the superstep, but the process group sent
|
||||
/// the message earlier to clear its buffers.
|
||||
trc_early_receive,
|
||||
/// The trigger is being invoked for an out-of-band message, which
|
||||
/// must be handled immediately.
|
||||
trc_out_of_band,
|
||||
/// The trigger is being invoked for an out-of-band message, which
|
||||
/// must be handled immediately and has alredy been received by
|
||||
/// an MPI_IRecv call.
|
||||
trc_irecv_out_of_band
|
||||
};
|
||||
|
||||
// Process group tags
|
||||
struct process_group_tag {};
|
||||
struct linear_process_group_tag : virtual process_group_tag {};
|
||||
struct messaging_process_group_tag : virtual process_group_tag {};
|
||||
struct immediate_process_group_tag : virtual messaging_process_group_tag {};
|
||||
struct bsp_process_group_tag : virtual messaging_process_group_tag {};
|
||||
struct batch_process_group_tag : virtual messaging_process_group_tag {};
|
||||
struct locking_process_group_tag : virtual process_group_tag {};
|
||||
struct spawning_process_group_tag : virtual process_group_tag {};
|
||||
|
||||
struct process_group_archetype
|
||||
{
|
||||
typedef int process_id_type;
|
||||
};
|
||||
|
||||
void wait(process_group_archetype&);
|
||||
void synchronize(process_group_archetype&);
|
||||
int process_id(const process_group_archetype&);
|
||||
int num_processes(const process_group_archetype&);
|
||||
|
||||
template<typename T> void send(process_group_archetype&, int, int, const T&);
|
||||
|
||||
template<typename T>
|
||||
process_group_archetype::process_id_type
|
||||
receive(const process_group_archetype& pg,
|
||||
process_group_archetype::process_id_type source, int tag, T& value);
|
||||
|
||||
template<typename T>
|
||||
std::pair<process_group_archetype::process_id_type, std::size_t>
|
||||
receive(const process_group_archetype& pg, int tag, T values[], std::size_t n);
|
||||
|
||||
template<typename T>
|
||||
std::pair<process_group_archetype::process_id_type, std::size_t>
|
||||
receive(const process_group_archetype& pg,
|
||||
process_group_archetype::process_id_type source, int tag, T values[],
|
||||
std::size_t n);
|
||||
|
||||
} } // end namespace boost::parallel
|
||||
|
||||
namespace boost { namespace graph { namespace distributed {
|
||||
using boost::parallel::trigger_receive_context;
|
||||
using boost::parallel::trc_early_receive;
|
||||
using boost::parallel::trc_out_of_band;
|
||||
using boost::parallel::trc_irecv_out_of_band;
|
||||
using boost::parallel::trc_in_synchronization;
|
||||
using boost::parallel::trc_none;
|
||||
using boost::parallel::attach_distributed_object;
|
||||
} } } // end namespace boost::graph::distributed
|
||||
|
||||
#endif // BOOST_PROPERTY_MAP_PARALLEL_PROCESS_GROUP_HPP
|
||||
@@ -0,0 +1,57 @@
|
||||
// Boost.Units - A C++ library for zero-overhead dimensional analysis and
|
||||
// unit/quantity manipulation and conversion
|
||||
//
|
||||
// Copyright (C) 2003-2008 Matthias Christian Schabel
|
||||
// Copyright (C) 2008 Steven Watanabe
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_UNITS_UTILITY_HPP
|
||||
#define BOOST_UNITS_UTILITY_HPP
|
||||
|
||||
#include <typeinfo>
|
||||
#include <string>
|
||||
#include <boost/core/demangle.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace units {
|
||||
|
||||
namespace detail {
|
||||
|
||||
inline
|
||||
std::string
|
||||
demangle(const char* name)
|
||||
{
|
||||
std::string demangled = core::demangle(name);
|
||||
|
||||
const std::string::size_type prefix_len = sizeof("boost::units::") - 1;
|
||||
std::string::size_type i = 0;
|
||||
for (;;)
|
||||
{
|
||||
std::string::size_type pos = demangled.find("boost::units::", i, prefix_len);
|
||||
if (pos == std::string::npos)
|
||||
break;
|
||||
|
||||
demangled.erase(pos, prefix_len);
|
||||
i = pos;
|
||||
}
|
||||
|
||||
return demangled;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template<class L>
|
||||
inline std::string simplify_typename(const L& /*source*/)
|
||||
{
|
||||
return detail::demangle(typeid(L).name());
|
||||
}
|
||||
|
||||
} // namespace units
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_UNITS_UTILITY_HPP
|
||||
@@ -0,0 +1,39 @@
|
||||
// (C) Copyright Gennadiy Rozental 2001.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/libs/test for the library home page.
|
||||
//
|
||||
//!@file
|
||||
//!@brief Included (vs. linked) version of Unit Test Framework
|
||||
// ***************************************************************************
|
||||
|
||||
#ifndef BOOST_INCLUDED_UNIT_TEST_FRAMEWORK_HPP_071894GER
|
||||
#define BOOST_INCLUDED_UNIT_TEST_FRAMEWORK_HPP_071894GER
|
||||
|
||||
#define BOOST_TEST_INCLUDED
|
||||
|
||||
#include <boost/test/impl/compiler_log_formatter.ipp>
|
||||
#include <boost/test/impl/junit_log_formatter.ipp>
|
||||
#include <boost/test/impl/debug.ipp>
|
||||
#include <boost/test/impl/decorator.ipp>
|
||||
#include <boost/test/impl/framework.ipp>
|
||||
#include <boost/test/impl/execution_monitor.ipp>
|
||||
#include <boost/test/impl/plain_report_formatter.ipp>
|
||||
#include <boost/test/impl/progress_monitor.ipp>
|
||||
#include <boost/test/impl/results_collector.ipp>
|
||||
#include <boost/test/impl/results_reporter.ipp>
|
||||
#include <boost/test/impl/test_tools.ipp>
|
||||
#include <boost/test/impl/test_tree.ipp>
|
||||
#include <boost/test/impl/unit_test_log.ipp>
|
||||
#include <boost/test/impl/unit_test_main.ipp>
|
||||
#include <boost/test/impl/unit_test_monitor.ipp>
|
||||
#include <boost/test/impl/unit_test_parameters.ipp>
|
||||
#include <boost/test/impl/xml_log_formatter.ipp>
|
||||
#include <boost/test/impl/junit_log_formatter.ipp>
|
||||
#include <boost/test/impl/xml_report_formatter.ipp>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#endif // BOOST_INCLUDED_UNIT_TEST_FRAMEWORK_HPP_071894GER
|
||||
@@ -0,0 +1,47 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_CONVERT_IMPL_09222005_1104)
|
||||
#define FUSION_CONVERT_IMPL_09222005_1104
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/container/vector/detail/as_vector.hpp>
|
||||
#include <boost/fusion/container/vector/vector.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/size.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct vector_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename T>
|
||||
struct convert_impl;
|
||||
|
||||
template <>
|
||||
struct convert_impl<vector_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply
|
||||
{
|
||||
typedef typename detail::as_vector<result_of::size<Sequence>::value> gen;
|
||||
typedef typename gen::
|
||||
template apply<typename result_of::begin<Sequence>::type>::type
|
||||
type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type call(Sequence& seq)
|
||||
{
|
||||
return gen::call(fusion::begin(seq));
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,33 @@
|
||||
// Boost.Units - A C++ library for zero-overhead dimensional analysis and
|
||||
// unit/quantity manipulation and conversion
|
||||
//
|
||||
// Copyright (C) 2003-2008 Matthias Christian Schabel
|
||||
// Copyright (C) 2008 Steven Watanabe
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_UNITS_SI_TEMPERATURE_HPP
|
||||
#define BOOST_UNITS_SI_TEMPERATURE_HPP
|
||||
|
||||
#include <boost/units/systems/si/base.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace units {
|
||||
|
||||
namespace si {
|
||||
|
||||
typedef unit<temperature_dimension,si::system> temperature;
|
||||
|
||||
BOOST_UNITS_STATIC_CONSTANT(kelvin,temperature);
|
||||
BOOST_UNITS_STATIC_CONSTANT(kelvins,temperature);
|
||||
|
||||
} // namespace si
|
||||
|
||||
} // namespace units
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_UNITS_SI_TEMPERATURE_HPP
|
||||
@@ -0,0 +1,29 @@
|
||||
|
||||
#ifndef BOOST_MPL_AUX_CONFIG_OVERLOAD_RESOLUTION_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_CONFIG_OVERLOAD_RESOLUTION_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2002-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_/config/workaround.hpp>
|
||||
|
||||
#if !defined(BOOST_MPL_CFG_BROKEN_OVERLOAD_RESOLUTION) \
|
||||
&& !defined(BOOST_MPL_PREPROCESSING_MODE) \
|
||||
&& ( BOOST_WORKAROUND(__BORLANDC__, < 0x590) \
|
||||
|| BOOST_WORKAROUND(__MWERKS__, < 0x3001) \
|
||||
)
|
||||
|
||||
# define BOOST_MPL_CFG_BROKEN_OVERLOAD_RESOLUTION
|
||||
|
||||
#endif
|
||||
|
||||
#endif // BOOST_MPL_AUX_CONFIG_OVERLOAD_RESOLUTION_HPP_INCLUDED
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.7 KiB |
@@ -0,0 +1,73 @@
|
||||
#ifndef BOOST_SERIALIZATION_TYPE_INFO_IMPLEMENTATION_HPP
|
||||
#define BOOST_SERIALIZATION_TYPE_INFO_IMPLEMENTATION_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// type_info_implementation.hpp: interface for portable version of type_info
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/type_traits/is_base_and_derived.hpp>
|
||||
#include <boost/serialization/traits.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
|
||||
// note that T and const T are folded into const T so that
|
||||
// there is only one table entry per type
|
||||
template<class T>
|
||||
struct type_info_implementation {
|
||||
template<class U>
|
||||
struct traits_class_typeinfo_implementation {
|
||||
typedef typename U::type_info_implementation::type type;
|
||||
};
|
||||
// note: at least one compiler complained w/o the full qualification
|
||||
// on basic traits below
|
||||
typedef
|
||||
typename mpl::eval_if<
|
||||
is_base_and_derived<boost::serialization::basic_traits, T>,
|
||||
traits_class_typeinfo_implementation< T >,
|
||||
//else
|
||||
mpl::identity<
|
||||
typename extended_type_info_impl< T >::type
|
||||
>
|
||||
>::type type;
|
||||
};
|
||||
|
||||
} // namespace serialization
|
||||
} // namespace boost
|
||||
|
||||
// define a macro to assign a particular derivation of extended_type_info
|
||||
// to a specified a class.
|
||||
#define BOOST_CLASS_TYPE_INFO(T, ETI) \
|
||||
namespace boost { \
|
||||
namespace serialization { \
|
||||
template<> \
|
||||
struct type_info_implementation< T > { \
|
||||
typedef ETI type; \
|
||||
}; \
|
||||
template<> \
|
||||
struct type_info_implementation< const T > { \
|
||||
typedef ETI type; \
|
||||
}; \
|
||||
} \
|
||||
} \
|
||||
/**/
|
||||
|
||||
#endif /// BOOST_SERIALIZATION_TYPE_INFO_IMPLEMENTATION_HPP
|
||||
@@ -0,0 +1,251 @@
|
||||
/*=============================================================================
|
||||
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!
|
||||
==============================================================================*/
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
template <typename T0>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline tuple<T0&>
|
||||
tie(T0 & arg0)
|
||||
{
|
||||
return tuple<T0&>(
|
||||
arg0);
|
||||
}
|
||||
template <typename T0 , typename T1>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline tuple<T0& , T1&>
|
||||
tie(T0 & arg0 , T1 & arg1)
|
||||
{
|
||||
return tuple<T0& , T1&>(
|
||||
arg0 , arg1);
|
||||
}
|
||||
template <typename T0 , typename T1 , typename T2>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline tuple<T0& , T1& , T2&>
|
||||
tie(T0 & arg0 , T1 & arg1 , T2 & arg2)
|
||||
{
|
||||
return tuple<T0& , T1& , T2&>(
|
||||
arg0 , arg1 , arg2);
|
||||
}
|
||||
template <typename T0 , typename T1 , typename T2 , typename T3>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline tuple<T0& , T1& , T2& , T3&>
|
||||
tie(T0 & arg0 , T1 & arg1 , T2 & arg2 , T3 & arg3)
|
||||
{
|
||||
return tuple<T0& , T1& , T2& , T3&>(
|
||||
arg0 , arg1 , arg2 , arg3);
|
||||
}
|
||||
template <typename T0 , typename T1 , typename T2 , typename T3 , typename T4>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline tuple<T0& , T1& , T2& , T3& , T4&>
|
||||
tie(T0 & arg0 , T1 & arg1 , T2 & arg2 , T3 & arg3 , T4 & arg4)
|
||||
{
|
||||
return tuple<T0& , T1& , T2& , T3& , T4&>(
|
||||
arg0 , arg1 , arg2 , arg3 , arg4);
|
||||
}
|
||||
template <typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline tuple<T0& , T1& , T2& , T3& , T4& , T5&>
|
||||
tie(T0 & arg0 , T1 & arg1 , T2 & arg2 , T3 & arg3 , T4 & arg4 , T5 & arg5)
|
||||
{
|
||||
return tuple<T0& , T1& , T2& , T3& , T4& , T5&>(
|
||||
arg0 , arg1 , arg2 , arg3 , arg4 , arg5);
|
||||
}
|
||||
template <typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6&>
|
||||
tie(T0 & arg0 , T1 & arg1 , T2 & arg2 , T3 & arg3 , T4 & arg4 , T5 & arg5 , T6 & arg6)
|
||||
{
|
||||
return tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6&>(
|
||||
arg0 , arg1 , arg2 , arg3 , arg4 , arg5 , arg6);
|
||||
}
|
||||
template <typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7&>
|
||||
tie(T0 & arg0 , T1 & arg1 , T2 & arg2 , T3 & arg3 , T4 & arg4 , T5 & arg5 , T6 & arg6 , T7 & arg7)
|
||||
{
|
||||
return tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7&>(
|
||||
arg0 , arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7);
|
||||
}
|
||||
template <typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8&>
|
||||
tie(T0 & arg0 , T1 & arg1 , T2 & arg2 , T3 & arg3 , T4 & arg4 , T5 & arg5 , T6 & arg6 , T7 & arg7 , T8 & arg8)
|
||||
{
|
||||
return tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8&>(
|
||||
arg0 , arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 , arg8);
|
||||
}
|
||||
template <typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9&>
|
||||
tie(T0 & arg0 , T1 & arg1 , T2 & arg2 , T3 & arg3 , T4 & arg4 , T5 & arg5 , T6 & arg6 , T7 & arg7 , T8 & arg8 , T9 & arg9)
|
||||
{
|
||||
return tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9&>(
|
||||
arg0 , arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 , arg8 , arg9);
|
||||
}
|
||||
template <typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10&>
|
||||
tie(T0 & arg0 , T1 & arg1 , T2 & arg2 , T3 & arg3 , T4 & arg4 , T5 & arg5 , T6 & arg6 , T7 & arg7 , T8 & arg8 , T9 & arg9 , T10 & arg10)
|
||||
{
|
||||
return tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10&>(
|
||||
arg0 , arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 , arg8 , arg9 , arg10);
|
||||
}
|
||||
template <typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11&>
|
||||
tie(T0 & arg0 , T1 & arg1 , T2 & arg2 , T3 & arg3 , T4 & arg4 , T5 & arg5 , T6 & arg6 , T7 & arg7 , T8 & arg8 , T9 & arg9 , T10 & arg10 , T11 & arg11)
|
||||
{
|
||||
return tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11&>(
|
||||
arg0 , arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 , arg8 , arg9 , arg10 , arg11);
|
||||
}
|
||||
template <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>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12&>
|
||||
tie(T0 & arg0 , T1 & arg1 , T2 & arg2 , T3 & arg3 , T4 & arg4 , T5 & arg5 , T6 & arg6 , T7 & arg7 , T8 & arg8 , T9 & arg9 , T10 & arg10 , T11 & arg11 , T12 & arg12)
|
||||
{
|
||||
return tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12&>(
|
||||
arg0 , arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 , arg8 , arg9 , arg10 , arg11 , arg12);
|
||||
}
|
||||
template <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>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13&>
|
||||
tie(T0 & arg0 , T1 & arg1 , T2 & arg2 , T3 & arg3 , T4 & arg4 , T5 & arg5 , T6 & arg6 , T7 & arg7 , T8 & arg8 , T9 & arg9 , T10 & arg10 , T11 & arg11 , T12 & arg12 , T13 & arg13)
|
||||
{
|
||||
return tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13&>(
|
||||
arg0 , arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 , arg8 , arg9 , arg10 , arg11 , arg12 , arg13);
|
||||
}
|
||||
template <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>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14&>
|
||||
tie(T0 & arg0 , T1 & arg1 , T2 & arg2 , T3 & arg3 , T4 & arg4 , T5 & arg5 , T6 & arg6 , T7 & arg7 , T8 & arg8 , T9 & arg9 , T10 & arg10 , T11 & arg11 , T12 & arg12 , T13 & arg13 , T14 & arg14)
|
||||
{
|
||||
return tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14&>(
|
||||
arg0 , arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 , arg8 , arg9 , arg10 , arg11 , arg12 , arg13 , arg14);
|
||||
}
|
||||
template <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>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14& , T15&>
|
||||
tie(T0 & arg0 , T1 & arg1 , T2 & arg2 , T3 & arg3 , T4 & arg4 , T5 & arg5 , T6 & arg6 , T7 & arg7 , T8 & arg8 , T9 & arg9 , T10 & arg10 , T11 & arg11 , T12 & arg12 , T13 & arg13 , T14 & arg14 , T15 & arg15)
|
||||
{
|
||||
return tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14& , T15&>(
|
||||
arg0 , arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 , arg8 , arg9 , arg10 , arg11 , arg12 , arg13 , arg14 , arg15);
|
||||
}
|
||||
template <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>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14& , T15& , T16&>
|
||||
tie(T0 & arg0 , T1 & arg1 , T2 & arg2 , T3 & arg3 , T4 & arg4 , T5 & arg5 , T6 & arg6 , T7 & arg7 , T8 & arg8 , T9 & arg9 , T10 & arg10 , T11 & arg11 , T12 & arg12 , T13 & arg13 , T14 & arg14 , T15 & arg15 , T16 & arg16)
|
||||
{
|
||||
return tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14& , T15& , T16&>(
|
||||
arg0 , arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 , arg8 , arg9 , arg10 , arg11 , arg12 , arg13 , arg14 , arg15 , arg16);
|
||||
}
|
||||
template <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>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14& , T15& , T16& , T17&>
|
||||
tie(T0 & arg0 , T1 & arg1 , T2 & arg2 , T3 & arg3 , T4 & arg4 , T5 & arg5 , T6 & arg6 , T7 & arg7 , T8 & arg8 , T9 & arg9 , T10 & arg10 , T11 & arg11 , T12 & arg12 , T13 & arg13 , T14 & arg14 , T15 & arg15 , T16 & arg16 , T17 & arg17)
|
||||
{
|
||||
return tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14& , T15& , T16& , T17&>(
|
||||
arg0 , arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 , arg8 , arg9 , arg10 , arg11 , arg12 , arg13 , arg14 , arg15 , arg16 , arg17);
|
||||
}
|
||||
template <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>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14& , T15& , T16& , T17& , T18&>
|
||||
tie(T0 & arg0 , T1 & arg1 , T2 & arg2 , T3 & arg3 , T4 & arg4 , T5 & arg5 , T6 & arg6 , T7 & arg7 , T8 & arg8 , T9 & arg9 , T10 & arg10 , T11 & arg11 , T12 & arg12 , T13 & arg13 , T14 & arg14 , T15 & arg15 , T16 & arg16 , T17 & arg17 , T18 & arg18)
|
||||
{
|
||||
return tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14& , T15& , T16& , T17& , T18&>(
|
||||
arg0 , arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 , arg8 , arg9 , arg10 , arg11 , arg12 , arg13 , arg14 , arg15 , arg16 , arg17 , arg18);
|
||||
}
|
||||
template <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>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14& , T15& , T16& , T17& , T18& , T19&>
|
||||
tie(T0 & arg0 , T1 & arg1 , T2 & arg2 , T3 & arg3 , T4 & arg4 , T5 & arg5 , T6 & arg6 , T7 & arg7 , T8 & arg8 , T9 & arg9 , T10 & arg10 , T11 & arg11 , T12 & arg12 , T13 & arg13 , T14 & arg14 , T15 & arg15 , T16 & arg16 , T17 & arg17 , T18 & arg18 , T19 & arg19)
|
||||
{
|
||||
return tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14& , T15& , T16& , T17& , T18& , T19&>(
|
||||
arg0 , arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 , arg8 , arg9 , arg10 , arg11 , arg12 , arg13 , arg14 , arg15 , arg16 , arg17 , arg18 , arg19);
|
||||
}
|
||||
template <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 T20>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14& , T15& , T16& , T17& , T18& , T19& , T20&>
|
||||
tie(T0 & arg0 , T1 & arg1 , T2 & arg2 , T3 & arg3 , T4 & arg4 , T5 & arg5 , T6 & arg6 , T7 & arg7 , T8 & arg8 , T9 & arg9 , T10 & arg10 , T11 & arg11 , T12 & arg12 , T13 & arg13 , T14 & arg14 , T15 & arg15 , T16 & arg16 , T17 & arg17 , T18 & arg18 , T19 & arg19 , T20 & arg20)
|
||||
{
|
||||
return tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14& , T15& , T16& , T17& , T18& , T19& , T20&>(
|
||||
arg0 , arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 , arg8 , arg9 , arg10 , arg11 , arg12 , arg13 , arg14 , arg15 , arg16 , arg17 , arg18 , arg19 , arg20);
|
||||
}
|
||||
template <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 T20 , typename T21>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14& , T15& , T16& , T17& , T18& , T19& , T20& , T21&>
|
||||
tie(T0 & arg0 , T1 & arg1 , T2 & arg2 , T3 & arg3 , T4 & arg4 , T5 & arg5 , T6 & arg6 , T7 & arg7 , T8 & arg8 , T9 & arg9 , T10 & arg10 , T11 & arg11 , T12 & arg12 , T13 & arg13 , T14 & arg14 , T15 & arg15 , T16 & arg16 , T17 & arg17 , T18 & arg18 , T19 & arg19 , T20 & arg20 , T21 & arg21)
|
||||
{
|
||||
return tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14& , T15& , T16& , T17& , T18& , T19& , T20& , T21&>(
|
||||
arg0 , arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 , arg8 , arg9 , arg10 , arg11 , arg12 , arg13 , arg14 , arg15 , arg16 , arg17 , arg18 , arg19 , arg20 , arg21);
|
||||
}
|
||||
template <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 T20 , typename T21 , typename T22>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14& , T15& , T16& , T17& , T18& , T19& , T20& , T21& , T22&>
|
||||
tie(T0 & arg0 , T1 & arg1 , T2 & arg2 , T3 & arg3 , T4 & arg4 , T5 & arg5 , T6 & arg6 , T7 & arg7 , T8 & arg8 , T9 & arg9 , T10 & arg10 , T11 & arg11 , T12 & arg12 , T13 & arg13 , T14 & arg14 , T15 & arg15 , T16 & arg16 , T17 & arg17 , T18 & arg18 , T19 & arg19 , T20 & arg20 , T21 & arg21 , T22 & arg22)
|
||||
{
|
||||
return tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14& , T15& , T16& , T17& , T18& , T19& , T20& , T21& , T22&>(
|
||||
arg0 , arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 , arg8 , arg9 , arg10 , arg11 , arg12 , arg13 , arg14 , arg15 , arg16 , arg17 , arg18 , arg19 , arg20 , arg21 , arg22);
|
||||
}
|
||||
template <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 T20 , typename T21 , typename T22 , typename T23>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14& , T15& , T16& , T17& , T18& , T19& , T20& , T21& , T22& , T23&>
|
||||
tie(T0 & arg0 , T1 & arg1 , T2 & arg2 , T3 & arg3 , T4 & arg4 , T5 & arg5 , T6 & arg6 , T7 & arg7 , T8 & arg8 , T9 & arg9 , T10 & arg10 , T11 & arg11 , T12 & arg12 , T13 & arg13 , T14 & arg14 , T15 & arg15 , T16 & arg16 , T17 & arg17 , T18 & arg18 , T19 & arg19 , T20 & arg20 , T21 & arg21 , T22 & arg22 , T23 & arg23)
|
||||
{
|
||||
return tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14& , T15& , T16& , T17& , T18& , T19& , T20& , T21& , T22& , T23&>(
|
||||
arg0 , arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 , arg8 , arg9 , arg10 , arg11 , arg12 , arg13 , arg14 , arg15 , arg16 , arg17 , arg18 , arg19 , arg20 , arg21 , arg22 , arg23);
|
||||
}
|
||||
template <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 T20 , typename T21 , typename T22 , typename T23 , typename T24>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14& , T15& , T16& , T17& , T18& , T19& , T20& , T21& , T22& , T23& , T24&>
|
||||
tie(T0 & arg0 , T1 & arg1 , T2 & arg2 , T3 & arg3 , T4 & arg4 , T5 & arg5 , T6 & arg6 , T7 & arg7 , T8 & arg8 , T9 & arg9 , T10 & arg10 , T11 & arg11 , T12 & arg12 , T13 & arg13 , T14 & arg14 , T15 & arg15 , T16 & arg16 , T17 & arg17 , T18 & arg18 , T19 & arg19 , T20 & arg20 , T21 & arg21 , T22 & arg22 , T23 & arg23 , T24 & arg24)
|
||||
{
|
||||
return tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14& , T15& , T16& , T17& , T18& , T19& , T20& , T21& , T22& , T23& , T24&>(
|
||||
arg0 , arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 , arg8 , arg9 , arg10 , arg11 , arg12 , arg13 , arg14 , arg15 , arg16 , arg17 , arg18 , arg19 , arg20 , arg21 , arg22 , arg23 , arg24);
|
||||
}
|
||||
template <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 T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14& , T15& , T16& , T17& , T18& , T19& , T20& , T21& , T22& , T23& , T24& , T25&>
|
||||
tie(T0 & arg0 , T1 & arg1 , T2 & arg2 , T3 & arg3 , T4 & arg4 , T5 & arg5 , T6 & arg6 , T7 & arg7 , T8 & arg8 , T9 & arg9 , T10 & arg10 , T11 & arg11 , T12 & arg12 , T13 & arg13 , T14 & arg14 , T15 & arg15 , T16 & arg16 , T17 & arg17 , T18 & arg18 , T19 & arg19 , T20 & arg20 , T21 & arg21 , T22 & arg22 , T23 & arg23 , T24 & arg24 , T25 & arg25)
|
||||
{
|
||||
return tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14& , T15& , T16& , T17& , T18& , T19& , T20& , T21& , T22& , T23& , T24& , T25&>(
|
||||
arg0 , arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 , arg8 , arg9 , arg10 , arg11 , arg12 , arg13 , arg14 , arg15 , arg16 , arg17 , arg18 , arg19 , arg20 , arg21 , arg22 , arg23 , arg24 , arg25);
|
||||
}
|
||||
template <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 T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14& , T15& , T16& , T17& , T18& , T19& , T20& , T21& , T22& , T23& , T24& , T25& , T26&>
|
||||
tie(T0 & arg0 , T1 & arg1 , T2 & arg2 , T3 & arg3 , T4 & arg4 , T5 & arg5 , T6 & arg6 , T7 & arg7 , T8 & arg8 , T9 & arg9 , T10 & arg10 , T11 & arg11 , T12 & arg12 , T13 & arg13 , T14 & arg14 , T15 & arg15 , T16 & arg16 , T17 & arg17 , T18 & arg18 , T19 & arg19 , T20 & arg20 , T21 & arg21 , T22 & arg22 , T23 & arg23 , T24 & arg24 , T25 & arg25 , T26 & arg26)
|
||||
{
|
||||
return tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14& , T15& , T16& , T17& , T18& , T19& , T20& , T21& , T22& , T23& , T24& , T25& , T26&>(
|
||||
arg0 , arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 , arg8 , arg9 , arg10 , arg11 , arg12 , arg13 , arg14 , arg15 , arg16 , arg17 , arg18 , arg19 , arg20 , arg21 , arg22 , arg23 , arg24 , arg25 , arg26);
|
||||
}
|
||||
template <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 T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14& , T15& , T16& , T17& , T18& , T19& , T20& , T21& , T22& , T23& , T24& , T25& , T26& , T27&>
|
||||
tie(T0 & arg0 , T1 & arg1 , T2 & arg2 , T3 & arg3 , T4 & arg4 , T5 & arg5 , T6 & arg6 , T7 & arg7 , T8 & arg8 , T9 & arg9 , T10 & arg10 , T11 & arg11 , T12 & arg12 , T13 & arg13 , T14 & arg14 , T15 & arg15 , T16 & arg16 , T17 & arg17 , T18 & arg18 , T19 & arg19 , T20 & arg20 , T21 & arg21 , T22 & arg22 , T23 & arg23 , T24 & arg24 , T25 & arg25 , T26 & arg26 , T27 & arg27)
|
||||
{
|
||||
return tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14& , T15& , T16& , T17& , T18& , T19& , T20& , T21& , T22& , T23& , T24& , T25& , T26& , T27&>(
|
||||
arg0 , arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 , arg8 , arg9 , arg10 , arg11 , arg12 , arg13 , arg14 , arg15 , arg16 , arg17 , arg18 , arg19 , arg20 , arg21 , arg22 , arg23 , arg24 , arg25 , arg26 , arg27);
|
||||
}
|
||||
template <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 T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14& , T15& , T16& , T17& , T18& , T19& , T20& , T21& , T22& , T23& , T24& , T25& , T26& , T27& , T28&>
|
||||
tie(T0 & arg0 , T1 & arg1 , T2 & arg2 , T3 & arg3 , T4 & arg4 , T5 & arg5 , T6 & arg6 , T7 & arg7 , T8 & arg8 , T9 & arg9 , T10 & arg10 , T11 & arg11 , T12 & arg12 , T13 & arg13 , T14 & arg14 , T15 & arg15 , T16 & arg16 , T17 & arg17 , T18 & arg18 , T19 & arg19 , T20 & arg20 , T21 & arg21 , T22 & arg22 , T23 & arg23 , T24 & arg24 , T25 & arg25 , T26 & arg26 , T27 & arg27 , T28 & arg28)
|
||||
{
|
||||
return tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14& , T15& , T16& , T17& , T18& , T19& , T20& , T21& , T22& , T23& , T24& , T25& , T26& , T27& , T28&>(
|
||||
arg0 , arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 , arg8 , arg9 , arg10 , arg11 , arg12 , arg13 , arg14 , arg15 , arg16 , arg17 , arg18 , arg19 , arg20 , arg21 , arg22 , arg23 , arg24 , arg25 , arg26 , arg27 , arg28);
|
||||
}
|
||||
template <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 T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14& , T15& , T16& , T17& , T18& , T19& , T20& , T21& , T22& , T23& , T24& , T25& , T26& , T27& , T28& , T29&>
|
||||
tie(T0 & arg0 , T1 & arg1 , T2 & arg2 , T3 & arg3 , T4 & arg4 , T5 & arg5 , T6 & arg6 , T7 & arg7 , T8 & arg8 , T9 & arg9 , T10 & arg10 , T11 & arg11 , T12 & arg12 , T13 & arg13 , T14 & arg14 , T15 & arg15 , T16 & arg16 , T17 & arg17 , T18 & arg18 , T19 & arg19 , T20 & arg20 , T21 & arg21 , T22 & arg22 , T23 & arg23 , T24 & arg24 , T25 & arg25 , T26 & arg26 , T27 & arg27 , T28 & arg28 , T29 & arg29)
|
||||
{
|
||||
return tuple<T0& , T1& , T2& , T3& , T4& , T5& , T6& , T7& , T8& , T9& , T10& , T11& , T12& , T13& , T14& , T15& , T16& , T17& , T18& , T19& , T20& , T21& , T22& , T23& , T24& , T25& , T26& , T27& , T28& , T29&>(
|
||||
arg0 , arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 , arg8 , arg9 , arg10 , arg11 , arg12 , arg13 , arg14 , arg15 , arg16 , arg17 , arg18 , arg19 , arg20 , arg21 , arg22 , arg23 , arg24 , arg25 , arg26 , arg27 , arg28 , arg29);
|
||||
}
|
||||
}}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_SEQUENCE_INTRINSIC_10022005_0618)
|
||||
#define FUSION_SEQUENCE_INTRINSIC_10022005_0618
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/at.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/back.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/empty.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/front.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/has_key.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/segments.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/size.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/value_at.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/at_key.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/value_at_key.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/swap.hpp>
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,99 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Paul Mensonides 2002.
|
||||
# * Distributed under the Boost Software License, Version 1.0. (See
|
||||
# * accompanying file LICENSE_1_0.txt or copy at
|
||||
# * http://www.boost.org/LICENSE_1_0.txt)
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# include <boost/preprocessor/slot/detail/shared.hpp>
|
||||
#
|
||||
# undef BOOST_PP_ITERATION_FINISH_3
|
||||
#
|
||||
# undef BOOST_PP_ITERATION_FINISH_3_DIGIT_1
|
||||
# undef BOOST_PP_ITERATION_FINISH_3_DIGIT_2
|
||||
# undef BOOST_PP_ITERATION_FINISH_3_DIGIT_3
|
||||
# undef BOOST_PP_ITERATION_FINISH_3_DIGIT_4
|
||||
# undef BOOST_PP_ITERATION_FINISH_3_DIGIT_5
|
||||
# undef BOOST_PP_ITERATION_FINISH_3_DIGIT_6
|
||||
# undef BOOST_PP_ITERATION_FINISH_3_DIGIT_7
|
||||
# undef BOOST_PP_ITERATION_FINISH_3_DIGIT_8
|
||||
# undef BOOST_PP_ITERATION_FINISH_3_DIGIT_9
|
||||
# undef BOOST_PP_ITERATION_FINISH_3_DIGIT_10
|
||||
#
|
||||
# if BOOST_PP_SLOT_TEMP_3 == 0
|
||||
# define BOOST_PP_ITERATION_FINISH_3_DIGIT_3 0
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 1
|
||||
# define BOOST_PP_ITERATION_FINISH_3_DIGIT_3 1
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 2
|
||||
# define BOOST_PP_ITERATION_FINISH_3_DIGIT_3 2
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 3
|
||||
# define BOOST_PP_ITERATION_FINISH_3_DIGIT_3 3
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 4
|
||||
# define BOOST_PP_ITERATION_FINISH_3_DIGIT_3 4
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 5
|
||||
# define BOOST_PP_ITERATION_FINISH_3_DIGIT_3 5
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 6
|
||||
# define BOOST_PP_ITERATION_FINISH_3_DIGIT_3 6
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 7
|
||||
# define BOOST_PP_ITERATION_FINISH_3_DIGIT_3 7
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 8
|
||||
# define BOOST_PP_ITERATION_FINISH_3_DIGIT_3 8
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 9
|
||||
# define BOOST_PP_ITERATION_FINISH_3_DIGIT_3 9
|
||||
# endif
|
||||
#
|
||||
# if BOOST_PP_SLOT_TEMP_2 == 0
|
||||
# define BOOST_PP_ITERATION_FINISH_3_DIGIT_2 0
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 1
|
||||
# define BOOST_PP_ITERATION_FINISH_3_DIGIT_2 1
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 2
|
||||
# define BOOST_PP_ITERATION_FINISH_3_DIGIT_2 2
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 3
|
||||
# define BOOST_PP_ITERATION_FINISH_3_DIGIT_2 3
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 4
|
||||
# define BOOST_PP_ITERATION_FINISH_3_DIGIT_2 4
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 5
|
||||
# define BOOST_PP_ITERATION_FINISH_3_DIGIT_2 5
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 6
|
||||
# define BOOST_PP_ITERATION_FINISH_3_DIGIT_2 6
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 7
|
||||
# define BOOST_PP_ITERATION_FINISH_3_DIGIT_2 7
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 8
|
||||
# define BOOST_PP_ITERATION_FINISH_3_DIGIT_2 8
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 9
|
||||
# define BOOST_PP_ITERATION_FINISH_3_DIGIT_2 9
|
||||
# endif
|
||||
#
|
||||
# if BOOST_PP_SLOT_TEMP_1 == 0
|
||||
# define BOOST_PP_ITERATION_FINISH_3_DIGIT_1 0
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 1
|
||||
# define BOOST_PP_ITERATION_FINISH_3_DIGIT_1 1
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 2
|
||||
# define BOOST_PP_ITERATION_FINISH_3_DIGIT_1 2
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 3
|
||||
# define BOOST_PP_ITERATION_FINISH_3_DIGIT_1 3
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 4
|
||||
# define BOOST_PP_ITERATION_FINISH_3_DIGIT_1 4
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 5
|
||||
# define BOOST_PP_ITERATION_FINISH_3_DIGIT_1 5
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 6
|
||||
# define BOOST_PP_ITERATION_FINISH_3_DIGIT_1 6
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 7
|
||||
# define BOOST_PP_ITERATION_FINISH_3_DIGIT_1 7
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 8
|
||||
# define BOOST_PP_ITERATION_FINISH_3_DIGIT_1 8
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 9
|
||||
# define BOOST_PP_ITERATION_FINISH_3_DIGIT_1 9
|
||||
# endif
|
||||
#
|
||||
# if BOOST_PP_ITERATION_FINISH_3_DIGIT_3
|
||||
# define BOOST_PP_ITERATION_FINISH_3 BOOST_PP_SLOT_CC_3(BOOST_PP_ITERATION_FINISH_3_DIGIT_3, BOOST_PP_ITERATION_FINISH_3_DIGIT_2, BOOST_PP_ITERATION_FINISH_3_DIGIT_1)
|
||||
# elif BOOST_PP_ITERATION_FINISH_3_DIGIT_2
|
||||
# define BOOST_PP_ITERATION_FINISH_3 BOOST_PP_SLOT_CC_2(BOOST_PP_ITERATION_FINISH_3_DIGIT_2, BOOST_PP_ITERATION_FINISH_3_DIGIT_1)
|
||||
# else
|
||||
# define BOOST_PP_ITERATION_FINISH_3 BOOST_PP_ITERATION_FINISH_3_DIGIT_1
|
||||
# endif
|
||||
@@ -0,0 +1,347 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com>
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
// See http://boostorg.github.com/compute for more information.
|
||||
//---------------------------------------------------------------------------//
|
||||
|
||||
#ifndef BOOST_COMPUTE_CLOSURE_HPP
|
||||
#define BOOST_COMPUTE_CLOSURE_HPP
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/fusion/adapted/boost_tuple.hpp>
|
||||
#include <boost/fusion/algorithm/iteration/for_each.hpp>
|
||||
#include <boost/mpl/for_each.hpp>
|
||||
#include <boost/mpl/transform.hpp>
|
||||
#include <boost/typeof/typeof.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/type_traits/function_traits.hpp>
|
||||
|
||||
#include <boost/compute/cl.hpp>
|
||||
#include <boost/compute/function.hpp>
|
||||
#include <boost/compute/type_traits/type_name.hpp>
|
||||
#include <boost/compute/type_traits/detail/capture_traits.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
namespace detail {
|
||||
|
||||
template<class ResultType, class ArgTuple, class CaptureTuple>
|
||||
class invoked_closure
|
||||
{
|
||||
public:
|
||||
typedef ResultType result_type;
|
||||
|
||||
BOOST_STATIC_CONSTANT(
|
||||
size_t, arity = boost::tuples::length<ArgTuple>::value
|
||||
);
|
||||
|
||||
invoked_closure(const std::string &name,
|
||||
const std::string &source,
|
||||
const std::map<std::string, std::string> &definitions,
|
||||
const ArgTuple &args,
|
||||
const CaptureTuple &capture)
|
||||
: m_name(name),
|
||||
m_source(source),
|
||||
m_definitions(definitions),
|
||||
m_args(args),
|
||||
m_capture(capture)
|
||||
{
|
||||
}
|
||||
|
||||
std::string name() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
std::string source() const
|
||||
{
|
||||
return m_source;
|
||||
}
|
||||
|
||||
const std::map<std::string, std::string>& definitions() const
|
||||
{
|
||||
return m_definitions;
|
||||
}
|
||||
|
||||
const ArgTuple& args() const
|
||||
{
|
||||
return m_args;
|
||||
}
|
||||
|
||||
const CaptureTuple& capture() const
|
||||
{
|
||||
return m_capture;
|
||||
}
|
||||
|
||||
private:
|
||||
std::string m_name;
|
||||
std::string m_source;
|
||||
std::map<std::string, std::string> m_definitions;
|
||||
ArgTuple m_args;
|
||||
CaptureTuple m_capture;
|
||||
};
|
||||
|
||||
} // end detail namespace
|
||||
|
||||
/// \internal_
|
||||
template<class Signature, class CaptureTuple>
|
||||
class closure
|
||||
{
|
||||
public:
|
||||
typedef typename
|
||||
boost::function_traits<Signature>::result_type result_type;
|
||||
|
||||
BOOST_STATIC_CONSTANT(
|
||||
size_t, arity = boost::function_traits<Signature>::arity
|
||||
);
|
||||
|
||||
closure(const std::string &name,
|
||||
const CaptureTuple &capture,
|
||||
const std::string &source)
|
||||
: m_name(name),
|
||||
m_source(source),
|
||||
m_capture(capture)
|
||||
{
|
||||
}
|
||||
|
||||
~closure()
|
||||
{
|
||||
}
|
||||
|
||||
std::string name() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
/// \internal_
|
||||
std::string source() const
|
||||
{
|
||||
return m_source;
|
||||
}
|
||||
|
||||
/// \internal_
|
||||
void define(std::string name, std::string value = std::string())
|
||||
{
|
||||
m_definitions[name] = value;
|
||||
}
|
||||
|
||||
/// \internal_
|
||||
detail::invoked_closure<result_type, boost::tuple<>, CaptureTuple>
|
||||
operator()() const
|
||||
{
|
||||
BOOST_STATIC_ASSERT_MSG(
|
||||
arity == 0,
|
||||
"Non-nullary closure function invoked with zero arguments"
|
||||
);
|
||||
|
||||
return detail::invoked_closure<result_type, boost::tuple<>, CaptureTuple>(
|
||||
m_name, m_source, m_definitions, boost::make_tuple(), m_capture
|
||||
);
|
||||
}
|
||||
|
||||
/// \internal_
|
||||
template<class Arg1>
|
||||
detail::invoked_closure<result_type, boost::tuple<Arg1>, CaptureTuple>
|
||||
operator()(const Arg1 &arg1) const
|
||||
{
|
||||
BOOST_STATIC_ASSERT_MSG(
|
||||
arity == 1,
|
||||
"Non-unary closure function invoked with one argument"
|
||||
);
|
||||
|
||||
return detail::invoked_closure<result_type, boost::tuple<Arg1>, CaptureTuple>(
|
||||
m_name, m_source, m_definitions, boost::make_tuple(arg1), m_capture
|
||||
);
|
||||
}
|
||||
|
||||
/// \internal_
|
||||
template<class Arg1, class Arg2>
|
||||
detail::invoked_closure<result_type, boost::tuple<Arg1, Arg2>, CaptureTuple>
|
||||
operator()(const Arg1 &arg1, const Arg2 &arg2) const
|
||||
{
|
||||
BOOST_STATIC_ASSERT_MSG(
|
||||
arity == 2,
|
||||
"Non-binary closure function invoked with two arguments"
|
||||
);
|
||||
|
||||
return detail::invoked_closure<result_type, boost::tuple<Arg1, Arg2>, CaptureTuple>(
|
||||
m_name, m_source, m_definitions, boost::make_tuple(arg1, arg2), m_capture
|
||||
);
|
||||
}
|
||||
|
||||
/// \internal_
|
||||
template<class Arg1, class Arg2, class Arg3>
|
||||
detail::invoked_closure<result_type, boost::tuple<Arg1, Arg2, Arg3>, CaptureTuple>
|
||||
operator()(const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) const
|
||||
{
|
||||
BOOST_STATIC_ASSERT_MSG(
|
||||
arity == 3,
|
||||
"Non-ternary closure function invoked with three arguments"
|
||||
);
|
||||
|
||||
return detail::invoked_closure<result_type, boost::tuple<Arg1, Arg2, Arg3>, CaptureTuple>(
|
||||
m_name, m_source, m_definitions, boost::make_tuple(arg1, arg2, arg3), m_capture
|
||||
);
|
||||
}
|
||||
|
||||
private:
|
||||
std::string m_name;
|
||||
std::string m_source;
|
||||
std::map<std::string, std::string> m_definitions;
|
||||
CaptureTuple m_capture;
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
struct closure_signature_argument_inserter
|
||||
{
|
||||
closure_signature_argument_inserter(std::stringstream &s_,
|
||||
const char *capture_string,
|
||||
size_t last)
|
||||
: s(s_)
|
||||
{
|
||||
n = 0;
|
||||
m_last = last;
|
||||
|
||||
size_t capture_string_length = std::strlen(capture_string);
|
||||
BOOST_ASSERT(capture_string[0] == '(' &&
|
||||
capture_string[capture_string_length-1] == ')');
|
||||
std::string capture_string_(capture_string + 1, capture_string_length - 2);
|
||||
boost::split(m_capture_names, capture_string_ , boost::is_any_of(","));
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void operator()(const T&) const
|
||||
{
|
||||
BOOST_ASSERT(n < m_capture_names.size());
|
||||
|
||||
// get captured variable name
|
||||
std::string variable_name = m_capture_names[n];
|
||||
|
||||
// remove leading and trailing whitespace from variable name
|
||||
boost::trim(variable_name);
|
||||
|
||||
s << capture_traits<T>::type_name() << " " << variable_name;
|
||||
if(n+1 < m_last){
|
||||
s << ", ";
|
||||
}
|
||||
n++;
|
||||
}
|
||||
|
||||
mutable size_t n;
|
||||
size_t m_last;
|
||||
std::vector<std::string> m_capture_names;
|
||||
std::stringstream &s;
|
||||
};
|
||||
|
||||
template<class Signature, class CaptureTuple>
|
||||
inline std::string
|
||||
make_closure_declaration(const char *name,
|
||||
const char *arguments,
|
||||
const CaptureTuple &capture_tuple,
|
||||
const char *capture_string)
|
||||
{
|
||||
typedef typename
|
||||
boost::function_traits<Signature>::result_type result_type;
|
||||
typedef typename
|
||||
boost::function_types::parameter_types<Signature>::type parameter_types;
|
||||
typedef typename
|
||||
mpl::size<parameter_types>::type arity_type;
|
||||
|
||||
std::stringstream s;
|
||||
s << "inline " << type_name<result_type>() << " " << name;
|
||||
s << "(";
|
||||
|
||||
// insert function arguments
|
||||
signature_argument_inserter i(s, arguments, arity_type::value);
|
||||
mpl::for_each<
|
||||
typename mpl::transform<parameter_types, boost::add_pointer<mpl::_1>
|
||||
>::type>(i);
|
||||
s << ", ";
|
||||
|
||||
// insert capture arguments
|
||||
closure_signature_argument_inserter j(
|
||||
s, capture_string, boost::tuples::length<CaptureTuple>::value
|
||||
);
|
||||
fusion::for_each(capture_tuple, j);
|
||||
|
||||
s << ")";
|
||||
return s.str();
|
||||
}
|
||||
|
||||
// used by the BOOST_COMPUTE_CLOSURE() macro to create a closure
|
||||
// function with the given signature, name, capture, and source.
|
||||
template<class Signature, class CaptureTuple>
|
||||
inline closure<Signature, CaptureTuple>
|
||||
make_closure_impl(const char *name,
|
||||
const char *arguments,
|
||||
const CaptureTuple &capture,
|
||||
const char *capture_string,
|
||||
const std::string &source)
|
||||
{
|
||||
std::stringstream s;
|
||||
s << make_closure_declaration<Signature>(name, arguments, capture, capture_string);
|
||||
s << source;
|
||||
|
||||
return closure<Signature, CaptureTuple>(name, capture, s.str());
|
||||
}
|
||||
|
||||
} // end detail namespace
|
||||
} // end compute namespace
|
||||
} // end boost namespace
|
||||
|
||||
/// Creates a closure function object with \p name and \p source.
|
||||
///
|
||||
/// \param return_type The return type for the function.
|
||||
/// \param name The name of the function.
|
||||
/// \param arguments A list of arguments for the function.
|
||||
/// \param capture A list of variables to capture.
|
||||
/// \param source The OpenCL C source code for the function.
|
||||
///
|
||||
/// For example, to create a function which checks if a 2D point is
|
||||
/// contained in a circle of a given radius:
|
||||
/// \code
|
||||
/// // radius variable declared in C++
|
||||
/// float radius = 1.5f;
|
||||
///
|
||||
/// // create a closure function which returns true if the 2D point
|
||||
/// // argument is contained within a circle of the given radius
|
||||
/// BOOST_COMPUTE_CLOSURE(bool, is_in_circle, (const float2_ p), (radius),
|
||||
/// {
|
||||
/// return sqrt(p.x*p.x + p.y*p.y) < radius;
|
||||
/// });
|
||||
///
|
||||
/// // vector of 2D points
|
||||
/// boost::compute::vector<float2_> points = ...
|
||||
///
|
||||
/// // count number of points in the circle
|
||||
/// size_t count = boost::compute::count_if(
|
||||
/// points.begin(), points.end(), is_in_circle, queue
|
||||
/// );
|
||||
/// \endcode
|
||||
///
|
||||
/// \see BOOST_COMPUTE_FUNCTION()
|
||||
#ifdef BOOST_COMPUTE_DOXYGEN_INVOKED
|
||||
#define BOOST_COMPUTE_CLOSURE(return_type, name, arguments, capture, source)
|
||||
#else
|
||||
#define BOOST_COMPUTE_CLOSURE(return_type, name, arguments, capture, ...) \
|
||||
::boost::compute::closure< \
|
||||
return_type arguments, BOOST_TYPEOF(boost::tie capture) \
|
||||
> name = \
|
||||
::boost::compute::detail::make_closure_impl< \
|
||||
return_type arguments \
|
||||
>( \
|
||||
#name, #arguments, boost::tie capture, #capture, #__VA_ARGS__ \
|
||||
)
|
||||
#endif
|
||||
|
||||
#endif // BOOST_COMPUTE_CLOSURE_HPP
|
||||
@@ -0,0 +1,27 @@
|
||||
# /* Copyright (C) 2001
|
||||
# * Housemarque Oy
|
||||
# * http://www.housemarque.com
|
||||
# *
|
||||
# * Distributed under the Boost Software License, Version 1.0. (See
|
||||
# * accompanying file LICENSE_1_0.txt or copy at
|
||||
# * http://www.boost.org/LICENSE_1_0.txt)
|
||||
# */
|
||||
#
|
||||
# /* Revised by Paul Mensonides (2002) */
|
||||
# /* Revised by Edward Diener (2015) */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# ifndef BOOST_PREPROCESSOR_FACILITIES_IDENTITY_HPP
|
||||
# define BOOST_PREPROCESSOR_FACILITIES_IDENTITY_HPP
|
||||
#
|
||||
# include <boost/preprocessor/facilities/empty.hpp>
|
||||
# include <boost/preprocessor/tuple/eat.hpp>
|
||||
#
|
||||
# /* BOOST_PP_IDENTITY */
|
||||
#
|
||||
# define BOOST_PP_IDENTITY(item) item BOOST_PP_EMPTY
|
||||
#
|
||||
# define BOOST_PP_IDENTITY_N(item,n) item BOOST_PP_TUPLE_EAT_N(n)
|
||||
#
|
||||
# endif
|
||||
@@ -0,0 +1,641 @@
|
||||
/*
|
||||
[auto_generated]
|
||||
boost/numeric/odeint/stepper/bulirsch_stoer.hpp
|
||||
|
||||
[begin_description]
|
||||
Implementation of the Burlish-Stoer method. As described in
|
||||
Ernst Hairer, Syvert Paul Norsett, Gerhard Wanner
|
||||
Solving Ordinary Differential Equations I. Nonstiff Problems.
|
||||
Springer Series in Comput. Mathematics, Vol. 8, Springer-Verlag 1987, Second revised edition 1993.
|
||||
[end_description]
|
||||
|
||||
Copyright 2011-2013 Mario Mulansky
|
||||
Copyright 2011-2013 Karsten Ahnert
|
||||
Copyright 2012 Christoph Koke
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or
|
||||
copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_BULIRSCH_STOER_HPP_INCLUDED
|
||||
#define BOOST_NUMERIC_ODEINT_STEPPER_BULIRSCH_STOER_HPP_INCLUDED
|
||||
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <boost/config.hpp> // for min/max guidelines
|
||||
|
||||
#include <boost/numeric/odeint/util/bind.hpp>
|
||||
#include <boost/numeric/odeint/util/unwrap_reference.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/util/detail/less_with_sign.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 {
|
||||
|
||||
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;
|
||||
#ifndef DOXYGEN_SKIP
|
||||
typedef state_wrapper< state_type > wrapped_state_type;
|
||||
typedef state_wrapper< deriv_type > wrapped_deriv_type;
|
||||
typedef controlled_stepper_tag stepper_category;
|
||||
|
||||
typedef bulirsch_stoer< 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_table_type;
|
||||
#endif //DOXYGEN_SKIP
|
||||
const static size_t m_k_max = 8;
|
||||
|
||||
bulirsch_stoer(
|
||||
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))
|
||||
: m_error_checker( eps_abs , eps_rel , factor_x, factor_dxdt ) , m_midpoint() ,
|
||||
m_last_step_rejected( false ) , m_first( true ) ,
|
||||
m_max_dt(max_dt) ,
|
||||
m_interval_sequence( m_k_max+1 ) ,
|
||||
m_coeff( m_k_max+1 ) ,
|
||||
m_cost( m_k_max+1 ) ,
|
||||
m_table( m_k_max ) ,
|
||||
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();
|
||||
/* initialize sequence of stage numbers and work */
|
||||
for( unsigned short i = 0; i < m_k_max+1; i++ )
|
||||
{
|
||||
m_interval_sequence[i] = 2 * (i+1);
|
||||
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( static_cast<value_type>( 1 ) , min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<value_type>( m_k_max-1 ) , logfact ));
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Version 1 : try_step( sys , x , t , dt )
|
||||
*
|
||||
* The overloads are needed to solve the forwarding problem
|
||||
*/
|
||||
template< class System , class StateInOut >
|
||||
controlled_step_result try_step( System system , StateInOut &x , time_type &t , time_type &dt )
|
||||
{
|
||||
return try_step_v1( system , x , t, dt );
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Second version to solve the forwarding problem, can be used with Boost.Range as StateInOut.
|
||||
*/
|
||||
template< class System , class StateInOut >
|
||||
controlled_step_result try_step( System system , const StateInOut &x , time_type &t , time_type &dt )
|
||||
{
|
||||
return try_step_v1( system , x , t, dt );
|
||||
}
|
||||
|
||||
/*
|
||||
* Version 2 : try_step( sys , x , dxdt , t , dt )
|
||||
*
|
||||
* this version does not solve the forwarding problem, boost.range can not be used
|
||||
*/
|
||||
template< class System , class StateInOut , class DerivIn >
|
||||
controlled_step_result try_step( System system , StateInOut &x , const DerivIn &dxdt , time_type &t , time_type &dt )
|
||||
{
|
||||
m_xnew_resizer.adjust_size( x , detail::bind( &controlled_error_bs_type::template resize_m_xnew< StateInOut > , detail::ref( *this ) , detail::_1 ) );
|
||||
controlled_step_result res = try_step( system , x , dxdt , t , m_xnew.m_v , dt );
|
||||
if( res == success )
|
||||
{
|
||||
boost::numeric::odeint::copy( m_xnew.m_v , x );
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* Version 3 : try_step( sys , in , t , out , dt )
|
||||
*
|
||||
* this version does not solve the forwarding problem, boost.range can not be used
|
||||
*/
|
||||
template< class System , class StateIn , class StateOut >
|
||||
typename boost::disable_if< boost::is_same< StateIn , time_type > , controlled_step_result >::type
|
||||
try_step( System system , const StateIn &in , time_type &t , StateOut &out , time_type &dt )
|
||||
{
|
||||
typename odeint::unwrap_reference< System >::type &sys = system;
|
||||
m_dxdt_resizer.adjust_size( in , detail::bind( &controlled_error_bs_type::template resize_m_dxdt< StateIn > , detail::ref( *this ) , detail::_1 ) );
|
||||
sys( in , m_dxdt.m_v , t );
|
||||
return try_step( system , in , m_dxdt.m_v , t , out , dt );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Full version : try_step( sys , in , dxdt_in , t , out , dt )
|
||||
*
|
||||
* contains the actual implementation
|
||||
*/
|
||||
template< class System , class StateIn , class DerivIn , class StateOut >
|
||||
controlled_step_result try_step( System system , const StateIn &in , const DerivIn &dxdt , time_type &t , StateOut &out , 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();
|
||||
|
||||
static const value_type val1( 1.0 );
|
||||
|
||||
if( m_resizer.adjust_size( in , detail::bind( &controlled_error_bs_type::template resize_impl< StateIn > , detail::ref( *this ) , detail::_1 ) ) )
|
||||
{
|
||||
reset(); // system resized -> reset
|
||||
}
|
||||
|
||||
if( dt != m_dt_last )
|
||||
{
|
||||
reset(); // step size changed from outside -> reset
|
||||
}
|
||||
|
||||
bool reject( true );
|
||||
|
||||
time_vector h_opt( m_k_max+1 );
|
||||
inv_time_vector work( m_k_max+1 );
|
||||
|
||||
time_type new_h = dt;
|
||||
|
||||
/* m_current_k_opt is the estimated current optimal stage number */
|
||||
for( size_t k = 0 ; k <= m_current_k_opt+1 ; k++ )
|
||||
{
|
||||
/* the stage counts are stored in m_interval_sequence */
|
||||
m_midpoint.set_steps( m_interval_sequence[k] );
|
||||
if( k == 0 )
|
||||
{
|
||||
m_midpoint.do_step( system , in , dxdt , t , out , dt );
|
||||
/* the first step, nothing more to do */
|
||||
}
|
||||
else
|
||||
{
|
||||
m_midpoint.do_step( system , in , dxdt , t , m_table[k-1].m_v , dt );
|
||||
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];
|
||||
|
||||
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];
|
||||
new_h *= 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];
|
||||
new_h *= m_cost[m_current_k_opt]/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 )
|
||||
{
|
||||
t += dt;
|
||||
}
|
||||
|
||||
if( !m_last_step_rejected || boost::numeric::odeint::detail::less_with_sign(new_h, dt, dt) )
|
||||
{
|
||||
// limit step size
|
||||
if( m_max_dt != static_cast<time_type>(0) )
|
||||
{
|
||||
new_h = detail::min_abs(m_max_dt, new_h);
|
||||
}
|
||||
m_dt_last = new_h;
|
||||
dt = new_h;
|
||||
}
|
||||
|
||||
m_last_step_rejected = reject;
|
||||
m_first = false;
|
||||
|
||||
if( reject )
|
||||
return fail;
|
||||
else
|
||||
return success;
|
||||
}
|
||||
|
||||
/** \brief Resets the internal state of the stepper */
|
||||
void reset()
|
||||
{
|
||||
m_first = true;
|
||||
m_last_step_rejected = false;
|
||||
}
|
||||
|
||||
|
||||
/* Resizer methods */
|
||||
|
||||
template< class StateIn >
|
||||
void adjust_size( const StateIn &x )
|
||||
{
|
||||
resize_m_dxdt( x );
|
||||
resize_m_xnew( x );
|
||||
resize_impl( x );
|
||||
m_midpoint.adjust_size( x );
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
template< class StateIn >
|
||||
bool resize_m_dxdt( const StateIn &x )
|
||||
{
|
||||
return adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() );
|
||||
}
|
||||
|
||||
template< class StateIn >
|
||||
bool resize_m_xnew( const StateIn &x )
|
||||
{
|
||||
return adjust_size_by_resizeability( m_xnew , x , typename is_resizeable<state_type>::type() );
|
||||
}
|
||||
|
||||
template< class StateIn >
|
||||
bool resize_impl( const StateIn &x )
|
||||
{
|
||||
bool resized( false );
|
||||
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() );
|
||||
resized |= adjust_size_by_resizeability( m_err , x , typename is_resizeable<state_type>::type() );
|
||||
return resized;
|
||||
}
|
||||
|
||||
|
||||
template< class System , class StateInOut >
|
||||
controlled_step_result try_step_v1( System system , StateInOut &x , time_type &t , time_type &dt )
|
||||
{
|
||||
typename odeint::unwrap_reference< System >::type &sys = system;
|
||||
m_dxdt_resizer.adjust_size( x , detail::bind( &controlled_error_bs_type::template resize_m_dxdt< StateInOut > , detail::ref( *this ) , detail::_1 ) );
|
||||
sys( x , m_dxdt.m_v ,t );
|
||||
return try_step( system , x , m_dxdt.m_v , t , dt );
|
||||
}
|
||||
|
||||
|
||||
template< class StateInOut >
|
||||
void extrapolate( size_t k , state_table_type &table , const value_matrix &coeff , StateInOut &xest )
|
||||
/* polynomial extrapolation, see http://www.nr.com/webnotes/nr3web21.pdf
|
||||
uses the obtained intermediate results to extrapolate to dt->0
|
||||
*/
|
||||
{
|
||||
static const value_type val1 = static_cast< value_type >( 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][j] , -coeff[k][j] ) );
|
||||
}
|
||||
m_algebra.for_each3( xest , table[0].m_v , xest ,
|
||||
typename operations_type::template scale_sum2< value_type , value_type >( val1 + coeff[k][0] , -coeff[k][0]) );
|
||||
}
|
||||
|
||||
time_type calc_h_opt( time_type h , value_type error , size_t k ) const
|
||||
/* calculates the optimal step size for a given error and stage number */
|
||||
{
|
||||
BOOST_USING_STD_MIN();
|
||||
BOOST_USING_STD_MAX();
|
||||
using std::pow;
|
||||
value_type expo( 1.0/(2*k+1) );
|
||||
value_type facmin = pow BOOST_PREVENT_MACRO_SUBSTITUTION( STEPFAC3 , expo );
|
||||
value_type fac;
|
||||
if (error == 0.0)
|
||||
fac=1.0/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>(1.0/facmin) , fac ) );
|
||||
}
|
||||
return h*fac;
|
||||
}
|
||||
|
||||
controlled_step_result set_k_opt( size_t k , const inv_time_vector &work , const time_vector &h_opt , time_type &dt )
|
||||
/* calculates the optimal stage number */
|
||||
{
|
||||
if( k == 1 )
|
||||
{
|
||||
m_current_k_opt = 2;
|
||||
return success;
|
||||
}
|
||||
if( (work[k-1] < KFAC1*work[k]) || (k == m_k_max) )
|
||||
{ // order decrease
|
||||
m_current_k_opt = k-1;
|
||||
dt = h_opt[ m_current_k_opt ];
|
||||
return success;
|
||||
}
|
||||
else if( (work[k] < KFAC2*work[k-1]) || m_last_step_rejected || (k == m_k_max-1) )
|
||||
{ // same order - also do this if last step got rejected
|
||||
m_current_k_opt = k;
|
||||
dt = h_opt[ m_current_k_opt ];
|
||||
return success;
|
||||
}
|
||||
else
|
||||
{ // order increase - only if last step was not rejected
|
||||
m_current_k_opt = k+1;
|
||||
dt = h_opt[ m_current_k_opt-1 ] * m_cost[ m_current_k_opt ] / m_cost[ m_current_k_opt-1 ] ;
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
||||
bool in_convergence_window( size_t k ) const
|
||||
{
|
||||
if( (k == m_current_k_opt-1) && !m_last_step_rejected )
|
||||
return true; // decrease stepsize 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] / m_interval_sequence[0];
|
||||
return ( error > d*d );
|
||||
} else
|
||||
return error > 1.0;
|
||||
}
|
||||
|
||||
default_error_checker< value_type, algebra_type , operations_type > m_error_checker;
|
||||
modified_midpoint< state_type , value_type , deriv_type , time_type , algebra_type , operations_type , resizer_type > m_midpoint;
|
||||
|
||||
bool m_last_step_rejected;
|
||||
bool m_first;
|
||||
|
||||
time_type m_dt_last;
|
||||
time_type m_t_last;
|
||||
time_type m_max_dt;
|
||||
|
||||
size_t m_current_k_opt;
|
||||
|
||||
algebra_type m_algebra;
|
||||
|
||||
resizer_type m_dxdt_resizer;
|
||||
resizer_type m_xnew_resizer;
|
||||
resizer_type m_resizer;
|
||||
|
||||
wrapped_state_type m_xnew;
|
||||
wrapped_state_type m_err;
|
||||
wrapped_deriv_type m_dxdt;
|
||||
|
||||
int_vector m_interval_sequence; // stores the successive interval counts
|
||||
value_matrix m_coeff;
|
||||
int_vector m_cost; // costs for interval count
|
||||
|
||||
state_table_type m_table; // sequence of states for extrapolation
|
||||
|
||||
value_type STEPFAC1 , STEPFAC2 , STEPFAC3 , STEPFAC4 , KFAC1 , KFAC2;
|
||||
};
|
||||
|
||||
|
||||
/******** DOXYGEN ********/
|
||||
/**
|
||||
* \class bulirsch_stoer
|
||||
* \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.
|
||||
*
|
||||
* \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::bulirsch_stoer( value_type eps_abs , value_type eps_rel , value_type factor_x , value_type factor_dxdt )
|
||||
* \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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn bulirsch_stoer::try_step( System system , StateInOut &x , time_type &t , 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 x The state of the ODE which should be solved. Overwritten if
|
||||
* the step is successful.
|
||||
* \param t The value of the time. Updated if the step is successful.
|
||||
* \param dt The step size. Updated.
|
||||
* \return success if the step was accepted, fail otherwise.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn bulirsch_stoer::try_step( System system , StateInOut &x , const DerivIn &dxdt , time_type &t , 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 x The state of the ODE which should be solved. Overwritten if
|
||||
* the step is successful.
|
||||
* \param dxdt The derivative of state.
|
||||
* \param t The value of the time. Updated if the step is successful.
|
||||
* \param dt The step size. Updated.
|
||||
* \return success if the step was accepted, fail otherwise.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn bulirsch_stoer::try_step( System system , const StateIn &in , time_type &t , StateOut &out , time_type &dt )
|
||||
* \brief Tries to perform one step.
|
||||
*
|
||||
* \note This method is disabled if state_type=time_type to avoid ambiguity.
|
||||
*
|
||||
* 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 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::try_step( System system , const StateIn &in , const DerivIn &dxdt , time_type &t , StateOut &out , 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::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,329 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// format_implementation.hpp Implementation of the basic_format class
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// Copyright Samuel Krempp 2003. 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/format for library home page
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifndef BOOST_FORMAT_IMPLEMENTATION_HPP
|
||||
#define BOOST_FORMAT_IMPLEMENTATION_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/format/format_class.hpp>
|
||||
#include <algorithm> // std::swap
|
||||
|
||||
namespace boost {
|
||||
|
||||
// --- basic_format implementation -----------------------------------------//
|
||||
|
||||
template< class Ch, class Tr, class Alloc>
|
||||
basic_format<Ch, Tr, Alloc>:: basic_format(const Ch* s)
|
||||
: style_(0), cur_arg_(0), num_args_(0), dumped_(false),
|
||||
exceptions_(io::all_error_bits)
|
||||
{
|
||||
if( s)
|
||||
parse( s );
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_STD_LOCALE)
|
||||
template< class Ch, class Tr, class Alloc>
|
||||
basic_format<Ch, Tr, Alloc>:: basic_format(const Ch* s, const std::locale & loc)
|
||||
: style_(0), cur_arg_(0), num_args_(0), dumped_(false),
|
||||
exceptions_(io::all_error_bits), loc_(loc)
|
||||
{
|
||||
if(s) parse( s );
|
||||
}
|
||||
|
||||
template< class Ch, class Tr, class Alloc>
|
||||
basic_format<Ch, Tr, Alloc>:: basic_format(const string_type& s, const std::locale & loc)
|
||||
: style_(0), cur_arg_(0), num_args_(0), dumped_(false),
|
||||
exceptions_(io::all_error_bits), loc_(loc)
|
||||
{
|
||||
parse(s);
|
||||
}
|
||||
#endif // ! BOOST_NO_STD_LOCALE
|
||||
template< class Ch, class Tr, class Alloc>
|
||||
io::detail::locale_t basic_format<Ch, Tr, Alloc>::
|
||||
getloc() const {
|
||||
return loc_ ? loc_.get() : io::detail::locale_t();
|
||||
}
|
||||
|
||||
template< class Ch, class Tr, class Alloc>
|
||||
basic_format<Ch, Tr, Alloc>:: basic_format(const string_type& s)
|
||||
: style_(0), cur_arg_(0), num_args_(0), dumped_(false),
|
||||
exceptions_(io::all_error_bits)
|
||||
{
|
||||
parse(s);
|
||||
}
|
||||
|
||||
template< class Ch, class Tr, class Alloc> // just don't copy the buf_ member
|
||||
basic_format<Ch, Tr, Alloc>:: basic_format(const basic_format& x)
|
||||
: items_(x.items_), bound_(x.bound_), style_(x.style_),
|
||||
cur_arg_(x.cur_arg_), num_args_(x.num_args_), dumped_(x.dumped_),
|
||||
prefix_(x.prefix_), exceptions_(x.exceptions_), loc_(x.loc_)
|
||||
{
|
||||
}
|
||||
|
||||
template< class Ch, class Tr, class Alloc> // just don't copy the buf_ member
|
||||
basic_format<Ch, Tr, Alloc>& basic_format<Ch, Tr, Alloc>::
|
||||
operator= (const basic_format& x) {
|
||||
if(this == &x)
|
||||
return *this;
|
||||
(basic_format<Ch, Tr, Alloc>(x)).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
template< class Ch, class Tr, class Alloc>
|
||||
void basic_format<Ch, Tr, Alloc>::
|
||||
swap (basic_format & x) {
|
||||
std::swap(exceptions_, x.exceptions_);
|
||||
std::swap(style_, x.style_);
|
||||
std::swap(cur_arg_, x.cur_arg_);
|
||||
std::swap(num_args_, x.num_args_);
|
||||
std::swap(dumped_, x.dumped_);
|
||||
|
||||
items_.swap(x.items_);
|
||||
prefix_.swap(x.prefix_);
|
||||
bound_.swap(x.bound_);
|
||||
}
|
||||
|
||||
template< class Ch, class Tr, class Alloc>
|
||||
unsigned char basic_format<Ch,Tr, Alloc>:: exceptions() const {
|
||||
return exceptions_;
|
||||
}
|
||||
|
||||
template< class Ch, class Tr, class Alloc>
|
||||
unsigned char basic_format<Ch,Tr, Alloc>:: exceptions(unsigned char newexcept) {
|
||||
unsigned char swp = exceptions_;
|
||||
exceptions_ = newexcept;
|
||||
return swp;
|
||||
}
|
||||
|
||||
template<class Ch, class Tr, class Alloc>
|
||||
void basic_format<Ch, Tr, Alloc>::
|
||||
make_or_reuse_data (std::size_t nbitems) {
|
||||
#if !defined(BOOST_NO_STD_LOCALE)
|
||||
Ch fill = ( BOOST_USE_FACET(std::ctype<Ch>, getloc()) ). widen(' ');
|
||||
#else
|
||||
Ch fill = ' ';
|
||||
#endif
|
||||
if(items_.size() == 0)
|
||||
items_.assign( nbitems, format_item_t(fill) );
|
||||
else {
|
||||
if(nbitems>items_.size())
|
||||
items_.resize(nbitems, format_item_t(fill));
|
||||
bound_.resize(0);
|
||||
for(std::size_t i=0; i < nbitems; ++i)
|
||||
items_[i].reset(fill); // strings are resized, instead of reallocated
|
||||
}
|
||||
prefix_.resize(0);
|
||||
}
|
||||
|
||||
template< class Ch, class Tr, class Alloc>
|
||||
basic_format<Ch,Tr, Alloc>& basic_format<Ch,Tr, Alloc>::
|
||||
clear () {
|
||||
// empty the string buffers (except bound arguments)
|
||||
// and make the format object ready for formatting a new set of arguments
|
||||
|
||||
BOOST_ASSERT( bound_.size()==0 || num_args_ == static_cast<int>(bound_.size()) );
|
||||
|
||||
for(unsigned long i=0; i<items_.size(); ++i) {
|
||||
// clear converted strings only if the corresponding argument is not bound :
|
||||
if( bound_.size()==0 || items_[i].argN_<0 || !bound_[ items_[i].argN_ ] )
|
||||
items_[i].res_.resize(0);
|
||||
}
|
||||
cur_arg_=0; dumped_=false;
|
||||
// maybe first arg is bound:
|
||||
if(bound_.size() != 0) {
|
||||
for(; cur_arg_ < num_args_ && bound_[cur_arg_]; ++cur_arg_)
|
||||
{}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template< class Ch, class Tr, class Alloc>
|
||||
basic_format<Ch,Tr, Alloc>& basic_format<Ch,Tr, Alloc>::
|
||||
clear_binds () {
|
||||
// remove all binds, then clear()
|
||||
bound_.resize(0);
|
||||
clear();
|
||||
return *this;
|
||||
}
|
||||
|
||||
template< class Ch, class Tr, class Alloc>
|
||||
basic_format<Ch,Tr, Alloc>& basic_format<Ch,Tr, Alloc>::
|
||||
clear_bind (int argN) {
|
||||
// remove the bind of ONE argument then clear()
|
||||
if(argN<1 || argN > num_args_ || bound_.size()==0 || !bound_[argN-1] ) {
|
||||
if( exceptions() & io::out_of_range_bit)
|
||||
boost::throw_exception(io::out_of_range(argN, 1, num_args_+1 ) );
|
||||
else return *this;
|
||||
}
|
||||
bound_[argN-1]=false;
|
||||
clear();
|
||||
return *this;
|
||||
}
|
||||
|
||||
template< class Ch, class Tr, class Alloc>
|
||||
int basic_format<Ch,Tr, Alloc>::
|
||||
bound_args() const {
|
||||
if(bound_.size()==0)
|
||||
return 0;
|
||||
int n=0;
|
||||
for(int i=0; i<num_args_ ; ++i)
|
||||
if(bound_[i])
|
||||
++n;
|
||||
return n;
|
||||
}
|
||||
|
||||
template< class Ch, class Tr, class Alloc>
|
||||
int basic_format<Ch,Tr, Alloc>::
|
||||
fed_args() const {
|
||||
if(bound_.size()==0)
|
||||
return cur_arg_;
|
||||
int n=0;
|
||||
for(int i=0; i<cur_arg_ ; ++i)
|
||||
if(!bound_[i])
|
||||
++n;
|
||||
return n;
|
||||
}
|
||||
|
||||
template< class Ch, class Tr, class Alloc>
|
||||
int basic_format<Ch,Tr, Alloc>::
|
||||
cur_arg() const {
|
||||
return cur_arg_+1; }
|
||||
|
||||
template< class Ch, class Tr, class Alloc>
|
||||
int basic_format<Ch,Tr, Alloc>::
|
||||
remaining_args() const {
|
||||
if(bound_.size()==0)
|
||||
return num_args_-cur_arg_;
|
||||
int n=0;
|
||||
for(int i=cur_arg_; i<num_args_ ; ++i)
|
||||
if(!bound_[i])
|
||||
++n;
|
||||
return n;
|
||||
}
|
||||
|
||||
template< class Ch, class Tr, class Alloc>
|
||||
typename basic_format<Ch, Tr, Alloc>::string_type
|
||||
basic_format<Ch,Tr, Alloc>::
|
||||
str () const {
|
||||
if(items_.size()==0)
|
||||
return prefix_;
|
||||
if( cur_arg_ < num_args_)
|
||||
if( exceptions() & io::too_few_args_bit )
|
||||
// not enough variables supplied
|
||||
boost::throw_exception(io::too_few_args(cur_arg_, num_args_));
|
||||
|
||||
unsigned long i;
|
||||
string_type res;
|
||||
res.reserve(size());
|
||||
res += prefix_;
|
||||
for(i=0; i < items_.size(); ++i) {
|
||||
const format_item_t& item = items_[i];
|
||||
res += item.res_;
|
||||
if( item.argN_ == format_item_t::argN_tabulation) {
|
||||
BOOST_ASSERT( item.pad_scheme_ & format_item_t::tabulation);
|
||||
if( static_cast<size_type>(item.fmtstate_.width_) > res.size() )
|
||||
res.append( static_cast<size_type>(item.fmtstate_.width_) - res.size(),
|
||||
item.fmtstate_.fill_ );
|
||||
}
|
||||
res += item.appendix_;
|
||||
}
|
||||
dumped_=true;
|
||||
return res;
|
||||
}
|
||||
template< class Ch, class Tr, class Alloc>
|
||||
typename std::basic_string<Ch, Tr, Alloc>::size_type basic_format<Ch,Tr, Alloc>::
|
||||
size () const {
|
||||
#ifdef BOOST_MSVC
|
||||
// If std::min<unsigned> or std::max<unsigned> are already instantiated
|
||||
// at this point then we get a blizzard of warning messages when we call
|
||||
// those templates with std::size_t as arguments. Weird and very annoyning...
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4267)
|
||||
#endif
|
||||
BOOST_USING_STD_MAX();
|
||||
size_type sz = prefix_.size();
|
||||
unsigned long i;
|
||||
for(i=0; i < items_.size(); ++i) {
|
||||
const format_item_t& item = items_[i];
|
||||
sz += item.res_.size();
|
||||
if( item.argN_ == format_item_t::argN_tabulation)
|
||||
sz = max BOOST_PREVENT_MACRO_SUBSTITUTION (sz,
|
||||
static_cast<size_type>(item.fmtstate_.width_) );
|
||||
sz += item.appendix_.size();
|
||||
}
|
||||
return sz;
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace io {
|
||||
namespace detail {
|
||||
|
||||
template<class Ch, class Tr, class Alloc, class T>
|
||||
basic_format<Ch, Tr, Alloc>&
|
||||
bind_arg_body (basic_format<Ch, Tr, Alloc>& self, int argN, const T& val) {
|
||||
// bind one argument to a fixed value
|
||||
// this is persistent over clear() calls, thus also over str() and <<
|
||||
if(self.dumped_)
|
||||
self.clear(); // needed because we will modify cur_arg_
|
||||
if(argN<1 || argN > self.num_args_) {
|
||||
if( self.exceptions() & io::out_of_range_bit )
|
||||
boost::throw_exception(io::out_of_range(argN, 1, self.num_args_+1 ) );
|
||||
else return self;
|
||||
}
|
||||
if(self.bound_.size()==0)
|
||||
self.bound_.assign(self.num_args_,false);
|
||||
else
|
||||
BOOST_ASSERT( self.num_args_ == static_cast<signed int>(self.bound_.size()) );
|
||||
int o_cur_arg = self.cur_arg_;
|
||||
self.cur_arg_ = argN-1; // arrays begin at 0
|
||||
|
||||
self.bound_[self.cur_arg_]=false; // if already set, we unset and re-sets..
|
||||
self.operator%(val); // put val at the right place, because cur_arg is set
|
||||
|
||||
|
||||
// Now re-position cur_arg before leaving :
|
||||
self.cur_arg_ = o_cur_arg;
|
||||
self.bound_[argN-1]=true;
|
||||
if(self.cur_arg_ == argN-1 ) {
|
||||
// hum, now this arg is bound, so move to next free arg
|
||||
while(self.cur_arg_ < self.num_args_ && self.bound_[self.cur_arg_])
|
||||
++self.cur_arg_;
|
||||
}
|
||||
// In any case, we either have all args, or are on an unbound arg :
|
||||
BOOST_ASSERT( self.cur_arg_ >= self.num_args_ || ! self.bound_[self.cur_arg_]);
|
||||
return self;
|
||||
}
|
||||
|
||||
template<class Ch, class Tr, class Alloc, class T> basic_format<Ch, Tr, Alloc>&
|
||||
modify_item_body (basic_format<Ch, Tr, Alloc>& self, int itemN, T manipulator) {
|
||||
// applies a manipulator to the format_item describing a given directive.
|
||||
// this is a permanent change, clear or reset won't cancel that.
|
||||
if(itemN<1 || itemN > static_cast<signed int>(self.items_.size() )) {
|
||||
if( self.exceptions() & io::out_of_range_bit )
|
||||
boost::throw_exception(io::out_of_range(itemN, 1, static_cast<int>(self.items_.size()) ));
|
||||
else return self;
|
||||
}
|
||||
self.items_[itemN-1].fmtstate_. template apply_manip<T> ( manipulator );
|
||||
return self;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace io
|
||||
} // namespace boost
|
||||
|
||||
|
||||
|
||||
#endif // BOOST_FORMAT_IMPLEMENTATION_HPP
|
||||
Reference in New Issue
Block a user